From 5456306fbbfcc4940fcfdf9cb9ac42ba7d643eb0 Mon Sep 17 00:00:00 2001 From: duplo Date: Thu, 26 Mar 2009 08:55:50 +0000 Subject: [PATCH] Order the configuration property git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2433 38d2e660-2303-0410-9eaa-f027e97ec537 --- wizard/BModulePage.py | 48 ++++++++++++++++++++---------------------- wizard/bertos_utils.py | 2 ++ 2 files changed, 25 insertions(+), 25 deletions(-) diff --git a/wizard/BModulePage.py b/wizard/BModulePage.py index 4c282b3a..b124df9c 100644 --- a/wizard/BModulePage.py +++ b/wizard/BModulePage.py @@ -73,32 +73,30 @@ class BModulePage(BWizardPage): self.pageContent.moduleLabel.setText(module_description) self.pageContent.moduleLabel.setVisible(True) self.pageContent.propertyTable.clear() - if len(configuration) > 0: - configurations = self._projectInfoRetrieve("CONFIGURATIONS")[configuration] - self.pageContent.propertyTable.setRowCount(0) - index = 0 - for property in configurations: - if "type" in configurations[property]["informations"] and configurations[property]["informations"]["type"] == "autoenabled": - ## Doesn't show the hidden fields - pass + configurations = self._projectInfoRetrieve("CONFIGURATIONS")[configuration] + param_list = sorted(configurations["paramlist"]) + self.pageContent.propertyTable.setRowCount(0) + index = 0 + 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 + 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: - ## 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 - else: - self.pageContent.propertyTable.setRowCount(0) + # Not defined type, rendered as a text field + self.pageContent.propertyTable.setItem(index, 1, QTableWidgetItem(configurations[property]["value"])) + index += 1 def _insertCheckBox(self, index, value): ## boolean property diff --git a/wizard/bertos_utils.py b/wizard/bertos_utils.py index 933d9ed5..ecc8e132 100644 --- a/wizard/bertos_utils.py +++ b/wizard/bertos_utils.py @@ -442,9 +442,11 @@ def loadConfigurationInfos(path): "value_list": the name of the enum for enum parameters """ configuration_infos = {} + configuration_infos["paramlist"] = [] for comment, define, start in getDefinitionBlocks(open(path, "r").read()): name, value = formatParamNameValue(define) brief, description, informations = getDescriptionInformations(comment) + configuration_infos["paramlist"].append((start, name)) configuration_infos[name] = {} configuration_infos[name]["value"] = value configuration_infos[name]["informations"] = informations -- 2.25.1