Ok, that's great Nathan, I've got it working now - thanks for the link to
pysideuic.

I did refer to (er mostly copy) the code here:
http://tech-artists.org/forum/showthread.php?3035-PySide-in-Maya-2013
which expands a bit on the stackoverflow snippet.

Referring to the Parent question - in this Maya example, he has some code
which returns the Main Maya window and he passes that to the widget.
 Should I be doing something similar in Nuke?  Or is this handled in some
way by registerWidgetAsPanel()?  The examples in the nuke document don't
seem to address this.

Thanks again for your help.  This is my working code in case it helps
anyone:

import PySide.QtGui as QtGui
import PySide.QtCore as QtCore
import PySide.QtUiTools as QtUiTools
import pysideuic
import xml.etree.ElementTree as xml
from cStringIO import StringIO

def loadUiType(uiFile):
    parsed = xml.parse(uiFile)
    widget_class = parsed.find('widget').get('class')
    form_class = parsed.find('class').text

    with open(uiFile, 'r') as f:
        o = StringIO()
        frame = {}

        pysideuic.compileUi(f, o, indent=0)
        pyc = compile(o.getvalue(), '<string>', 'exec')
        exec pyc in frame

        #Fetch the base_class and form class based on their type in the xml
from designer
        form_class = frame['Ui_%s'%form_class]
        base_class = eval('QtGui.%s'%widget_class)


form_class, base_class = loadUiType("/uberpanel.ui")   #Path to ui file

class myShinyPanel(form_class, base_class):
    def __init__(self, parent=None):
        super(myShinyPanel, self).__init__(parent)
        self.setupUi(self)


Cheers,
JP
_______________________________________________
Nuke-python mailing list
Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python

Reply via email to