theodox / mGui

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

A better alternative to keys #25

Closed theodox closed 8 years ago

theodox commented 9 years ago

I really like the access to children: man.root.header.button1 is a nice, natural idiom. But I hate all the quotes involved in typing

  Button("my key")

So I'm thinking about using the context manager hack in plugger to make variable style assignments instead

with FormLayout() as root:
    button = Button(label = 'xx')
    field = TextField()

were the context manager close-over does what is currently done by the keys

theodox commented 9 years ago

Note to self. The ideal place to do this is in init. However if you do

 c = Control(None)...

c is not actually defined until after the init completes. So it's more likely that it has to happen in layout context manager closure

theodox commented 9 years ago

The right refactor is to move the call to Layout.AddCurrent -- currently in the end of the initializer -- to the the closure of the nested context manager.

theodox commented 8 years ago

This is working now without being ungodly complex in the remove_keys branch. Comments wanted!

theodox commented 8 years ago

Closed, since this is now implemented in master