Hi, follow up question.

So the example on stack overflow imports pysideuic but this module is not
included with Nuke (I'm currently testing with Nuke 7.0.4PLE).  I'm
assuming it is part of the full pyside install.  If that's the case, it
means I'll have to get the full pyside installed on each workstation I'm
guessing?

How heavily are most nuke pipelines making use of pyside panels?

The other approach I was going to try was defining functions to create the
instances, then add properties, though this might have other perils...

import PySide.QtGui as QtGui
import PySide.QtCore as QtCore
import PySide.QtUiTools as QtUiTools

from nukescripts import panels

def uiToWidget(uiPath):
    loader = QtUiTools.QUiLoader()
    file = QtCore.QFile(os.path.normpath(uiPath))
    file.open(QtCore.QFile.ReadOnly)
    widget = loader.load(file)
    file.close()
    return widget

def newUberPanel():
    uiPath = "/uberpanel.ui"
    p = uiToWidget(uiPath)  #Got my widget

    # And now do stuff with it.

    def connectSignals():
        print "Connect Signals"
    p.fromCurrent_btn.pressed.connect(connectSignals)

    p.thumbnail_lbl.setPixmap(QtGui.QPixmap("/thumbnail_dummy.png"))
    p.folder_btn.setIcon(QtGui.QIcon("/uber_folder.png"))

    return p

Does anyone forsee any problems with this kind of workflow?

Thanks,

JP


On Fri, Feb 1, 2013 at 5:54 PM, Jean-Paul LeDoux <jean.paul.led...@gmail.com
> wrote:

> Heh, I'd been to that thread, but didn't go to the bottom - thanks a lot,
> Nathan.  I'd like to keep the flexibility of building off the ui files, so
> I'll try to work that code into my pipeline.
>
> Cheers,
>
> JP
>
>
> On Fri, Feb 1, 2013 at 5:40 PM, Nathan Rusch <nathan_ru...@hotmail.com>wrote:
>
>>   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 <jean.paul.led...@gmail.com>
>> *Sent:* Friday, February 01, 2013 5:04 PM
>> *To:* Nuke-python@support.thefoundry.co.uk
>> *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
>> Nuke-python@support.thefoundry.co.uk, http://forums.thefoundry.co.uk/
>> http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python
>>
>>
>> _______________________________________________
>> 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
>>
>>
>
_______________________________________________
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