Open the wizard with the exec_() statement only when needed
[bertos.git] / wizard / bertos.py
index 78a42b0844f6302575ebf7c9ee6be6a20ff3604e..80001466c8bd9548c0a80e3e5966caa9967ff4f5 100644 (file)
 #
 
 import sys
+
 from PyQt4.QtCore import *
 from PyQt4.QtGui import *
+
 import BStartPage
+
+import BFolderPage
 import BVersionPage
 
+def newProject():
+    wizard = QWizard()
+    wizard.setWindowTitle("Create a BeRTOS project")
+    wizard.addPage(BFolderPage.BFolderPage())
+    wizard.addPage(BVersionPage.BVersionPage())
+    wizard.show()
+    wizard.exec_()
+    
+def editProject():
+    print "editProject"
+
+def showStartPage():
+    QApplication.instance().dialog = BStartPage.BStartPage()
+    QApplication.instance().connect(QApplication.instance().dialog, SIGNAL("newProject"), newProject)
+    QApplication.instance().connect(QApplication.instance().dialog, SIGNAL("editProject"), editProject)
+    QApplication.instance().dialog.show()
+
 def main():
     app = QApplication(sys.argv)
     app.settings = QSettings("Develer", "Bertos Configurator")
     QResource.registerResource("bertos.rcc")
-    startPage = BStartPage.BStartPage()
-    wizard = QWizard()
-    wizard.setWindowTitle("Welcome in beRTOS configuration wizard")
-    wizard.addPage(startPage)
-    wizard.addPage(BVersionPage.BVersionPage())
-    wizard.show()
+    showStartPage()
     sys.exit(app.exec_())
 
-
 if __name__ == '__main__':
     main()