Thanks for the examples Justin! @AKEric: I never had heard about MayaQWidgetDockableMixin too :) Always do the docking via a dock_it() method in the __init__, so not using multiple inheritance. But if it works for you, then its totally fine ;)
Cheers, Timm On Sat, Jan 24, 2015 at 2:25 AM, Justin Israel <[email protected]> wrote: > Normally when you are only using the Qt QDockWidget you can just work with > the closeEvent on the QDockWidget, and do whatever you want to manage the > widget it is managing. I had never seen these Maya-provided mixins until > now, but looking at the source for it, I can see they do all the custom > wiring under the hood, and exposed, like you said, that custom hook for you > to implement to receive the close event. > > @Timm, regarding the garbage collection. There are two levels of cleanup > that would happen here. The deleteLater() is part of the Qt cleanup, where > the C++ instance would get deleted, but that could happen independently of > the python garbage collection. It is possible to hang onto a python object > beyond the point where the C++ pointer has been deleted, and conversely to > let a python reference fall out of scope but leak the C++ pointer because > the parent-child relationship still keeps it alive. That can happen when > you parent things to the maya main window, and then at some point you close > your window and let your reference go, thinking it is deleted. But really > the instance is still alive and hidden. > > We had some discussions about this in previous threads. Just for reference > here are some links I gave in the past: > > # Leaking resources in Maya because of the Qt parent/child relationship > https://gist.github.com/justinfx/811902fc2aadce31f631 > > # A helper for seeing if you are leaking objects or watching the growth of > certain types > https://gist.github.com/justinfx/11016801 > > > > > > > On Sat Jan 24 2015 at 11:00:04 AM AK Eric <[email protected]> wrote: > >> Tracked it down: The MayaQWidgetDockableMixin class has a >> dockCloseEventTriggered >> method: I can call to my cleanup code in there, and all is happy now. >> >> Thanks for the help! >> >> -- >> You received this message because you are subscribed to the Google Groups >> "Python Programming for Autodesk Maya" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected]. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/python_inside_maya/8e9d38cf-b542-46bb-8245-5a94ee873070%40googlegroups.com >> <https://groups.google.com/d/msgid/python_inside_maya/8e9d38cf-b542-46bb-8245-5a94ee873070%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > -- > You received this message because you are subscribed to the Google Groups > "Python Programming for Autodesk Maya" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To view this discussion on the web visit > https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA3hTUMbnjPgr3B5-5MavaJoVNOqR-VCD%2BhWQnr-opgKCw%40mail.gmail.com > <https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA3hTUMbnjPgr3B5-5MavaJoVNOqR-VCD%2BhWQnr-opgKCw%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > -- *Timm Wagener* *Technical Artist / 3D Generalist* *www.timmwagener.com <http://www.timmwagener.com>* Email: *[email protected] <[email protected]>* Phone: *0178-2810920* -- You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CA%2Bj65ioPNBV%2B2G4wgtnq74ZHAm3OB%2BAXp9MKK_yiAs3dYMYQ2g%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
