This is a simple, straight-forward style post. [EDIT: lol, I wish – click here to see what I ACTUALLY ended up doing]. I am working with updating my tks “Suite” of tools for Shotgun-Nuke integration, and I wanted to be sure I was doing everything as safely as possible. As such, I wanted to make sure that when a user “hides” the panel in Nuke, my panel cleans up after itself. (I noticed that, by default, when the panel is “closed” with the X box, the panel itself and the thread keep going and going and going in the background).
With some dir() inspection and some super() magic, I was able to determine the following functions to override if you want to add special nuke panel close and open logic:
class NotesPanel( QWidget ):
def __init__( self , scrollable=True):
QWidget.__init__(self)
def hideEvent(self, *args, **kwargs):
#this function fires when the user closes the panel
super(NotesPanel, self).hideEvent(*args, **kwargs)
def showEvent(self, *args, **kwargs):
#this function fires when the user opens the panel
super(NotesPanel, self).showEvent(*args, **kwargs)
Short and sweet! Hopefully this will help others who are looking for similar logic.
UPDATED: Well, nothing is ever that simple, is it?
Continue Reading →