If you make sure your widgets are using setObjectName(), you could possibly look up the widgets by name like so to make sure only on instance is running:

for widget in QtGui.QApplication.allWidgets()
    name = widget.objectName()
    if 'myWidgetName' in name:
        print name, type(widget)


I think the registered panel will be of class <class 'PyQt4.QtGui.QDialog'>

and the widget the PyCustom_Knob is pointing to <class 'PyQt4.QtGui.QWidget'>


As far as I can see, the panel and widget object will be destroyed when the panel is closed.


Johan

On 24/10/13 13:40, Frank Rueter wrote:
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