Module configuration parameters are showed only when they are compatible with the...
authorduplo <duplo@38d2e660-2303-0410-9eaa-f027e97ec537>
Fri, 17 Apr 2009 16:22:34 +0000 (16:22 +0000)
committerduplo <duplo@38d2e660-2303-0410-9eaa-f027e97ec537>
Fri, 17 Apr 2009 16:22:34 +0000 (16:22 +0000)
git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2549 38d2e660-2303-0410-9eaa-f027e97ec537

wizard/BCpuPage.py
wizard/BModulePage.py
wizard/bertos_utils.py

index a67f98e06216e385c31d91d51ba8bc388b2c302d..c105543c2680f3e304292f8fd819b2b3b1d3921d 100644 (file)
@@ -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"])
index 2191ce6056b9a7b8fe2d952d5a871bbaa9ee73f0..e0bcd9db956545199a0ee753581b8121ca2ce737 100644 (file)
@@ -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
index f71f0e1037cd3342f4cf8f06c3312beddf081b4b..e6c2380a04d90fb28f13574561b3551f8b2e984f 100644 (file)
@@ -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 = {}