Add comment for each method and class
[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):
32         QWizard.__init__(self)
33         self.setWindowTitle(self.tr("Create a BeRTOS project"))
34         self.setOption(QWizard.DisabledBackButtonOnLastPage, True)
35         self._addPages()
36         self._connectSignals()
37     
38     def _addPages(self):
39         """
40         Method used by the constructor in order to add the pages in the wizard.
41         """
42         self.addPage(BFolderPage.BFolderPage())
43         self.addPage(BVersionPage.BVersionPage())
44         self.addPage(BCpuPage.BCpuPage())
45         self.addPage(BToolchainPage.BToolchainPage())
46         self.addPage(BModulePage.BModulePage())
47         self.addPage(BOutputPage.BOutputPage())
48         self.addPage(BCreationPage.BCreationPage())
49         self.addPage(BFinalPage.BFinalPage())
50     
51     def _connectSignals(self):
52         """
53         Connects the signals with the related slots.
54         """
55         self.connect(self, SIGNAL("currentIdChanged(int)"), self._pageChanged)
56     
57     def _pageChanged(self, pageId):
58         """
59         Slot called when the user change the current page. It calls the reloadData
60         method of the next page.
61         """
62         page = self.page(pageId)
63         if page is not None:
64             page.reloadData()
65     
66     def project(self):
67         """
68         Returns the BProject associated with the wizard.
69         """
70         return copy.deepcopy(QApplication.instance().project)