X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=wizard%2FBWizard.py;h=a4436623bc965e803c431c31ee8aebf133afec59;hb=440450f9f44c7bfc5bf1813adab87716e0a422fd;hp=221f320179d08be05ff843c79b62efd29a08e0a2;hpb=747ba554790ad832c0508b1f79242ba1d493d849;p=bertos.git diff --git a/wizard/BWizard.py b/wizard/BWizard.py index 221f3201..a4436623 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 # @@ -21,36 +21,45 @@ import BToolchainPage import BModulePage import BOutputPage import BCreationPage +import BFinalPage class BWizard(QWizard): + """ + Main class of the wizard. It adds the pages automatically. + """ - def __init__(self): + def __init__(self, page_list): QWizard.__init__(self) - # TODO: choose the right minimum size - self.setMinimumSize(1000, 500) self.setWindowTitle(self.tr("Create a BeRTOS project")) - self._addPages() - self._connectSignals() + self.setWindowIcon(QIcon(":/images/appicon.png")) + self.setOption(QWizard.DisabledBackButtonOnLastPage, True) + self.addPages(page_list) + 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()) - - def _connectSignals(self): - self.connect(self, SIGNAL("currentIdChanged(int)"), self._pageChanged) + 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): - prev_page = self.page(pageId - 1) - if prev_page is not None: - prev_page.saveData() + 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): - return copy.deepcopy(QApplication.instance().project) \ No newline at end of file + """ + Returns the BProject associated with the wizard. + """ + return copy.deepcopy(QApplication.instance().project)