When there is only one toolchain for the specified architecture the wizard selects...
[bertos.git] / wizard / BWizard.py
1 #!/usr/bin/env python
2 # encoding: utf-8
3 #
4 # Copyright 2008 Develer S.r.l. (http://www.develer.com/)
5 # All rights reserved.
6 #
7 # $Id$
8 #
9 # Author: Lorenzo Berni <duplo@develer.com>
10 #
11
12 import copy
13
14 from PyQt4.QtCore import *
15 from PyQt4.QtGui import *
16
17 import BFolderPage
18 import BVersionPage
19 import BCpuPage
20 import BToolchainPage
21 import BModulePage
22 import BOutputPage
23 import BCreationPage
24 import BFinalPage
25
26 class BWizard(QWizard):
27     """
28     Main class of the wizard. It adds the pages automatically.
29     """
30     
31     def __init__(self, page_list):
32         QWizard.__init__(self)
33         self.setWindowTitle(self.tr("Create a BeRTOS project"))
34         self.setWindowIcon(QIcon(":/images/appicon.png"))
35         self.setOption(QWizard.DisabledBackButtonOnLastPage, True)
36         self.addPages(page_list)
37         self.connectSignals()
38     
39     def addPages(self, page_list):
40         """
41         Adds the pages in the wizard.
42         """
43         for page in page_list:
44             self.addPage(page())
45
46     def connectSignals(self):
47         """
48         Connects the signals with the related slots.
49         """
50         self.connect(self, SIGNAL("currentIdChanged(int)"), self.pageChanged)
51     
52     def pageChanged(self, pageId):
53         """
54         Slot called when the user change the current page. It calls the reloadData
55         method of the next page.
56         """
57         page = self.page(pageId)
58         if page:
59             page.reloadData()
60     
61     def project(self):
62         """
63         Returns the BProject associated with the wizard.
64         """
65         return copy.deepcopy(QApplication.instance().project)