X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=wizard%2FBWizard.py;h=1966d932e10d908ac74f5bbd2ec0329ff9209c87;hb=82719a8db134b6a14ae39963d0fd71c94de7f704;hp=0f8eb49f2fc6ff999c71f436c0cdcf253d3f1e5e;hpb=b8cac80114a0de8b6008ceb7b4cdfcaea6ade723;p=bertos.git diff --git a/wizard/BWizard.py b/wizard/BWizard.py index 0f8eb49f..1966d932 100644 --- a/wizard/BWizard.py +++ b/wizard/BWizard.py @@ -9,17 +9,57 @@ # Author: Lorenzo Berni # +import copy + +from PyQt4.QtCore import * from PyQt4.QtGui import * 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("Create a BeRTOS project") - self.addPage(BFolderPage.BFolderPage()) - self.addPage(BVersionPage.BVersionPage()) - self.addPage(BCpuPage.BCpuPage()) \ No newline at end of file + self.setWindowTitle(self.tr("Create a BeRTOS project")) + self.setWindowIcon(QIcon(":/images/appicon.png")) + self.setOption(QWizard.DisabledBackButtonOnLastPage, True) + 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: + page.reloadData() + + def project(self): + """ + Returns the BProject associated with the wizard. + """ + return copy.deepcopy(QApplication.instance().project)