Hi Phil, It always returned me : "RuntimeError: Unable to open ui file"
My guess would be that QUiLoader() is either not finding the file, or does not know how to interpret it (wrong file format could be a reason). Have you tried giving it the full path to your .ui file? You say you've copied it within a directory included in QtUiTools.QUiLoader().pluginPaths(), but that won't make the loader look in that directory for .ui files. It's just the path it will use to look for custom (compiled) widgets and layouts. The other potential problem I see from your example is the fact that, even if you get to load your .ui file, you're never adding "myWidget" to your mainWindow object. If your .ui already contains everything (ie, it's a dialog, or a window by itself), then you could just do: myWidget.show() Otherwise, if your .ui file only contains a Widget that you wish to include in your QMainWindow, you would probably want to add a Layout to QMainWindow, and then add myWidget to that Layout. Hope that helps a little. Cheers, Ivan On Sat, Sep 22, 2012 at 5:38 AM, <philhubfor...@free.fr> wrote: > Thanks Bryan for the reply. > But i was trying to do it on the fly, to avoid convert process for each iteration. > > > ----- Mail original ----- > De: "dunkley bryan" <dunkley.br...@gmail.com> > À: nuke-python@support.thefoundry.co.uk > Envoyé: Samedi 22 Septembre 2012 12:56:14 > Objet: Re: [Nuke-python] load ui file with PySide > > I use pyside-uic to convert my *.ui to a *.py file. > > Works like a charm. > > Use it as follows: > python pyside-uic test.ui > test.py > > Hope that points you in the right direction. > > Bryan 'Fox' Dunkley > www.slyfoxfx.com > Sent from my BlackBerry® wireless device > > -----Original Message----- > From: nuke-python-requ...@support.thefoundry.co.uk > Sender: nuke-python-boun...@support.thefoundry.co.uk > Date: Sat, 22 Sep 2012 12:00:03 > To: <nuke-python@support.thefoundry.co.uk> > Reply-To: nuke-python@support.thefoundry.co.uk > Subject: Nuke-python Digest, Vol 56, Issue 15 > > Send Nuke-python mailing list submissions to > nuke-python@support.thefoundry.co.uk > > To subscribe or unsubscribe via the World Wide Web, visit > http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-python > or, via email, send a message with subject or body 'help' to > nuke-python-requ...@support.thefoundry.co.uk > > You can reach the person managing the list at > nuke-python-ow...@support.thefoundry.co.uk > > When replying, please edit your Subject line so it is more specific > than "Re: Contents of Nuke-python digest..." > > > Today's Topics: > > 1. python and tcl (Luca Fiorentini) > 2. Re: python and tcl (Nathan Rusch) > 3. top node passing through a group (Jacob Harris) > 4. Re: top node passing through a group (Nathan Rusch) > 5. load ui file with PySide (philhubfor...@free.fr) > > > ---------------------------------------------------------------------- > > Message: 1 > Date: Fri, 21 Sep 2012 14:21:59 +0200 > From: Luca Fiorentini <luca.fiorent...@gmail.com> > Subject: [Nuke-python] python and tcl > To: Nuke Python discussion <nuke-python@support.thefoundry.co.uk> > Message-ID: > <CAHEQKvbt-f9_0Oq-mFDfe5PCU2Jj= ibcmketbxmddsftxtm...@mail.gmail.com> > Content-Type: text/plain; charset="iso-8859-1" > > Hi! > > Is tcl faster than python inside nuke when you have to set knobs on a lot > of different nodes? > I had this impression and I was trying to convert all the simple > expressions inside my gizmos but I would like to be sure. > Also, is it possible to translate something like this > > def saText(): > try: > file = nuke.thisGroup().input(0).knob('file').value() > text = os.path.split(file)[1] > text = text.split('_')[0] > text = text.split('.')[0] > return text > > except: > return 'Bad naming convention/location' > > to tcl or I have to use python? > > Thanks in advance! > -- > *Luca Fiorentini - 3D Lighting Artist* > My Showreel <http://www.vimeo.com/lucafiorentini/reel> - My > blog<http://lucafiorentini.wordpress.com>- My > Flickr <http://www.flickr.com/photos/lucafiorentini> > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: http://support.thefoundry.co.uk/cgi-bin/mailman/private/nuke-python/attachments/20120921/b636eb45/attachment.html > > ------------------------------ > > Message: 2 > Date: Fri, 21 Sep 2012 10:04:11 -0700 > From: Nathan Rusch <nathan_ru...@hotmail.com> > Subject: Re: [Nuke-python] python and tcl > To: "Nuke Python discussion" <nuke-python@support.thefoundry.co.uk> > Message-ID: <bay153-ds6d9dab7b7d991d740ec6ef3...@phx.gbl> > Content-Type: text/plain; charset="utf-8" > > With the full qualification that there isn’t really a good way to benchmark the two against each other within Nuke, I think it’s pretty safe to assume that TCL will be faster in the majority of cases. Since Python expressions are called through TCL, at the very least, they will suffer a consistent (if likely miniscule) overhead no matter what. Additionally, the double-edged sword of Python is that, while it’s typically easier for beginners to pick up, it also makes it much easier to write inefficient code than TCL does, so unless you’re a strong/smart Python programmer, you will likely introduce more avoidable overhead manually. > > The general rule I tend to try and adhere to (and would recommend) is, if something can be done in TCL without exceeding a certain (admittedly subjective) threshold of complexity, I’ll use that over Python. > > The function you’ve listed can basically be written like so as a TCL expression: > > [lindex [split [lindex [split [file tail [value parent.input0.file]] _] 0] .] 0] > > > -Nathan > > > > From: Luca Fiorentini > Sent: Friday, September 21, 2012 5:21 AM > To: Nuke Python discussion > Subject: [Nuke-python] python and tcl > > Hi! > > Is tcl faster than python inside nuke when you have to set knobs on a lot of different nodes? > I had this impression and I was trying to convert all the simple expressions inside my gizmos but I would like to be sure. > Also, is it possible to translate something like this > > def saText(): > try: > file = nuke.thisGroup().input(0).knob('file').value() > text = os.path.split(file)[1] > text = text.split('_')[0] > text = text.split('.')[0] > return text > > except: > return 'Bad naming convention/location' > > to tcl or I have to use python? > > Thanks in advance! > -- > Luca Fiorentini - 3D Lighting Artist > My Showreel - My blog - My Flickr > > > > > -------------------------------------------------------------------------------- > _______________________________________________ > 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 > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: http://support.thefoundry.co.uk/cgi-bin/mailman/private/nuke-python/attachments/20120921/150043ca/attachment-0001.htm > > ------------------------------ > > Message: 3 > Date: Fri, 21 Sep 2012 18:27:13 -0700 > From: Jacob Harris <ja...@jacobharris.org> > Subject: [Nuke-python] top node passing through a group > To: Nuke Python discussion <nuke-python@support.thefoundry.co.uk> > Message-ID: > <CACwc0rZ9-HRBFoQC_Fq3DS_ssszrR8QdKuNbb-aJOxZt=+ t...@mail.gmail.com> > Content-Type: text/plain; charset="iso-8859-1" > > I need to burrow--starting inside a group--up to the top of a tree. > > Ex: > > Read1 > Blur1 > Group1 > Transform1 > > If I were starting with Transform1, how do I get to Read1? > > Thanks! > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: http://support.thefoundry.co.uk/cgi-bin/mailman/private/nuke-python/attachments/20120921/a695c08d/attachment-0001.htm > > ------------------------------ > > Message: 4 > Date: Fri, 21 Sep 2012 18:46:59 -0700 > From: Nathan Rusch <nathan_ru...@hotmail.com> > Subject: Re: [Nuke-python] top node passing through a group > To: "Nuke Python discussion" <nuke-python@support.thefoundry.co.uk> > Message-ID: <bay153-ds2fc3d5d5d882e1801db4df3...@phx.gbl> > Content-Type: text/plain; charset="utf-8" > > Primitively: [topnode parent.input0] > > You’d probably want to check for a disconnected input and return a sensible default to avoid errors though. > > -Nathan > > > > From: Jacob Harris > Sent: Friday, September 21, 2012 6:27 PM > To: Nuke Python discussion > Subject: [Nuke-python] top node passing through a group > > I need to burrow--starting inside a group--up to the top of a tree. > > Ex: > > Read1 > Blur1 > Group1 > Transform1 > > If I were starting with Transform1, how do I get to Read1? > > Thanks! > > > > -------------------------------------------------------------------------------- > _______________________________________________ > 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 > -------------- next part -------------- > An HTML attachment was scrubbed... > URL: http://support.thefoundry.co.uk/cgi-bin/mailman/private/nuke-python/attachments/20120921/be283d52/attachment-0001.htm > > ------------------------------ > > Message: 5 > Date: Sat, 22 Sep 2012 11:24:40 +0200 (CEST) > From: philhubfor...@free.fr > Subject: [Nuke-python] load ui file with PySide > To: PYTHON_nuke <nuke-python@support.thefoundry.co.uk> > Message-ID: > < 1947520489.219254682.1348305880399.javamail.r...@zimbra61-e11.priv.proxad.net > > > Content-Type: text/plain; charset=utf-8 > > Hello Pythoners, > I began to play with PySide by creating widgets, buttons, etc, but also want to give QtDesigner a try, to look how it behaves in nuke. > Unfortunately, i didn't succeed in. > It always returned me : "RuntimeError: Unable to open ui file" > I tried different things and i ended up to make the more minimalistic code to avoid side effects. > > to display only a window it would be : > >    from PySide import QtGui >    w = QtGui.QMainWindow() >    w.show() > > same concept with .ui loading would be : > >    from PySide import QtGui >    from PySide import QtCore >    from PySide import QtUiTools >    >    w = QtGui.QMainWindow() >    loader = QtUiTools.QUiLoader() >    file = QtCore.QFile("pyQtRender.ui") >    file.open(QtCore.QFile.ReadOnly) >    myWidget = loader.load(file) >    file.close >    w.show() > > To avoid maximum error i use the provided foundry's sample "pyQtRender.ui" copied in the directory given by "QtUiTools.QUiLoader().pluginPaths()" > > It's surely a noob problem, but i would appreciate if someone could show me the minimal code to make the QtDesigner's ui file works. > I hope someone can shed some light for me, > Cheers > philhub > > > ------------------------------ > > _______________________________________________ > 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 > > End of Nuke-python Digest, Vol 56, Issue 15 > ******************************************* > > _______________________________________________ > 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