Refactor to use new protocol module and sipo.
[bertos.git] / wizard / bertos.py
index abee435b7f05a033f0cf030bb17b2b99ce08a3b4..1608334c57c2904a32362d09194982cae1c72f2d 100755 (executable)
@@ -28,7 +28,6 @@
 #
 # Copyright 2008 Develer S.r.l. (http://www.develer.com/)
 #
-# $Id$
 #
 # Author: Lorenzo Berni <duplo@develer.com>
 #
@@ -48,16 +47,13 @@ from BWizard import BWizard
 
 from BIntroPage import BIntroPage
 from BFolderPage import BFolderPage
-from BTypePage import BTypePage
 from BBoardPage import BBoardPage
 from BProjectPresets import BProjectPresets
-from BRoutePage import BRoutePage
 from BOpenPage import BOpenPage
 from BVersionPage import BVersionPage
 from BCpuPage import BCpuPage
 from BToolchainPage import BToolchainPage
 from BModulePage import BModulePage
-from BOutputPage import BOutputPage
 from BCreationPage import BCreationPage
 from BFinalPage import BFinalPage
 
@@ -69,7 +65,7 @@ from LoadException import VersionException, ToolchainException
 
 def newProject():
     QApplication.instance().project = BProject()
-    page_list = [BIntroPage, BFolderPage, BVersionPage, BTypePage, BBoardPage, BProjectPresets, BRoutePage, BCpuPage, BToolchainPage, BModulePage, BOutputPage, BCreationPage, BFinalPage]
+    page_list = [BIntroPage, BFolderPage, BVersionPage, BBoardPage, BProjectPresets, BCpuPage, BToolchainPage, BModulePage, BCreationPage, BFinalPage]
     wizard = BWizard(page_list)
     wizard.show()
     wizard.exec_()
@@ -86,12 +82,16 @@ def newProject():
 
 def editProject(project_file):
     info_dict = {}
+    # Progress dialog.
+    p_dialog = QProgressDialog(QApplication.instance().tr("Wait project loading"), QApplication.instance().tr("Cancel"), 0, 0)
     while(True):
+        p_dialog.show()
         # Empty project is the default fallback.
         QApplication.instance().project = BProject()
         try:
             QApplication.instance().project = BProject(project_file, info_dict)
         except VersionException:
+            p_dialog.hide()
             QMessageBox.critical(
                 None,
                 QObject().tr("BeRTOS version not found!"),
@@ -103,6 +103,7 @@ def editProject(project_file):
                 info_dict["BERTOS_PATH"] = version
             continue
         except ToolchainException, exc:
+            p_dialog.hide()
             QMessageBox.critical(
                 None,
                 QObject().tr("Toolchain not found!"),
@@ -116,6 +117,7 @@ def editProject(project_file):
             continue
         break
     dialog = BEditingDialog()
+    p_dialog.hide()
     dialog.exec_()
 
 def main():
@@ -123,10 +125,21 @@ def main():
     app.settings = QSettings("Develer", "Bertos Configurator")
     # Development utility lines, to be removed for production
     datadir = DATA_DIR
-    qrc, rcc = os.path.join(datadir, 'bertos.qrc'), os.path.join(datadir, 'bertos.rcc')
-    if not (hasattr(sys, "frozen") and sys.frozen) and newer(qrc, rcc):
-        os.system("rcc -binary %s -o %s" %(qrc, rcc))
-    QResource.registerResource(rcc)
+
+    # Something seems to not work, on Windows, using pyrcc4 with BeRTOS Wizard
+    # resources. So I'm restoring the old rcc-based resource generation
+    # system.
+    #
+    # qrc, bertos_rc = os.path.join(datadir, 'bertos.qrc'), os.path.join(datadir, 'bertos_rc.py')
+    # if not (hasattr(sys, "frozen") and sys.frozen) and newer(qrc, bertos_rc):
+    #     os.system("pyrcc4 \"%s\" -o \"%s\"" %(qrc, bertos_rc))
+    # import bertos_rc
+
+    qrc, rcc = os.path.join(datadir, 'bertos.qrc'), os.path.join(datadir, 'bertos.rcc') 
+    if not (hasattr(sys, "frozen") and sys.frozen) and newer(qrc, rcc): 
+        os.system("rcc -binary \"%s\" -o \"%s\"" %(qrc, rcc)) 
+    QResource.registerResource(rcc) 
+    
     if len(sys.argv) == 3 and sys.argv[1] == "--edit":
         editProject(os.path.abspath(sys.argv[2]))
     else: