X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=wizard%2FBWizard.py;h=1966d932e10d908ac74f5bbd2ec0329ff9209c87;hb=32eebaf8bf80d1ffd417bfe6d2c34e6cd3684f87;hp=d9dc4994a9660e46b1cc8ef9a9e17af0bf10c2f5;hpb=f143322ab6e74636c576c0929eb2577ec8b56890;p=bertos.git diff --git a/wizard/BWizard.py b/wizard/BWizard.py index d9dc4994..1966d932 100644 --- a/wizard/BWizard.py +++ b/wizard/BWizard.py @@ -20,35 +20,46 @@ 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) - # 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()) - - 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): - prevPage = self.page(pageId - 1) - if prevPage is not None: - prevPage.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: page.reloadData() - def _project(self): - return copy.deepcopy(QApplication.instance().project) \ No newline at end of file + def project(self): + """ + Returns the BProject associated with the wizard. + """ + return copy.deepcopy(QApplication.instance().project)