Add infrastructure for CPU reloading files.
authorduplo <duplo@38d2e660-2303-0410-9eaa-f027e97ec537>
Wed, 31 Mar 2010 14:44:24 +0000 (14:44 +0000)
committerduplo <duplo@38d2e660-2303-0410-9eaa-f027e97ec537>
Wed, 31 Mar 2010 14:44:24 +0000 (14:44 +0000)
git-svn-id: https://src.develer.com/svnoss/bertos/trunk@3361 38d2e660-2303-0410-9eaa-f027e97ec537

wizard/BCpuPage.py
wizard/BProject.py
wizard/bertos_utils.py
wizard/test/testCpuTagsImport.py

index e9052e6773736e5ba57d2575c2cb637223de7f03..842200b50077b5d7bf96d8f2462ab3a7abd0a94c 100644 (file)
@@ -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 = {}
index 2eb1bdcfb32fd714d3f393937f97629199649fb9..1cbaf1643b69ab878336e1a975f1e83922f19b18 100644 (file)
@@ -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):
         """
index c33e9c8ac33868f03bfc7026f9f757f9359ed5db..c19f3d5322503c356394d1f1a25d246ea8dec788 100644 (file)
@@ -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:
index 19a1e37614b4adf197d396fb9028ad6c16aff5ef..79e7844c49a3dae092bfe905f63089789f69fa7f 100644 (file)
@@ -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