Restore the old rcc-based resource generation system.
[bertos.git] / wizard / bertos.py
index c53674a9f7574baee2397b893732d35b9e357fef..a404cb23556fa35c9abbe00c9737eeaf467fde7a 100755 (executable)
@@ -28,7 +28,6 @@
 #
 # Copyright 2008 Develer S.r.l. (http://www.develer.com/)
 #
 #
 # Copyright 2008 Develer S.r.l. (http://www.develer.com/)
 #
-# $Id$
 #
 # Author: Lorenzo Berni <duplo@develer.com>
 #
 #
 # Author: Lorenzo Berni <duplo@develer.com>
 #
@@ -49,13 +48,12 @@ from BWizard import BWizard
 from BIntroPage import BIntroPage
 from BFolderPage import BFolderPage
 from BBoardPage import BBoardPage
 from BIntroPage import BIntroPage
 from BFolderPage import BFolderPage
 from BBoardPage import BBoardPage
-from BRoutePage import BRoutePage
+from BProjectPresets import BProjectPresets
 from BOpenPage import BOpenPage
 from BVersionPage import BVersionPage
 from BCpuPage import BCpuPage
 from BToolchainPage import BToolchainPage
 from BModulePage import BModulePage
 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
 
 from BCreationPage import BCreationPage
 from BFinalPage import BFinalPage
 
@@ -67,7 +65,7 @@ from LoadException import VersionException, ToolchainException
 
 def newProject():
     QApplication.instance().project = BProject()
 
 def newProject():
     QApplication.instance().project = BProject()
-    page_list = [BIntroPage, BFolderPage, BVersionPage, BBoardPage, 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_()
     wizard = BWizard(page_list)
     wizard.show()
     wizard.exec_()
@@ -85,13 +83,15 @@ def newProject():
 def editProject(project_file):
     info_dict = {}
     while(True):
 def editProject(project_file):
     info_dict = {}
     while(True):
+        # Empty project is the default fallback.
+        QApplication.instance().project = BProject()
         try:
             QApplication.instance().project = BProject(project_file, info_dict)
         except VersionException:
             QMessageBox.critical(
                 None,
                 QObject().tr("BeRTOS version not found!"),
         try:
             QApplication.instance().project = BProject(project_file, info_dict)
         except VersionException:
             QMessageBox.critical(
                 None,
                 QObject().tr("BeRTOS version not found!"),
-                QObject().tr("The selected BeRTOS version is not found, please select an existing one...")
+                QObject().tr("The selected BeRTOS version was not found, please select another one...")
             )
             dialog = BVersionDialog()
             if dialog.exec_():
             )
             dialog = BVersionDialog()
             if dialog.exec_():
@@ -102,7 +102,7 @@ def editProject(project_file):
             QMessageBox.critical(
                 None,
                 QObject().tr("Toolchain not found!"),
             QMessageBox.critical(
                 None,
                 QObject().tr("Toolchain not found!"),
-                QObject().tr("The selected toolchain is not found, please select an existing one...")
+                QObject().tr("The selected toolchain was not found, please select another one...")
             )
             QApplication.instance().project = exc.partial_project
             dialog = BToolchainDialog()
             )
             QApplication.instance().project = exc.partial_project
             dialog = BToolchainDialog()
@@ -119,10 +119,21 @@ def main():
     app.settings = QSettings("Develer", "Bertos Configurator")
     # Development utility lines, to be removed for production
     datadir = DATA_DIR
     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:
     if len(sys.argv) == 3 and sys.argv[1] == "--edit":
         editProject(os.path.abspath(sys.argv[2]))
     else: