theodox / mGui

Python module for cleaner maya GUI layout syntax
MIT License
123 stars 23 forks source link

Add absolute references to names #23

Closed theodox closed 8 years ago

theodox commented 9 years ago

We track names for path access. We should also track allow some method to generate variables on the top level control of a group that tells parent controls to collect it. Here's the idiom i have in mind:

with Window('root') as w:
    with FillForm('ignoreme'):
          with HeaderForm("ignoremetoo")
                Button ("@important")

 w.important.command += do_something

but we'd keep existing behavior so w.important would be the same as

w.ignoreme.ignoremetoo.important 
theodox commented 9 years ago

The alternative paradigm would be to add a 'find' command to all layouts which looked for a name in their children. Right now this works:

from mGui.gui import *

with Window(None) as test:
    with ColumnLayout(None):
        Button("fred")

test.show()
for item in test: print item
fred = [i for i in test if i.Key == 'fred'][0]

fred.label = 'found'
theodox commented 8 years ago

Too much work. it's easier to simply use vanilla python to hack property assignments like this.