From: duplo Date: Fri, 17 Apr 2009 16:22:34 +0000 (+0000) Subject: Module configuration parameters are showed only when they are compatible with the... X-Git-Tag: 2.1.0~133 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=2523526e79b094727d83f791c2ff3a5b9e5c6cd3;p=bertos.git Module configuration parameters are showed only when they are compatible with the choosen cpu git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2549 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/wizard/BCpuPage.py b/wizard/BCpuPage.py index a67f98e0..c105543c 100644 --- a/wizard/BCpuPage.py +++ b/wizard/BCpuPage.py @@ -47,9 +47,9 @@ class BCpuPage(BWizardPage): tag_dict = self.projectInfo("ALL_CPU_TAGS") for tag in tag_dict: if tag in infos["CPU_TAGS"] + [infos["CPU_NAME"], infos["CORE_CPU"], infos["TOOLCHAIN"]]: - tag_dict[tag] = "True" + tag_dict[tag] = True else: - tag_dict[tag] = "False" + tag_dict[tag] = False self.setProjectInfo("ALL_CPU_TAGS", tag_dict) return True else: @@ -134,7 +134,7 @@ class BCpuPage(BWizardPage): # Create, fill and store the dict with the tags tag_dict = {} for element in tag_list: - tag_dict[element] = "False" + tag_dict[element] = False self.setProjectInfo("ALL_CPU_TAGS", tag_dict) for cpu in infos: item = QListWidgetItem(cpu["CPU_NAME"]) diff --git a/wizard/BModulePage.py b/wizard/BModulePage.py index 2191ce60..e0bcd9db 100644 --- a/wizard/BModulePage.py +++ b/wizard/BModulePage.py @@ -79,7 +79,7 @@ class BModulePage(BWizardPage): module = self.currentModule() if module is not None: try: - supported = bertos_utils.isSupported(module, self.project()) + supported = bertos_utils.isSupported(self.project(), module=module) except SupportedException, e: self.exceptionOccurred(self.tr("Error evaluating \"%1\" for module %2").arg(e.support_string).arg(selectedModule)) supported = True @@ -104,23 +104,30 @@ class BModulePage(BWizardPage): for i, property in param_list: if "type" in configurations[property]["informations"] and configurations[property]["informations"]["type"] == "autoenabled": # Doesn't show the hidden fields - pass + continue + try: + param_supported = bertos_utils.isSupported(self.project(), property_id=(configuration, property)) + except SupportedException, e: + self.exceptionOccurred(self.tr("Error evaluating \"%1\" for module %2").arg(e.support_string).arg(selectedModule)) + param_supported = True + if not param_supported: + # Doesn't show the unsupported parameters + continue + # Set the row count to the current index + 1 + self.pageContent.propertyTable.setRowCount(index + 1) + item = QTableWidgetItem(configurations[property]["brief"]) + item.setData(Qt.UserRole, qvariant_converter.convertString(property)) + self.pageContent.propertyTable.setItem(index, 0, item) + if "type" in configurations[property]["informations"].keys() and configurations[property]["informations"]["type"] == "boolean": + self.insertCheckBox(index, configurations[property]["value"]) + elif "type" in configurations[property]["informations"].keys() and configurations[property]["informations"]["type"] == "enum": + self.insertComboBox(index, configurations[property]["value"], configurations[property]["informations"]["value_list"]) + elif "type" in configurations[property]["informations"] and configurations[property]["informations"]["type"] == "int": + self.insertSpinBox(index, configurations[property]["value"], configurations[property]["informations"]) else: - # Set the row count to the current index + 1 - self.pageContent.propertyTable.setRowCount(index + 1) - item = QTableWidgetItem(configurations[property]["brief"]) - item.setData(Qt.UserRole, qvariant_converter.convertString(property)) - self.pageContent.propertyTable.setItem(index, 0, item) - if "type" in configurations[property]["informations"].keys() and configurations[property]["informations"]["type"] == "boolean": - self.insertCheckBox(index, configurations[property]["value"]) - elif "type" in configurations[property]["informations"].keys() and configurations[property]["informations"]["type"] == "enum": - self.insertComboBox(index, configurations[property]["value"], configurations[property]["informations"]["value_list"]) - elif "type" in configurations[property]["informations"] and configurations[property]["informations"]["type"] == "int": - self.insertSpinBox(index, configurations[property]["value"], configurations[property]["informations"]) - else: - # Not defined type, rendered as a text field - self.pageContent.propertyTable.setItem(index, 1, QTableWidgetItem(configurations[property]["value"])) - index += 1 + # Not defined type, rendered as a text field + self.pageContent.propertyTable.setItem(index, 1, QTableWidgetItem(configurations[property]["value"])) + index += 1 if self.pageContent.propertyTable.rowCount() == 0: module_label = self.pageContent.moduleLabel.text() module_label += "\n\nNo configuration needed." @@ -205,7 +212,7 @@ class BModulePage(BWizardPage): enabled = modules[module]["enabled"] module_item = QTreeWidgetItem(item, QStringList([module])) try: - supported = bertos_utils.isSupported(module, self.project()) + supported = bertos_utils.isSupported(self.project(), module=module) except SupportedException, e: self.exceptionOccurred(self.tr("Error evaluating \"%1\" for module %2").arg(e.support_string).arg(selectedModule)) supported = True diff --git a/wizard/bertos_utils.py b/wizard/bertos_utils.py index f71f0e10..e6c2380a 100644 --- a/wizard/bertos_utils.py +++ b/wizard/bertos_utils.py @@ -383,11 +383,14 @@ def loadModuleDefinition(first_comment): module_dict[module_name]["enabled"] = False return to_be_parsed, module_dict -def isSupported(module, project): +def isSupported(project, module=None, property_id=None): + if module is None and property_id is not None: + item = project.info("CONFIGURATIONS")[property_id[0]][property_id[1]]["informations"] + else: + item = project.info("MODULES")[module] tag_dict = project.info("ALL_CPU_TAGS") - module = project.info("MODULES")[module] - if "supports" in module: - support_string = module["supports"] + if "supports" in item: + support_string = item["supports"] supported = {} try: exec "supported = " + support_string in tag_dict, supported @@ -396,7 +399,6 @@ def isSupported(module, project): return supported["supported"] else: return True - def loadDefineLists(comment_list): define_list = {}