Ejemplo n.º 1
0
 def __init__(self, parent=None):
     super(PyQtWizard, self).__init__(parent)
     self.ui = Ui_PyQtWizard()
     self.ui.setupUi(self)
     
     for i in self.pageIds():
         self.removePage(i)
         
     self.addPage(ApplicationPage(self))
     self.addPage(GuiPage(self))
     self.addPage(ConclusionPage(self))
Ejemplo n.º 2
0
class PyQtWizard(QWizard):
    def __init__(self, parent=None):
        super(PyQtWizard, self).__init__(parent)
        self.ui = Ui_PyQtWizard()
        self.ui.setupUi(self)
        
        for i in self.pageIds():
            self.removePage(i)
            
        self.addPage(ApplicationPage(self))
        self.addPage(GuiPage(self))
        self.addPage(ConclusionPage(self))
        
        
    def accept(self):
        appname = str(self.field("appName").toString())
        appversion = str(self.field("appVersion").toString())
        orgname = str(self.field("orgName").toString())
        location = str(self.field("location").toString())
        uifile = str(self.field("uiFilename").toString())
        uiclass = str(self.field("uiClassname").toString())
        winclass = str(self.field("mainWindowClassname").toString())
        usesettings = self.field("useSettings").toBool()
        keepstate = self.field("keepState").toBool()
        main_tpl = Template(file='templates/main.tpl', searchList=locals())
        win_tpl = Template(file='templates/win.tpl', searchList=locals())
        self.save(main_tpl, location, 'main.py')
        self.save(win_tpl, location, appname.lower()+'.py')
        QMessageBox.information(self, "Done", "All work done!")
        super(PyQtWizard, self).accept()
        
    def save(self, template, location, filename):
        full_path = os.path.join(location, filename)
        f = open(full_path, 'w')
        f.write(str(template))
        f.close()