From 36284fc733a9c88b52e390588b81c27d4f1663c9 Mon Sep 17 00:00:00 2001 From: duplo Date: Wed, 1 Apr 2009 15:37:33 +0000 Subject: [PATCH] Make BWizard generic: now it can be used for both creating and editing projects git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2457 38d2e660-2303-0410-9eaa-f027e97ec537 --- wizard/BWizard.py | 20 +++++++------------- wizard/bertos.py | 17 +++++++++++++++-- 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/wizard/BWizard.py b/wizard/BWizard.py index 3ea2dac6..7fed96c5 100644 --- a/wizard/BWizard.py +++ b/wizard/BWizard.py @@ -28,26 +28,20 @@ class BWizard(QWizard): Main class of the wizard. It adds the pages automatically. """ - def __init__(self): + def __init__(self, page_list): QWizard.__init__(self) self.setWindowTitle(self.tr("Create a BeRTOS project")) self.setOption(QWizard.DisabledBackButtonOnLastPage, True) - self.addPages() + self.addPages(page_list) self.connectSignals() - def addPages(self): + def addPages(self, page_list): """ - Method used by the constructor in order to add the pages in the wizard. + Adds the pages in the wizard. """ - self.addPage(BFolderPage.BFolderPage()) - self.addPage(BVersionPage.BVersionPage()) - self.addPage(BCpuPage.BCpuPage()) - self.addPage(BToolchainPage.BToolchainPage()) - self.addPage(BModulePage.BModulePage()) - self.addPage(BOutputPage.BOutputPage()) - self.addPage(BCreationPage.BCreationPage()) - self.addPage(BFinalPage.BFinalPage()) - + for page in page_list: + self.addPage(page()) + def connectSignals(self): """ Connects the signals with the related slots. diff --git a/wizard/bertos.py b/wizard/bertos.py index 96730e59..0c110b97 100755 --- a/wizard/bertos.py +++ b/wizard/bertos.py @@ -21,15 +21,28 @@ import BProject import BStartPage import BWizard +from BFolderPage import BFolderPage +from BVersionPage import BVersionPage +from BCpuPage import BCpuPage +from BToolchainPage import BToolchainPage +from BModulePage import BModulePage +from BOutputPage import BOutputPage +from BCreationPage import BCreationPage +from BFinalPage import BFinalPage + import bertos_utils def newProject(): - wizard = BWizard.BWizard() + page_list = [BFolderPage, BVersionPage, BCpuPage, BToolchainPage, BModulePage, BOutputPage, BCreationPage, BFinalPage] + wizard = BWizard.BWizard(page_list) wizard.show() wizard.exec_() def editProject(): - print "editProject" + page_list = [BVersionPage, BCpuPage, BToolchainPage, BModulePage, BOutputPage, BCreationPage, BFinalPage] + wizard = BWizard.BWizard(page_list) + wizard.show() + wizard.exec_() def showStartPage(): QApplication.instance().dialog = BStartPage.BStartPage() -- 2.25.1