From 3cd73c355f9d5bd07eaee38425661f5f4310f020 Mon Sep 17 00:00:00 2001 From: duplo Date: Wed, 31 Mar 2010 14:44:24 +0000 Subject: [PATCH] Add infrastructure for CPU reloading files. git-svn-id: https://src.develer.com/svnoss/bertos/trunk@3361 38d2e660-2303-0410-9eaa-f027e97ec537 --- wizard/BCpuPage.py | 2 +- wizard/BProject.py | 15 +++++++++++++-- wizard/bertos_utils.py | 6 ------ wizard/test/testCpuTagsImport.py | 2 +- 4 files changed, 15 insertions(+), 10 deletions(-) diff --git a/wizard/BCpuPage.py b/wizard/BCpuPage.py index e9052e67..842200b5 100644 --- a/wizard/BCpuPage.py +++ b/wizard/BCpuPage.py @@ -158,7 +158,7 @@ class BCpuPage(BWizardPage): """ self.pageContent.cpuList.clear() self.pageContent.cpuList.setCurrentItem(None) - infos = bertos_utils.loadCpuInfos(self.project()) + infos = self.project().loadCpuInfos() tag_list = bertos_utils.getTagSet(infos) # Create, fill and store the dict with the tags tag_dict = {} diff --git a/wizard/BProject.py b/wizard/BProject.py index 2eb1bdcf..1cbaf164 100644 --- a/wizard/BProject.py +++ b/wizard/BProject.py @@ -39,10 +39,11 @@ import copy import pickle import DefineException +import const from bertos_utils import ( # Utility functions - isBertosDir, loadCpuInfos, getTagSet, setEnabledModules, + isBertosDir, getTagSet, setEnabledModules, getInfos, loadConfigurationInfos, loadDefineLists, loadModuleDefinition, getCommentList, updateConfigurationValues, @@ -84,7 +85,7 @@ class BProject(object): self.loadSourceTree() cpu_name = project_data["CPU_NAME"] self.infos["CPU_NAME"] = cpu_name - cpu_info = loadCpuInfos(self) + cpu_info = self.loadCpuInfos() for cpu in cpu_info: if cpu["CPU_NAME"] == cpu_name: self.infos["CPU_INFOS"] = cpu @@ -165,6 +166,16 @@ class BProject(object): self.infos["CONFIGURATIONS"] = configuration_info_dict self.infos["FILES"] = file_dict + def loadCpuInfos(self): + cpuInfos = [] + for definition in self.findDefinitions(const.CPU_DEFINITION): + cpuInfos.append(getInfos(definition)) + return cpuInfos + + def reloadCpuInfo(self): + for cpu_info in self.loadCpuInfos(): + if cpu_info["CPU_NAME"]: + self.infos["CPU_INFOS"] = cpu_info def setInfo(self, key, value): """ diff --git a/wizard/bertos_utils.py b/wizard/bertos_utils.py index c33e9c8a..c19f3d53 100644 --- a/wizard/bertos_utils.py +++ b/wizard/bertos_utils.py @@ -409,12 +409,6 @@ def getToolchainName(toolchain_info): name = "GCC " + toolchain_info["version"] + " - " + toolchain_info["target"].strip() return name -def loadCpuInfos(project_info): - cpuInfos = [] - for definition in project_info.findDefinitions(const.CPU_DEFINITION): - cpuInfos.append(getInfos(definition)) - return cpuInfos - def getTagSet(cpu_info): tag_set = set([]) for cpu in cpu_info: diff --git a/wizard/test/testCpuTagsImport.py b/wizard/test/testCpuTagsImport.py index 19a1e376..79e7844c 100644 --- a/wizard/test/testCpuTagsImport.py +++ b/wizard/test/testCpuTagsImport.py @@ -46,7 +46,7 @@ def main(): p = BProject.BProject() p.setInfo("SOURCES_PATH", "../../") p.loadSourceTree() - info = loadCpuInfos(p) + info = p.loadCpuInfos() tags = getTagSet(info) print tags -- 2.25.1