You rock As usual, thanks
On Sat, 27 Aug 2011 15:30 -0700, "Ivan Busquets" <[email protected]> wrote: Not in front of Nuke right now, but I believe you should be able to do that within the __init__ method of your Widget subclass I.E. import nuke import PyQt4.QtCore as QtCore import PyQt4.QtGui as QtGui from nukescripts import panels class NukeTestWindow(QtGui.QWidget): def __init__(self, parent=None): global myPanel myPanel = self // or do your own logic here to check if a previous panel already existed, etc QtGui.QWidget.__init__(self, parent) self.setLayout( QtGui.QVBoxLayout() ) self.myLineEdit = QtGui.QLineEdit("Hello World") self.layout().addWidget( self.myLineEdit ) QtCore.QObject.connect(self. myLineEdit, QtCore.SIGNAL("returnPressed()"), self.lineEditCB) def lineEditCB(self): nuke.message("%s" % self.myLineEdit.text()) And then, after an instance of your panel already exists, you should be able to do: myPanel.myLineEdit.text() Keep in mind that, with the above, every new instance of NukeTestWindow would overwrite your global variable, so you might want to check if one exists (if you want to enforce that only one instance of your Panel should exist), or keep track of all the instances in a dictionary, for example. On Sat, Aug 27, 2011 at 12:46 PM, Hugo Léveillé <[1][email protected]> wrote: Sorry for last empty mail I tried various ways to assign the panel to a variable but I can't seem to have access to it. Using the previous exemple with the line edit, how would you do that ? I must be missing something obvious :) On Sat, 27 Aug 2011 10:34 -0700, "Ivan Busquets" <[2][email protected]> wrote: > Ah, I see. > > In that case I think I would do what pixelcowboy suggested (keeping a > global variable of your docked panel to access it later on). > > nuke.getPaneFor() will get you the dock the panel belongs to, but I'm > not sure you can get the panel object itself from there. > > However, if it's something that other nodes will need to query from, I > think it would probably be easier to use actual user knobs attached to > nuke.root(). Mainly because your docked panel won't get saved with the > nuke script. > > This may not be a problem for your application, but just saying in > case it makes things easier. > > Cheers, > Ivan > > On Sat, Aug 27, 2011 at 6:43 AM, Hugo Léveillé <[3][email protected]> > wrote: > > Hi Ivan > > > > No, doing action or getting knob panel value when playing inside the > > panel is no problem. > > > > Imagine that the panel is a custom preference panel. And that the line > > edit drive the default value of blur nodes. I need the querie the value > > of the line edit from outisde the panel. So to make it simple, once the > > panel is created/ docked, how would you access the line edit value in > > the script editor? > > > > Is it more clear? > > > > On Fri, 26 Aug 2011 23:53 -0700, "Ivan Busquets" > > <[4][email protected]> wrote: > >> Hi Hugo, > >> > >> You should look at the QLineEdit Class reference docs to find the > >> method that suits you best, but you could, for example, use the text() > >> method to get the text contents of your widget. > >> > >> [5]http://doc.qt.nokia.com/latest/qlineedit.html#text-prop > >> > >> As for when/how to access that method, you'll probably want to use > >> signals/slots to choose when you want to trigger a certain action. > >> > >> Quick example: > >> > >> import nuke > >> import PyQt4.QtCore as QtCore > >> import PyQt4.QtGui as QtGui > >> from nukescripts import panels > >> > >> class NukeTestWindow(QtGui.QWidget): > >> def __init__(self, parent=None): > >> QtGui.QWidget.__init__(self, parent) > >> self.setLayout( QtGui.QVBoxLayout() ) > >> self.myLineEdit = QtGui.QLineEdit("Hello World") > >> self.layout().addWidget( self.myLineEdit ) > >> QtCore.QObject.connect(self.myLineEdit, > >> QtCore.SIGNAL("returnPressed()"), self.lineEditCB) > >> > >> def lineEditCB(self): > >> nuke.message("%s" % self.myLineEdit.text()) > >> > >> > >> Is that where you were after? > >> > >> Cheers, > >> Ivan > >> > >> > >> On Fri, Aug 26, 2011 at 12:51 PM, Hugo Léveillé <[6][email protected]> > >> wrote: > >> > Hey > >> > > >> > Just started using docked pyqt panel inside nuke. Quick question. > >> > > >> > Let say I make this very simple panel with a single line edit > >> > > >> > ===== > >> > > >> > import nuke > >> > import PyQt4.QtCore as QtCore > >> > import PyQt4.QtGui as QtGui > >> > from nukescripts import panels > >> > > >> > class NukeTestWindow(QtGui.QWidget): > >> > def __init__(self, parent=None): > >> > QtGui.QWidget.__init__(self, parent) > >> > self.setLayout( QtGui.QVBoxLayout() ) > >> > self.myLineEdit = QtGui.QLineEdit("Hello World") > >> > self.layout().addWidget( self.myLineEdit ) > >> > > >> > > >> > > >> > panels.registerWidgetAsPanel('NukeTestWindow', 'Test table panel', > >> > 'uk.co.thefoundry.NukeTestWindow' ) > >> > > >> > > >> > =========== > >> > > >> > Once the panel is created, how can I have access to the value of the > >> > line edit ? The goal would be to make some action inside nuke based on > >> > the current value of a knob inside that panel > >> > > >> > Thanks > >> > > >> > > >> > -- > >> > Hugo Léveillé > >> > TD Compositing, Vision Globale > >> > [7][email protected] > >> > > >> > _______________________________________________ > >> > Nuke-python mailing list > >> > [8][email protected], [9]http://forums.thefoundry.co.uk/ > >> > [10]http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke -python > >> > > >> _______________________________________________ > >> Nuke-python mailing list > >> [11][email protected], [12]http://forums.thefoundry.co.uk/ > >> [13]http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke -python > >> > > > > > > -- > > Hugo Léveillé > > TD Compositing, Vision Globale > > [14][email protected] > > > > _______________________________________________ > > Nuke-python mailing list > > [15][email protected], [16]http://forums.thefoundry.co.uk/ > > [17]http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke -python > > > _______________________________________________ > Nuke-python mailing list > [18][email protected], [19]http://forums.thefoundry.co.uk/ > [20]http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke -python > -- Hugo Léveillé TD Compositing, Vision Globale [21][email protected] _______________________________________________ Nuke-python mailing list [22][email protected], [23]http://forums.thefoundry.co.uk/ [24]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 References 1. mailto:[email protected] 2. mailto:[email protected] 3. mailto:[email protected] 4. mailto:[email protected] 5. http://doc.qt.nokia.com/latest/qlineedit.html#text-prop 6. mailto:[email protected] 7. mailto:[email protected] 8. mailto:[email protected] 9. http://forums.thefoundry.co.uk/ 10. http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python 11. mailto:[email protected] 12. http://forums.thefoundry.co.uk/ 13. http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python 14. mailto:[email protected] 15. mailto:[email protected] 16. http://forums.thefoundry.co.uk/ 17. http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python 18. mailto:[email protected] 19. http://forums.thefoundry.co.uk/ 20. http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python 21. mailto:[email protected] 22. mailto:[email protected] 23. http://forums.thefoundry.co.uk/ 24. 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
