theodox / mGui

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

Adding support for stashing event handlers #44

Closed bob-white closed 7 years ago

bob-white commented 7 years ago

Quick blockout of some of the ideas in issue #40 Nothing set in stone, but gives a working reference to discuss.

bob-white commented 7 years ago

Good catch, didn't even think of non-Control related events. Probably because I've been using my older event library for all non-mGui events.

So I can think of a few options: 1) move the stashing functionality to a subclass of MayaEvent, say MayaControlEvent, and have the CallbackProperty use those instead. Downside being that other events lose out on the stashing functionality. 2) Find some other place to store the handler. Downside here is we have a very real risk of leaks. 3) Raise an exception is no sender object exists when attempting to use the stash interface.