X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=wizard%2FBWizard.py;h=1f794fd3b388b09a73fc56f0a544a22b99d6ad85;hb=ff9e3c69aa5e11915f056f45f6200009dd29127c;hp=a430952835e077b542f5a4006f592feda68bebfe;hpb=a1aee0fd51fc5c32d712e76367abc3a2365c6324;p=bertos.git diff --git a/wizard/BWizard.py b/wizard/BWizard.py index a4309528..1f794fd3 100644 --- a/wizard/BWizard.py +++ b/wizard/BWizard.py @@ -4,7 +4,7 @@ # Copyright 2008 Develer S.r.l. (http://www.develer.com/) # All rights reserved. # -# $Id:$ +# $Id$ # # Author: Lorenzo Berni # @@ -23,32 +23,48 @@ import BOutputPage import BCreationPage import BFinalPage +try: + from version import wizard_version +except ImportError: + wizard_version = "sandbox" + class BWizard(QWizard): - - def __init__(self): + """ + Main class of the wizard. It adds the pages automatically. + """ + + def __init__(self, page_list): QWizard.__init__(self) - self.setWindowTitle(self.tr("Create a BeRTOS project")) + self.setWindowTitle(self.tr("Create a BeRTOS project - rev.%1").arg(wizard_version)) + self.setWindowIcon(QIcon(":/images/appicon.png")) self.setOption(QWizard.DisabledBackButtonOnLastPage, True) - self._addPages() - self._connectSignals() - - def _addPages(self): - 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()) - - def _connectSignals(self): - self.connect(self, SIGNAL("currentIdChanged(int)"), self._pageChanged) - - def _pageChanged(self, pageId): + self.addPages(page_list) + self.connectSignals() + + def addPages(self, page_list): + """ + Adds the pages in the wizard. + """ + for page in page_list: + self.addPage(page()) + + def connectSignals(self): + """ + Connects the signals with the related slots. + """ + self.connect(self, SIGNAL("currentIdChanged(int)"), self.pageChanged) + + def pageChanged(self, pageId): + """ + Slot called when the user change the current page. It calls the reloadData + method of the next page. + """ page = self.page(pageId) - if page is not None: + if page: page.reloadData() - + def project(self): + """ + Returns the BProject associated with the wizard. + """ return copy.deepcopy(QApplication.instance().project)