Add the project creation routine at the end of the wizard.
[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 os
13 import sys
14 from distutils.dep_util import newer
15
16 from PyQt4.QtCore import *
17 from PyQt4.QtGui import *
18
19 import BProject
20
21 import BStartPage
22 import BWizard
23
24 import bertos_utils
25
26 def newProject():
27     wizard = BWizard.BWizard()
28     wizard.show()
29     if wizard.exec_():
30         prj = wizard.project()
31         output = prj.info("OUTPUT")
32         if output == "makefile":
33             ## Now only supports the BeRTOS build system
34             bertos_utils.createBertosProject(prj)
35     
36 def editProject():
37     print "editProject"
38
39 def showStartPage():
40     QApplication.instance().dialog = BStartPage.BStartPage()
41     QApplication.instance().connect(QApplication.instance().dialog, SIGNAL("newProject"), newProject)
42     QApplication.instance().connect(QApplication.instance().dialog, SIGNAL("editProject"), editProject)
43     QApplication.instance().dialog.show()
44
45 def main():
46     app = QApplication(sys.argv)
47     app.settings = QSettings("Develer", "Bertos Configurator")
48     app.project = BProject.BProject()
49     if newer("bertos.qrc", "bertos.rcc"):
50         os.system("rcc -binary bertos.qrc > bertos.rcc")
51     QResource.registerResource("bertos.rcc")
52     showStartPage()
53     sys.exit(app.exec_())
54
55 if __name__ == '__main__':
56     main()
57