On 06/07/2010 08:21 PM, AlienBaby wrote: > On Jun 7, 5:21 pm, AlienBaby <matt.j.war...@gmail.com> wrote: > >> My real aim here is to learn pyqt, so I would rather not the the >> QWizard process until I understand myself whats going on behind the >> scenes. >> > Perhaps I posted to early, but a little more perserverance and I have > managed to unthaw the brain and move forward. I've ended up with the > following. It does what I need, and now it's working I can think > around how to implement with a better approach; > I haven't done much Qt programming, and all of it in C++, but anyway:
my approach is to subclass QFrame (or, here, QDialog makes sense), and, in the constructor, set up the UI and call connect(...). In C++, there's a connect macro -- is there a connect function in QtCore, maybe? "welcome.ui.welcomeNext.connect(welcome.ui.welcomeNext, ..." doesn't look right. > > from PyQt4 import QtCore, QtGui > from WELCOME import Ui_Dialog as welcomeDialog > from SOURCE_TYPE_SELECT import Ui_Dialog as sourceTypeSelectDialog > from SOURCE_TYPE_CONFIRMATION import Ui_Dialog as > sourceTypeConfirmationDialog > > ..>snip< > > class WelcomeDialog(QtGui.QDialog): > def __init__(self,parent=None): > QtGui.QWidget.__init__(self,parent) > self.ui=welcomeDialog() > self.ui.setupUi(self) > > class SourceTypeSelect(QtGui.QDialog): > def __init__(self,parent=None): > QtGui.QWidget.__init__(self,parent) > self.ui=sourceTypeSelectDialog() > self.ui.setupUi(self) > > class SourceTypeConfirmation(QtGui.QDialog): > def __init__(self,parent=None): > QtGui.QWidget.__init__(self,parent) > self.ui=sourceTypeConfirmationDialog() > self.ui.setupUi(self) > > > def WelcomeNext(): > welcome.hide() > sourceTypeSelect.show() > def WelcomeCancel(): > sys.exit() > > > def SourceTypeSelectNext(): > sourceTypeSelect.hide() > for widget in > sourceTypeSelect.ui.availableChoices.findChildren(QtGui.QWidget): > if widget.isChecked(): > print widget.text() > > sourceTypeConfirmation.ui.selectedSourceType.setText(widget.text()) > sourceTypeConfirmation.show() > def SourceTypeSelectCancel(): > sys.exit() > > > def SourceTypeConfirmationBack(): > sourceTypeConfirmation.hide() > sourceTypeSelect.show() > > > if __name__ == "__main__": > app = QtGui.QApplication(sys.argv) > > #Instance dialogs and connect buttons > welcome=WelcomeDialog() > > welcome.ui.welcomeNext.connect(welcome.ui.welcomeNext,QtCore.SIGNAL("clicked()"),WelcomeNext) > > welcome.ui.welcomeCancel.connect(welcome.ui.welcomeCancel,QtCore.SIGNAL("clicked()"),WelcomeCancel) > > > sourceTypeSelect=SourceTypeSelect() > > sourceTypeSelect.ui.sourceTypeSelectNext.connect(sourceTypeSelect.ui.sourceTypeSelectNext,QtCore.SIGNAL("clicked()"),SourceTypeSelectNext) > > sourceTypeSelect.ui.sourceTypeSelectCancel.connect(sourceTypeSelect.ui.sourceTypeSelectCancel,QtCore.SIGNAL("clicked()"),SourceTypeSelectCancel) > > > sourceTypeConfirmation=SourceTypeConfirmation() > > sourceTypeConfirmation.ui.sourceTypeConfirmationBack.connect(sourceTypeConfirmation.ui.sourceTypeConfirmationBack,QtCore.SIGNAL("clicked()"),SourceTypeConfirmationBack) > > > welcome.show() > sys.exit(app.exec_()) > > > > > -- http://mail.python.org/mailman/listinfo/python-list