X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=wizard%2FBWizard.py;h=7fed96c556b2561359cd1b8bc1559fc090dbeb8d;hb=28fbc160c6bca850837bb020bc2758a3556710a4;hp=2996f2a1f64d23ef14e1eaefa01e24d5e7ad4b55;hpb=49448500694891fcf24026e904c5891d4521eb1d;p=bertos.git diff --git a/wizard/BWizard.py b/wizard/BWizard.py index 2996f2a1..7fed96c5 100644 --- a/wizard/BWizard.py +++ b/wizard/BWizard.py @@ -9,6 +9,8 @@ # Author: Lorenzo Berni # +import copy + from PyQt4.QtCore import * from PyQt4.QtGui import * @@ -16,25 +18,47 @@ import BFolderPage import BVersionPage import BCpuPage 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) self.setWindowTitle(self.tr("Create a BeRTOS project")) - self._addPages() - self._connectSignals() - - def _addPages(self): - self.addPage(BFolderPage.BFolderPage()) - self.addPage(BVersionPage.BVersionPage()) - self.addPage(BCpuPage.BCpuPage()) - self.addPage(BToolchainPage.BToolchainPage()) + self.setOption(QWizard.DisabledBackButtonOnLastPage, True) + self.addPages(page_list) + self.connectSignals() - 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): + 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: - page.reloadData() \ No newline at end of file + page.reloadData() + + def project(self): + """ + Returns the BProject associated with the wizard. + """ + return copy.deepcopy(QApplication.instance().project)