When I still used the Designer, I would always pre-generate my ui files to py, using uic. And I would use one of the inheritance approaches, with setupUi().
Now I don't use the Designer any more, so its not really an issue for me. Also, I use only the new-style signal slots convention. On Thu, Jun 27, 2013 at 1:14 PM, drchickins <[email protected]>wrote: > On Wednesday, 26 June 2013 17:55:08 UTC-7, drchickins wrote: > > hi all, > > > > so i'm trying to get a signal from a .ui desiger file to connect with a > call which worked well in pyQt but pyside has the QUiLoader and i'm having > trouble getting it to recognise a button. keeps on saying the object doesnt > exist. > > > > > > has anyone used the QUiLoader and connected a button to a definition? > > > > the ui appears but nothing works > > > > > > here is what i have. i created a .ui dialog file with a single button > and named "create_button" > > > > ############### > > > > import sys, os > > from PySide import QtGui, QtCore, QtUiTools > > from shiboken import wrapInstance > > from maya import OpenMayaUI, cmds, OpenMaya > > > > > > file = "D:\oneButtonTestDialog.ui" > > > > > > def getMayaWindow(): > > ptr = OpenMayaUI.MQtUtil.mainWindow() > > if ptr is not None: > > return wrapInstance(long(ptr), QtGui.QMainWindow) > > > > class designerUI(QtGui.QDialog): > > def __init__(self, parent=getMayaWindow()): > > > > super(designerUI, self).__init__(parent) > > loader = QtUiTools.QUiLoader(self) > > widget = loader.load(file, self) > > QtCore.QMetaObject.connectSlotsByName(widget) > > > > widget.show() > > > > > > self.connect(self.create_button, QtCore.SIGNAL('clicked()'), > self.create_button_cb) > > > > #old style signal > > > > > > def create_button_cb(self, *args): > > print "linked" > > > > > > > > designerUI() > > > > ############# > > > > > > > > john > > well the moment after i posted i relised my mistake... > always simpler then you think. it was just the wong object i was calling. > > self.connect(widget.create_button, QtCore.SIGNAL('clicked()'), > self.create_button_cb) > > just changed this and it works... > > out of interest how whats most people using for this sort of workflow? i > have head that using .ui file in pyside is abit unstable? at some point > i''l convert it but while adding features i always find this is the best > way to develop. > > john > > -- > You received this message because you are subscribed to the Google Groups > "Python Programming for Autodesk Maya" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to [email protected]. > To post to this group, send email to [email protected]. > For more options, visit https://groups.google.com/groups/opt_out. > > > -- You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
