Re: [Maya-Python] Executing code on close of a docked PySide QDialog

2015-01-24 Thread AK Eric
I've been making maya ui's forevers (via mel at first and now python), but never really messed with docking. This is really my first attempt at doing *PySide*, and *docking* PySide, so I have on doubt that maybe some part of my setup is wrong ;) -- You received this message because you are

Re: [Maya-Python] Executing code on close of a docked PySide QDialog

2015-01-24 Thread Timm Wagener
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

Re: [Maya-Python] Executing code on close of a docked PySide QDialog

2015-01-23 Thread Justin Israel
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 wirin

Re: [Maya-Python] Executing code on close of a docked PySide QDialog

2015-01-23 Thread AK Eric
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" g

Re: [Maya-Python] Executing code on close of a docked PySide QDialog

2015-01-23 Thread AK Eric
Timm: This is how my inheritance looks: class App(MayaQWidgetDockableMixin, QDialog): So I am overriding the closeEvent in that class with my cleanup code, but like mentioned, it's not being called when *docked*. Also: "closeEvent hides the widgets instead of deleting them by default" : That'

Re: [Maya-Python] Executing code on close of a docked PySide QDialog

2015-01-23 Thread Timm Wagener
I think the issue is that a closeEvent hides the widgets instead of deleting them by default. But it seems that this behaviour can be changed. > > To make a widget delete itself when it’s closed, use the > Qt::WA_DeleteOnClose widget attribute. http://qt-project.org/forums/viewthread/7661 This mi

Re: [Maya-Python] Executing code on close of a docked PySide QDialog

2015-01-23 Thread Marcus Ottosson
When things are properly parented, is there really a need for clean-up? Wouldn't dialogs and timers get picked up and thrown out during garbage collection? -- *Marcus Ottosson* konstrukt...@gmail.com -- You received this message because you are subscribed to the Google Groups "Python Programmi

Re: [Maya-Python] Executing code on close of a docked PySide QDialog

2015-01-23 Thread Timm Wagener
Hi Eric, i have done the same thing a few times now (Parenting widgets under inherited dockwidgets if the user wants them dockable and needing to clean up stuff (QTimer etc.) ). Maybe the reason that your closeEvent is not called when docked is, that you are actually closing the DockWidget and no

Re: [Maya-Python] Executing code on close of a docked PySide QDialog

2015-01-23 Thread Marcus Ottosson
It's possible that "closing" a docked window isn't the same as physically closing it via the X button on the Window; the latter potentially signalling via the Window Manager of the OS whereas the former is internal to Qt (i.e. deleting a widget). This might be related. http://qt-project.org/forums

[Maya-Python] Executing code on close of a docked PySide QDialog

2015-01-23 Thread AK Eric
I've authored a window in PySide (via QDialog), and recently made it dockable by inheriting from maya.app.general.mayaMixin.MayaQWidgetDockableMixin (in 2015). Surprisingly easy. In the QDialog's closeEvent method, I do a bit of cleaning up of API callbacks. What I've found is: If the windo