The QUiLoader does create some unfortunate workflow issues, and even more 
unfortunately, PySide doesn’t ship with a built-in equivalent to PyQt’s 
loadUiType (which generates Python classes instead of instances from .ui files).

I would recommend either using pyside-uic and compiling your .ui files into 
Python classes to import and use, or (better yet) making use of a function to 
do this for you dynamically at runtime (example here: 
http://stackoverflow.com/a/14195313)

-Nathan



From: Jean-Paul LeDoux 
Sent: Friday, February 01, 2013 5:04 PM
To: [email protected] 
Subject: [Nuke-python] PySide - Proper way to define new panel class 
withQUiLoader

Hello,

I've been trying to get my head around PySide and how to properly define a new 
Panel class from a .ui file.  I have a feeling part of my problem is a 
misunderstanding about how Classes are constructed in python in general.

Anyways, what I would like to do is define a new panel class from a .ui file.

The basic .ui loading code I'm using is like this(cobbled from this list and 
Stack Overflow...):

class uberPanel(QtGui.QWidget):
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)
        loader = QtUiTools.QUiLoader()
        file = QtCore.QFile("J:/Resrc/rnd/uberpanel.ui")    #Saved out of QT 
Designer
        file.open(QtCore.QFile.ReadOnly)
        self.ui = loader.load(file, self)        #returns a QWidget instance 
not class
        file.close() 



Now, I don't think this is right, because instead of dealing with the uberPanel 
object, I would end up manipulating the internal uberPanel.ui property (the 
actual panel).  


Can anyone point me to a cleaner way of building panel classes with the 
QuiLoader?


Thanks for your time,


JP






--------------------------------------------------------------------------------
_______________________________________________
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

Reply via email to