def main(): winName = 'EXPORTER' if pm.windows.window(winName, exists=True): print 'Already exists, passing' pass else: window = ColladaExporterUI() window.setObjectName(winName) window.show()
def closeEvent(self, event): print 'CLOSED' del self.mainDialog del self event.accept()
--
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/dcd4ecdf-ac70-411c-8ef9-d32337b96e89%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
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/ilAU64vmbfw/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/CAD%3DwhWPbnGYCx4GjfZ9j1E-tdsTCsMHhCXXac2RNgDUGosshPg%40mail.gmail.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/CAM2ybkX%3DyGhW5S6xOX59LNAd3Y6rJs99_nVz8tSXmqiEzeTFPQ%40mail.gmail.com.
Don't use the del keyword to clean up your windows. That just deletes python objects and can't guarantee it will delete qt objects. Use QObject.deleteLater()
If you make sure "self.mainDialog" is parented to "self" then you only need to call "self.deleteLater()". Qt will make sure any children of a deleted object are also deleted.
You can also achieve this result without needing a custom closeEvent, if you set a widget attribute:
self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
This could either be done in your constructor, or outside the class by a caller than wants the object it is creating to be deleted when it is closed.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAFRtmODRJbZ03EqYreEFFhfnAuOdwo%3DOqGAdc2Qb-taZCHBO0g%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA12%3D%2Bq-vh11vxzGc-szZuqAQ0n5_qazUKeDNvwLiD4LCg%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAD%3DwhWNunaQG6a-q8Zedjz%3DfskmpgKe51TptMDb4gOYDKW4HSA%40mail.gmail.com.
Alternative to what Justin and Fredrik said, also consider whether you *need* to delete your window. Odds are you can simply hide/show it, which would save you some hassle and potentially improve startup time on multiple runs.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOBdXv6mj3_UQU-d_K3_2-TOtueAhvxCxawCDoZYS0zfQA%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA0Per1cMfTeyt_1MPFXTPH%2BhPr8czPTXoLgE2QGsP6UuQ%40mail.gmail.com.
Its not a problem to have custom events. It was just a suggestion for how to properly delete objects in Qt. The WA_deleteonclose basically does the same thing, where it calls deleteLater() in a close event
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAM2ybkUQ5iN7dUBiW6AP%3DEUeO4vDw%3DozNxt6VhAbYdkG63%2B2jQ%40mail.gmail.com.