great, thanks Nathan! Kim
2011/8/7 Nathan Rusch <[email protected]> > The proxy I originally tested was defined outside the panel, but a class > method works fine too. Here’s some test code: > > import thread > > def killNuke(): > nuke.executeInMainThread(nuke.scriptExit, ()) > > class TestPanel(nukescripts.PythonPanel): > def __init__(self, name): > super(TestPanel, self).__init__(name) > self.closeNukeExternal = nuke.PyScript_Knob('close_ext', 'close via > external func') > self.addKnob(self.closeNukeExternal) > self.closeNukeInternal = nuke.PyScript_Knob('close_int', 'close via > class method') > self.closeNukeInternal.setFlag(nuke.STARTLINE) > self.addKnob(self.closeNukeInternal) > def knobChanged(self, knob): > if knob == self.closeNukeExternal: > self.hide() > thread.start_new_thread(killNuke, ()) > if knob == self.closeNukeInternal: > self.hide() > thread.start_new_thread(self.killNuke, ()) > def killNuke(self): > nuke.executeInMainThread(nuke.scriptExit, ()) > > TestPanel('Killing Nuke').showModalDialog() > > > -Nathan > > > *From:* Kim Ranzani <[email protected]> > *Sent:* Sunday, August 07, 2011 7:00 AM > *To:* Nuke Python discussion <[email protected]> > *Subject:* Re: [Nuke-python] running nuke.scriptExit() from a panel > > Hi there, > > I was having the same problem restarting nuke via a python panel button and > one workaround was to assign directly the function to the button itself > like: > > self.restartButton.setValue('nuke.scriptClose()') > > this was working ok in 6.2 but in 6.3 something change and even if it > works, I got a nuke6.3v2 quit unexpectedly message which is quite annoying. > > I tried what Nathan said but without any luck, Is it possible to spawn the > proxy function from knobChanged? the proxy function has to be outside the > panel class or can be inside?probably im missing something... thanks in > advance, > > Kim > > 2011/8/2 John RA Benson <[email protected]> > I'll give it a shot - > thanks for the fast reply! > > JRAB > > > On Aug 2, 2011, at 6:54 PM, Nathan Rusch wrote: > > > One thing that works is to have a proxy function that calls > nuke.executeInMainThread(nuke.scriptExit), and then spawn that proxy in a > new thread from within your callback function (thread.start_new_thread is > probably the simplest way to do this). > > > > Keep in mind that scriptExit will prompt to save the current script if > it's modified, so you may want to make sure you either save from your script > callback or call nuke.modified(False) before your scriptExit callback fires. > > > > -Nathan > > > > > > -----Original Message----- From: John RA Benson > > Sent: Tuesday, August 02, 2011 9:37 AM > > To: Nuke Python discussion > > Subject: [Nuke-python] running nuke.scriptExit() from a panel > > > > Hey there - > > > > I'm trying to exit a script, but the nuke.scriptExit() is being called > > from within a callback in a panel. The problem is that nuke won't quit, > > because it's executing something else - I think the knobChanged callback > > that has the nuke.scriptExit() code in it. Is there any workaround to > > force close and exit, pythonically? > > > > thanks > > JRAB > > _______________________________________________ > > 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 > > _______________________________________________ > 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 > > _______________________________________________ > 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
