Thanks, Sebastian. I had more problems with my approach so I decided to take yours. After wrapping pyuic it works quite nice.

thanks
Adam

I never use the ui loaders (neither in PyQt or PySide). Main reason is
that there is no code completion in eclipse and that I always have to
access the ui object (myWidget). Doing this you should be able to just
do mywidget.myCheckbox.value() or whatever you want to do. I would
consider using pyuic to create a real python module of your ui file and
use multiple inheritance.

Take a look at http://www.qtrac.eu/pyqtbook26.zip it includes a gui for
doing this (but for my PyQt)


Am 16.11.2011 20:44, schrieb Adam Wierzchowski:
Hi,
I'm experimenting with PySide and QUiLoader. I have problems
connecting signals to slots. Take a look at one of examples I've
modified:

import nuke
import PySide.QtCore as QtCore
import PySide.QtGui as QtGui
from nukescripts import panels
import PySide.QtUiTools as QtUiTools

class NukeTestWindow(QtGui.QWidget):
    def __init__(self, parent=None):
        QtGui.QWidget.__init__(self, parent)
        loader = QtUiTools.QUiLoader()
        file = QtCore.QFile("c:/temp/test.ui")
        file.open(QtCore.QFile.ReadOnly)
        myWidget = loader.load(file, self)
        print myWidget
        file.close()
        layout = QtGui.QVBoxLayout()
        layout.addWidget(myWidget)
        self.setLayout(layout)
self.connect(myWidget.layout().itemAt(0).itemAt(0).itemAt(1).widget(),
QtCore.SIGNAL("clicked()"), self, QtCore.SLOT("BClicked()"))

    def BClicked(arg):
        print arg


panels.registerWidgetAsPanel('NukeTestWindow', 'Test table panel',
'uk.co.thefoundry.NukeTestWindow')

This code works flawlessly (BClicked is invoked) but self.connect
looks nasty. Is there a way to get widget that I need without all
these itemAt?

regards
Adam

_______________________________________________
Nuke-dev mailing list
[email protected], http://forums.thefoundry.co.uk/
http://support.thefoundry.co.uk/cgi-bin/mailman/listinfo/nuke-dev

Reply via email to