There isn't any formal kind of global "flush" for Qt. If you are leaking memory then you would need to fix that. Since Maya is a persistent environment for all of the tools you run, tools have to take care to clean themselves up.
With Qt, even more so. Because if you create widgets with parent to the main window, they don't get deleted unless you do it. An example is a dialog window. When you make a dialog and parent it to Maya's main window, and then close the dialog, you are most likely leaking it if you are just creating a new one from scratch each time.
For any widget you have widget.deleteLater() which will delete it once control gets back to the event loop.
If you are not keeping a global ref to your dialog to reshow each time, and your dialog is being parented to Maya, then you can use QtCore.Qt.WA_DeleteOnClose and set it with dialog.setAttribute()
This will tell the dialog to delete when you close it. All widgets in the parent child chain will delete.
http://qt-project.org/doc/qt-4.8/qt.html#WidgetAttribute-enum
This may not be exactly the problem you are having so you might need to explain the unwanted behavior a bit more
--
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 python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/ff0065a9-e32e-4cac-b163-d9103c9a1f0f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA0trNa%3Djj8ujws8M0XJA4usAO_Wccq9PaHCn2%2BGmKCWhw%40mail.gmail.com.
There isn't any formal kind of global "flush" for Qt. If you are leaking memory then you would need to fix that. Since Maya is a persistent environment for all of the tools you run, tools have to take care to clean themselves up.
With Qt, even more so. Because if you create widgets with parent to the main window, they don't get deleted unless you do it. An example is a dialog window. When you make a dialog and parent it to Maya's main window, and then close the dialog, you are most likely leaking it if you are just creating a new one from scratch each time.For any widget you have widget.deleteLater() which will delete it once control gets back to the event loop.
If you are not keeping a global ref to your dialog to reshow each time, and your dialog is being parented to Maya, then you can use QtCore.Qt.WA_DeleteOnClose and set it with dialog.setAttribute()
This will tell the dialog to delete when you close it. All widgets in the parent child chain will delete.
http://qt-project.org/doc/qt-4.8/qt.html#WidgetAttribute-enumThis may not be exactly the problem you are having so you might need to explain the unwanted behavior a bit more
On 16/07/2014 4:22 AM, "md" <acco...@mdonovan.com> wrote:
Is there a way to flushing all prior QT instances from memory when developing PySide/Qt scripts for Maya?--I am constantly exiting Maya and reloading it when my forms don't seem to refresh properly.ThanksM
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 python_inside_maya+unsub...@googlegroups.com.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/9e20ea8d-4852-489f-a050-84c684f48654%40googlegroups.com.
You received this message because you are subscribed to a topic in the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/python_inside_maya/sNqxa2yDt5s/unsubscribe.
To unsubscribe from this group and all its topics, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOD1L7yH2E12zioO2iax0pU_MK9eecTBvVRA%2BCMBWJBezw%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/315E4F7F-F0DD-4130-B336-5DC3C35E7B1C%40mdonovan.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOCtBngEbSTsxdFL9cto74hYq7BCTv9n1d73r7eW3eoGtA%40mail.gmail.com.
I never got the sys.modules deleting approach to work (tried it about a year ago in python 2.6). As far as I understand you’re not supposed to delete imported modules. That’s not how Python is designed to work.
Instead I just always (yes, always) import modules with a reload() as well:
import myModule
reload(myModule)
Then I make sure to always delete the UIs (and dockControls in Maya) properly before loading up the UI. This makes it possible to reload the whole pyqt/pyside app without issues and without having to restart Maya/Nuke. Example of this in Maya/Nuke here.
Regards,
Fredrik
--
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 python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/0f26a930-db5a-4656-87dd-fc0de62df0e3%40googlegroups.com.
--
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 python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPamJi-oj10Ld5ojC%2BQYQD6AVpwF0HE_C-eL%2Bay9h%3DE%3DpDM5BQ%40mail.gmail.com.
Actually in development I have had the same need. If I am working on a tool and it imports a few other modules in the same tool, and I make a change to those modules, I have to kill the changed dependencies and the top level tool to get the changes reflected. If you are testing a tool that consists of one file, and you only make changes to one file, then you wouldn't need to worry about killing multiple imports.
--
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 python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPamJi9AG-PJAF9ntTwKP5AER1M_jvpPDL19jS8pYM_vMWuUzg%40mail.gmail.com.
Sorry I wasn't clear before. I am only talking about development. I wouldn't use any deep reloading tricks in a production situation.
import sys def hard_reload(package_name): for k in sys.modules.keys(): if k.startswith(package_name): del sys.modules[k]
Anyway... it was just a quick suggestion, it's really not a big deal :)
Cheers!
Ah missed that part. All good. Lots of options for dev.
--
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 python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPamJi_zUpPC0c9VAR9%3DzsbNjk%3D%2BZ8FwZqJUVNoKwsjm-xgBVA%40mail.gmail.com.