I think this is a consequence of the way registerWidgetAsPanel works. Despite
what the name implies, the widget itself is actually embedded in a Nuke knob
inside one or more other widgets, rather than being used as-is. Thus, the
closeEvent is sent to the parent, rather than your widget.
-Nathan
From: Fredrik Averpil
Sent: Tuesday, September 30, 2014 6:32 AM
To: Nuke Python discussion
Subject: [Nuke-python] How to closeEvent() override in Nuke?
Hi everyone,
I load a floating tab into Nuke, and I wish to a) delete this object on window
close and b) delete the UI if another instance of the UI is shown - but can't
quite figure out exactly how to achieve this.
This is how I launch the UI:
panel = panels.registerWidgetAsPanel(name, title, identifier,
create=True).addToPane(pane)
panel.show()
gui = panel.customKnob.getObject().widget
In my class, I have registered a closeEvent() method:
def closeEvent(self, event):
print 'closing ui...'
self.deleteLater()
And this is how I find which pane my UI resides in:
pane = nuke.getPaneFor(identifier)
if pane:
print 'the pane exists'
a) For some reason, the object is not deleted when I close the Nuke tab or the
Nuke pane and I do not see the ‘closing ui…’ printed out in the script editor.
What am I doing wrong here? Do I need to connect a trigger to the closeEvent()
method?
b) How can I not only detect the pane (or the Dock object, which Nuke also
calls it) but also detect whether the actual UI inside the tab exists?
Regards,
Fredrik
--------------------------------------------------------------------------------
_______________________________________________
Nuke-python mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
_______________________________________________
Nuke-python mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python