From: duplo Date: Wed, 28 Apr 2010 16:23:38 +0000 (+0000) Subject: Add logic for the path choice. X-Git-Tag: 2.5.0~343 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=67d2aeb4d61b3843ed2fbac9ced64ffb76059c50;p=bertos.git Add logic for the path choice. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@3565 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/wizard/BRoutePage.py b/wizard/BRoutePage.py index ccd0eff0..b34f7900 100644 --- a/wizard/BRoutePage.py +++ b/wizard/BRoutePage.py @@ -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): """ diff --git a/wizard/BToolchainPage.py b/wizard/BToolchainPage.py index 5db15b7b..e3fd825a 100644 --- a/wizard/BToolchainPage.py +++ b/wizard/BToolchainPage.py @@ -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. ##