Page MenuHome

Python: UI issues with invoke_props_dialog()
Closed, InvalidPublicTO DO


1.) invoke_props_dialog() is kinda special, since that dialog stays opened even if user mouse leaves the its bounds. So it should really execute the operator if OK is clicked, and vanish if user clicks outside. If you add a dropdown list, e.g. prop_search(), a click to pick an items from list may be considered as a click outside of the dialog bounds. As long as such a list is opened, clicks should be ignored by the dialog and only be handled by the list (nom-nom-principle). See attached script, run and try to select "Material 6".

2.) The relatively new "x" icon to the right of the prop_search field doesn't work inside of the invoke_props_dialog, possibly not in the other popups either. It either should work, or icon not be shown - i'd prefer the former.

3.) Without custom draw() func, the StringProperty's label is shown above the input field (2 rows). With a custom draw(), the label draws in front of the input field (one row). Is there a nicer way to put the label above other than label(...) + prop(..., text="")? See attached picture.

Event Timeline

4.) If you add operator buttons to the dialog, they will work exactly once. If you click again, nothing happens. If you add the same op 3x, then each of the buttons will work 1x. I tried to workaround this using props with update callbacks and other stuff that came to mind, but it didn't work either or even crashed Blender.

fixed bugs 1, 2.

3 isn't a bug, this is simply rows vs columns, without a custom draw function its drawing columns.

4 - is know problem, but not trivial to change.
better postpone this until after 2.67 release.

Well there is no difference between layout.column() and layout.row() in the result with a custom draw method

layout = self.layout
col = layout.column()
col.prop_search(self, "prop", self, "mats", icon='MATERIAL')

it will still put the label left and the field next to it to the right, not a column.

Ah I see now,
The info to do a prop_search button isnt stored in the properties, (the relationship between "prop" and "mats"), so the automatic UI wont display these.

Added todo:

And a todo for operator buttons only executing once (in this case it may be best to have a way to redraw the region)

Campbell Barton (campbellbarton) changed the task status from Unknown Status to Unknown Status.Apr 30 2013, 4:26 PM

Going through the UI ToDo tasks to check status. It seems to me 4) is resolved? I.e. you can have buttons there and press them multiple times. Not sure though if I understand correctly.