theodox / mGui

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

Need a nice way of parameterizing events #8

Closed theodox closed 10 years ago

theodox commented 10 years ago

Right now Events are created on controls when they are first attached. If you want to parameterize them you need to get them from the Callbacks dictionary:

with gui.Window('main') as example:
    with gui.VerticalForm('form'):
        for item in cmds.ls(type='transform'):
            b = gui.Button('b_' + item, label = item)
            b.command += move_down
            b.Callbacks['command'].Data['target'] = item

It would be great to be able to explicitly create a paramterized event:

with gui.Window('main') as example:
    with gui.VerticalForm('form'):
        for item in cmds.ls(type='transform'):
            b = gui.Button('b_' + item, label = item)
            b.command = MayaEvent(target = item)

but this won't work with the current setup. How to fix...?

theodox commented 10 years ago

Resolved, i think