Add logic for the path choice.
authorduplo <duplo@38d2e660-2303-0410-9eaa-f027e97ec537>
Wed, 28 Apr 2010 16:23:38 +0000 (16:23 +0000)
committerduplo <duplo@38d2e660-2303-0410-9eaa-f027e97ec537>
Wed, 28 Apr 2010 16:23:38 +0000 (16:23 +0000)
git-svn-id: https://src.develer.com/svnoss/bertos/trunk@3565 38d2e660-2303-0410-9eaa-f027e97ec537

wizard/BRoutePage.py
wizard/BToolchainPage.py

index ccd0eff05a7a0f8073971fa6b0ccedf480f0494d..b34f790050986e74fab5d39588993afa6c341478 100644 (file)
@@ -44,6 +44,7 @@ from BToolchainPage import BToolchainPage
 import const
 import qvariant_converter
 from bertos_utils import presetList
+from toolchain_manager import ToolchainManager
 
 class BRoutePage(BWizardPage):
     """
@@ -62,6 +63,7 @@ class BRoutePage(BWizardPage):
         Overload of the QWizardPage isComplete method.
         """
         self.setProjectInfo("EMPTY_MAIN", self.empty_main)
+        self.setProjectInfo("BASE_MODE", not self.advanced)
         return True
 
     def nextId(self):
@@ -73,7 +75,22 @@ class BRoutePage(BWizardPage):
         if self.advanced:
             return self.wizard().pageIndex(BToolchainPage)
         else:
-            return self.wizard().pageIndex(BOutputPage)
+            cpu_info = self.projectInfo("CPU_INFOS")
+            if cpu_info:
+                target = cpu_info["TOOLCHAIN"]
+            else:
+                # It seems that the nextId method is called before the
+                # reloadData one (that is called after the page changing.
+                #
+                # TODO: fix this awful code lines
+                target = None
+            # Try to find a suitable toolchain automatically
+            tm = ToolchainManager()
+            suitable_toolchains = tm.suitableToolchains(target)
+            if len(suitable_toolchains) == 1:
+                return self.wizard().pageIndex(BOutputPage)
+            else:
+                return self.wizard().pageIndex(BToolchainPage)
 
     ####
 
@@ -90,6 +107,7 @@ class BRoutePage(BWizardPage):
         Overload of the BWizardPage connectSignals method.
         """
         self.connect(self.pageContent.emptyCheckBox, SIGNAL("stateChanged(int)"), self, SIGNAL("completeChanged()"))
+        self.connect(self.pageContent.baseButton, SIGNAL("toggled(bool)"), self, SIGNAL("completeChanged()"))
 
     def reloadData(self):
         """
index 5db15b7b6645a7dcc3d711c4afc9c0247e3e2a49..e3fd825a68eef42cf4c99bab26290b8f87bae169 100644 (file)
@@ -37,6 +37,8 @@ import os
 import collections
 
 from BWizardPage import *
+from BOutputPage import BOutputPage
+
 import BToolchainSearch
 import bertos_utils
 import qvariant_converter
@@ -71,6 +73,16 @@ class BToolchainPage(BWizardPage):
         else:
             return False
 
+    def nextId(self):
+        """
+        Overload of the QWizardPage nextId method.
+        """
+        # Route to Output page if it's a predefined easy project.
+        if self.projectInfo("PROJECT_FROM_PRESET") and self.projectInfo("BASE_MODE"):
+            return self.wizard().pageIndex(BOutputPage)
+        else:
+            return QWizardPage.nextId(self)
+
     ####
 
     ## Overloaded BWizardPage methods. ##