Open the wizard with the exec_() statement only when needed
[bertos.git] / wizard / bertos.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 sys
13
14 from PyQt4.QtCore import *
15 from PyQt4.QtGui import *
16
17 import BStartPage
18
19 import BFolderPage
20 import BVersionPage
21
22 def newProject():
23     wizard = QWizard()
24     wizard.setWindowTitle("Create a BeRTOS project")
25     wizard.addPage(BFolderPage.BFolderPage())
26     wizard.addPage(BVersionPage.BVersionPage())
27     wizard.show()
28     wizard.exec_()
29     
30 def editProject():
31     print "editProject"
32
33 def showStartPage():
34     QApplication.instance().dialog = BStartPage.BStartPage()
35     QApplication.instance().connect(QApplication.instance().dialog, SIGNAL("newProject"), newProject)
36     QApplication.instance().connect(QApplication.instance().dialog, SIGNAL("editProject"), editProject)
37     QApplication.instance().dialog.show()
38
39 def main():
40     app = QApplication(sys.argv)
41     app.settings = QSettings("Develer", "Bertos Configurator")
42     QResource.registerResource("bertos.rcc")
43     showStartPage()
44     sys.exit(app.exec_())
45
46 if __name__ == '__main__':
47     main()
48