From 99d33fad0667fe3c3d0661cd222df73e6fc568c3 Mon Sep 17 00:00:00 2001 From: duplo Date: Wed, 21 Jan 2009 09:58:35 +0000 Subject: [PATCH] Change the rapresentation of the module configuration parameters git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2192 38d2e660-2303-0410-9eaa-f027e97ec537 --- wizard/BModulePage.py | 10 +++++----- wizard/bertos_utils.py | 9 ++++++--- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/wizard/BModulePage.py b/wizard/BModulePage.py index ada00db5..93e7e167 100644 --- a/wizard/BModulePage.py +++ b/wizard/BModulePage.py @@ -45,12 +45,12 @@ class BModulePage(BWizardPage): for key, value in moduleInfos.items(): self.pageContent.moduleList.addItem(QListWidgetItem(key)) - def _fillParameterTable(self, value): + def _fillParameterTable(self, parameters): self.pageContent.propertyTable.clear() - self.pageContent.propertyTable.setRowCount(len(value)) - for index, element in enumerate(value): - self.pageContent.propertyTable.setItem(index, 0, QTableWidgetItem(element[0])) - self.pageContent.propertyTable.setItem(index, 1, QTableWidgetItem(element[1])) + self.pageContent.propertyTable.setRowCount(len(parameters)) + for index, key in enumerate(parameters): + self.pageContent.propertyTable.setItem(index, 0, QTableWidgetItem(key)) + self.pageContent.propertyTable.setItem(index, 1, QTableWidgetItem(parameters[key]["value"])) def moduleItemClicked(self): module = unicode(self.pageContent.moduleList.currentItem().text()) diff --git a/wizard/bertos_utils.py b/wizard/bertos_utils.py index 5c6bf3c1..fbf83818 100644 --- a/wizard/bertos_utils.py +++ b/wizard/bertos_utils.py @@ -117,13 +117,16 @@ def formatModuleNameValue(text): def loadModuleInfos(path): """ Return the module configurations found in the given path as a dict with the name as key - and a list of tuple as value. The tuple have the format (name, value, description). + and a dict as value. The value dict has the parameter name as key and has "value" and "description" + fields. """ moduleInfos = {} for definition in findDefinitions(const.MODULE_CONFIGURATION, path): moduleName = definition[0].replace("cfg_", "").replace(".h", "") - moduleInfos[moduleName] = [] + moduleInfos[moduleName] = {} for description, define in getDefinitionBlocks(open(definition[1] + "/" + definition[0], "r").read()): name, value = formatModuleNameValue(define) - moduleInfos[moduleName].append((name, value, description)) + moduleInfos[moduleName][name] = {} + moduleInfos[moduleName][name]["value"] = value + moduleInfos[moduleName][name]["description"] = description return moduleInfos -- 2.25.1