That's odd, the focus/default stays with the OK button in MacOS and Windows, so you're right, it seems to be a Linux-only problem.
Considering this happened from 6.1 to 6.2, where the Python (and PyQt) version also changed, could this be a bug with this PyQt version in Linux? By the way, this only seems to happen when you use the "defaultKnobText" argument, or when you use the PythonPanel's showModalDialog() method unchanged, which sets "defaultKnobText" to "OK" or whatever name the ok button has. If you don't need to change the default knob that gets the focus, you could always override showModalDialog() and exclude that portion. For example, this seems to work (no explicit focus, but should be fine if OK is the first button in the panel) ##################################### import nukescripts class testPanel( nukescripts.PythonPanel ): def __init__( self ): super(testPanel, self).__init__( 'testing' ) self.addKnob( nuke.Tab_Knob( 'blaaaaaaaa' ) ) self.addKnob( nuke.String_Knob( 'test', 'testing')) self.addKnob(nuke.EndTabGroup_Knob()) def showModalDialog( self, defaultKnobText = "" ): self.__modalResult = None if self.okButton == None: self.okButton = nuke.Script_Knob( "OK" ) self.addKnob( self.okButton ) self.okButton.setFlag( nuke.STARTLINE ) self.cancelButton = nuke.Script_Knob( "Cancel" ) self.addKnob( self.cancelButton ) # This is where the Focus is set to the OK button, but it breaks in Linux # if defaultKnobText == "": # defaultKnobText = self.okButton.name() super(testPanel, self).showModal(defaultKnobText) return self.__modalResult def finishModalDialog( self, result ): self.__modalResult = result self.hide() test = testPanel().showModalDialog() print test ##################################### But if you uncomment the "defaultTextKnob" lines, then you hit the same bug. Hopefully that will help for now, but it would be good to know if this is indeed a bug with this particular version of PyQt in Linux. Cheers, Ivan On Tue, May 24, 2011 at 12:05 PM, Hugo Léveillé <[email protected]> wrote: > Yeah, VERY annoying > > Like when you select "Framecycler this", edit the range and hit enter, > it just cancel itself... > > Seems to be a linux only bug as far as I remember > > On Tue, 24 May 2011 18:40 +0000, "Bernhard Kimbacher" > <[email protected]> wrote: > > Hi, > > > > when you make a pythonPanel, usually when you simply hit 'enter' on the > > panel, it will default to the 'OK' button. > > > > however in nuke6.2 it seems to behaves slightly different. if you simply > > create a pythonPanel and hit enter, it will default to ok (so here 6.1 > > and 6.2 are the same). if you have a input field (like a String_Knob), it > > will default to 'cancel' after you have entered something in the field > > and hit enter. > > > > did anybody else run into this issue? below is the sample code i'm using. > > when you run this and only hit 'enter' it should return true. if you > > enter something in the string knob and then hit enter it returns false > > (whereas in nuke6.1 it would return true) > > > > any way of forcing it to 'OK' as default? > > > > thanks! > > -Bernie > > > > > > ---------- > > > > import nukescripts > > > > class testPanel( nukescripts.PythonPanel ): > > > > def __init__( self ): > > nukescripts.PythonPanel.__init__( self, 'testing' ) > > self.addKnob( nuke.Tab_Knob( 'blaaaaaaaa' ) ) > > self.addKnob( nuke.String_Knob( 'test', 'testing')) > > > > def showModalDialog( self ): > > result = nukescripts.PythonPanel.showModalDialog( self ) > > print 'test: %s' % (result) > > > > test = testPanel().showModalDialog() > > > > _______________________________________________ > > Nuke-python mailing list > > [email protected], http://forums.thefoundry.co.uk/ > > http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python > > > > > -- > Hugo Léveillé > TD Compositing, Vision Globale > [email protected] > > _______________________________________________ > 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
