I am running into problems controlling the exit from the wizard. Tried several things but seem not to find a solution. Probably overlook something...?

The code, attached below is executed on ubuntu 10.04 and I also tried on kubuntu.

The problem is with done and reject. The task does not exit, but persists. I have to kill the process. When eliminating done and reject, the task exits cleanly on finish and cancel.

If I add the statement
return 1
to done, I get an error message on the type being returned.

Does somebody have an idea what is wrong?

Thanks,

Heinz Preisig

code:  attached


--


Heinz A Preisig
Professor of Process Systems Engineering        Private:
Øvre Bakklandet 62 B, 7013 Trondheim, Norway
Department of Chemical Engineering
Norwegian University of Science and Technology
N -- 7491 Trondheim, Norway     Tel direct: +47 735 92807
Tel mob: +47 9754 1334
e-mail: heinz.prei...@chemeng.ntnu.no <mailto:heinz.prei...@chemeng.ntnu.no>
web: www.chemeng.ntnu.no\~preisig <http://www.chemeng.ntnu.no/%7Epreisig>


#!./bin/python
'''
Created on May 10, 2010

@author: heinz
'''




import sys
from PyQt4 import QtGui, QtCore
from wizard_ui_impl import Ui_WizardImpl

a = QtGui.QApplication(sys.argv)

w = Ui_WizardImpl()
w.show()
#TODO: close all windows on exit
r = a.exec_()
print 'finishing', r

Attachment: wizard.ui
Description: application/designer

#!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
Created on Aug 9, 2010

@author: heinz
'''



from PyQt4 import QtGui
from PyQt4 import QtCore
from wizard_ui import Ui_Wizard


class Ui_WizardImpl(QtGui.QWizard):
    '''
    classdocs
    '''


    def __init__(self, *args):
        QtGui.QWizard.__init__(self)
        self.setAttribute(QtCore.Qt.WA_DeleteOnClose)
        self.ui = Ui_Wizard()
        self.ui.setupUi(self)        
    
    def cleanupPage(self,int):
        print 'clean up page'
        
    def done(self, int):
        print 'done'
        self.close()
        return self


    def accept(self):
        print 'accepted'
        self.close()
        
#    def reject(self):
#        print 'reject'
#        self.__exit()
        
        
# -*- coding: utf-8 -*-

# Form implementation generated from reading ui file 'wizard.ui'
#
# Created: Thu Aug 12 10:39:21 2010
#      by: PyQt4 UI code generator 4.7.2
#
# WARNING! All changes made in this file will be lost!

from PyQt4 import QtCore, QtGui

class Ui_Wizard(object):
    def setupUi(self, Wizard):
        Wizard.setObjectName("Wizard")
        Wizard.resize(400, 300)
        self.wizardPage1 = QtGui.QWizardPage()
        self.wizardPage1.setObjectName("wizardPage1")
        Wizard.addPage(self.wizardPage1)
        self.wizardPage2 = QtGui.QWizardPage()
        self.wizardPage2.setObjectName("wizardPage2")
        Wizard.addPage(self.wizardPage2)

        self.retranslateUi(Wizard)
        QtCore.QMetaObject.connectSlotsByName(Wizard)

    def retranslateUi(self, Wizard):
        Wizard.setWindowTitle(QtGui.QApplication.translate("Wizard", "Wizard", None, QtGui.QApplication.UnicodeUTF8))

_______________________________________________
PyQt mailing list    PyQt@riverbankcomputing.com
http://www.riverbankcomputing.com/mailman/listinfo/pyqt

Reply via email to