[Bf-committers] uiList: ctrl-clic-edit name

Bastien Montagne montagne29 at wanadoo.fr
Sun Nov 10 10:28:24 CET 2013

Hi devs,

Here is a patch enabling clic-edit of items' names in an uiList: 

The only change needed from user POV is to add the "rename_propname" 
parameter to its template_list() call.

The proposed solution is a bit hackish (but works perfectly afaict), but 
I can't see any who wouldn't, given the fact that we want to avoid 
having to change all uiLists code to use something else than label() for 
items' names... What it does basically is:

* In uilist handler, detect ctrl-lmb clic on a listrow button;
* Mark the uiList as pending renaming on related item;
* In draw function, change first LISTLABEL of the relevant item in a TEX 
one, and add a fake event to force uilist handler to be run again.
* Back in uilist handler, when a rename is pending, try to find our TEX 
button (which abuses UI_BUT_COLOR_CUBIC as marker) and activate it.

As usual, any feedback is much welcomed! :)

PS: Do not take into account changes in properties_data_mesh.py, these 
are mostly used for testing, not to be committed!

Best regards,

More information about the Bf-committers mailing list