From 380e77785336771292d9a9a9d12f3c316694e915 Mon Sep 17 00:00:00 2001 From: duplo Date: Thu, 16 Apr 2009 17:47:34 +0000 Subject: [PATCH] Add infrastructure for recognize modules supported by the selected cpu git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2522 38d2e660-2303-0410-9eaa-f027e97ec537 --- wizard/BCpuPage.py | 13 +++++++++++++ wizard/bertos_utils.py | 20 +++++++++++++++++--- wizard/const.py | 1 + 3 files changed, 31 insertions(+), 3 deletions(-) diff --git a/wizard/BCpuPage.py b/wizard/BCpuPage.py index f1dbfd66..e490acab 100644 --- a/wizard/BCpuPage.py +++ b/wizard/BCpuPage.py @@ -44,6 +44,13 @@ class BCpuPage(BWizardPage): self.setProjectInfo("CPU_INFOS", infos) self.setProjectInfo("CPU_NAME", unicode(self.pageContent.cpuList.currentItem().text())) self.setProjectInfo("SELECTED_FREQ", unicode(long(self.pageContent.frequencySpinBox.value()))) + tag_dict = self.projectInfo("ALL_CPU_TAGS") + for tag in tag_dict: + if tag in infos["CPU_TAGS"] + [infos["CPU_NAME"], infos["CORE_CPU"]]: + tag_dict[tag] = "True" + else: + tag_dict[tag] = "False" + self.setProjectInfo("ALL_CPU_TAGS", tag_dict) return True else: return False @@ -119,6 +126,12 @@ class BCpuPage(BWizardPage): self.pageContent.cpuList.clear() self.pageContent.cpuList.setCurrentItem(None) infos = bertos_utils.loadCpuInfos(self.project()) + tag_list = bertos_utils.getTagSet(infos) + # Create, fill and store the dict with the tags + tag_dict = {} + for element in tag_list: + tag_dict[element] = "False" + self.setProjectInfo("ALL_CPU_TAGS", tag_dict) for cpu in infos: item = QListWidgetItem(cpu["CPU_NAME"]) item.setData(Qt.UserRole, qvariant_converter.convertDict(cpu)) diff --git a/wizard/bertos_utils.py b/wizard/bertos_utils.py index a9578d13..33942e8a 100644 --- a/wizard/bertos_utils.py +++ b/wizard/bertos_utils.py @@ -301,6 +301,15 @@ def loadCpuInfos(project): cpuInfos.append(getInfos(definition)) return cpuInfos +def getTagSet(cpu_info): + tag_set = set([]) + for cpu in cpu_info: + tag_set |= set([cpu["CPU_NAME"]]) + tag_set |= set(cpu["CPU_TAGS"]) + tag_set |= set([cpu["CORE_CPU"]]) + return tag_set + + def getInfos(definition): D = {} D.update(const.CPU_DEF) @@ -337,10 +346,11 @@ def loadModuleDefinition(first_comment): del module_definition[const.MODULE_DEFINITION["module_name"]] module_dict[module_name] = {} if const.MODULE_DEFINITION["module_depends"] in module_definition.keys(): - if type(module_definition[const.MODULE_DEFINITION["module_depends"]]) == str: - module_definition[const.MODULE_DEFINITION["module_depends"]] = (module_definition[const.MODULE_DEFINITION["module_depends"]],) - module_dict[module_name]["depends"] = module_definition[const.MODULE_DEFINITION["module_depends"]] + depends = module_definition[const.MODULE_DEFINITION["module_depends"]] del module_definition[const.MODULE_DEFINITION["module_depends"]] + if type(depends) == str: + depends = (depends,) + module_dict[module_name]["depends"] = depends else: module_dict[module_name]["depends"] = () if const.MODULE_DEFINITION["module_configuration"] in module_definition.keys(): @@ -364,6 +374,10 @@ def loadModuleDefinition(first_comment): module_dict[module_name]["hw"] = hw else: module_dict[module_name]["hw"] = () + if const.MODULE_DEFINITION["module_supports"] in module_definition.keys(): + supports = module_definition[const.MODULE_DEFINITION["module_supports"]] + del module_definition[const.MODULE_DEFINITION["module_supports"]] + module_dict[module_name]["supports"] = supports module_dict[module_name]["constants"] = module_definition module_dict[module_name]["enabled"] = False return to_be_parsed, module_dict diff --git a/wizard/const.py b/wizard/const.py index f776b977..f67b0bcd 100644 --- a/wizard/const.py +++ b/wizard/const.py @@ -70,4 +70,5 @@ MODULE_DEFINITION = { "module_depends": "module_depends", "module_harvard": "module_harvard", "module_hw": "module_hw", + "module_supports": "module_supports", } \ No newline at end of file -- 2.25.1