class MyPanel(PythonPanel):
    __alreadyOpen = False

    def showModalDialog(self):
        if MyPanel.__alreadyOpen:
            return # or find command to bring it to the front
        else:
            MyWidget.__alreadyOpen=True
            PythonPanel.showModalDialog(self)

This is usally what I use with Qt. But I tink there is no closeEvent or hideEvent for a Pythonpanel to reset the __alreadyOpen?!

You also may want to check out other singleton patterns: http://nathanhorne.com/?p=465

Am 24.10.2013 02:40, schrieb Frank Rueter:
Hi all,


has anybody had success with enforcing only one instance of a PySide widget when it's registered as a panel?

My app writes data to disk upon certain events and loads that data again through the widget's constructor. So I need to make sure that only one instance is open at any given time, otherwise I'm running the risk of losing/corrupting that data.

Any ideas?

Cheers,
frank
_______________________________________________
Nuke-python mailing list
Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python

_______________________________________________
Nuke-python mailing list
Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python

Reply via email to