Add the appropriate widget for the parameters
authorduplo <duplo@38d2e660-2303-0410-9eaa-f027e97ec537>
Thu, 22 Jan 2009 11:51:24 +0000 (11:51 +0000)
committerduplo <duplo@38d2e660-2303-0410-9eaa-f027e97ec537>
Thu, 22 Jan 2009 11:51:24 +0000 (11:51 +0000)
git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2199 38d2e660-2303-0410-9eaa-f027e97ec537

wizard/BModulePage.py

index 45103e11c8e4fd6a8f6d4cf88312ebd8f8eb5295..11101c2cdf9851b030fcebfc18404b2ef0889fb1 100644 (file)
@@ -49,7 +49,24 @@ class BModulePage(BWizardPage):
         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"]))
+            if "type" in parameters[key]["informations"].keys():
+                if parameters[key]["informations"]["type"] == "boolean":
+                    checkBox = QCheckBox()
+                    self.pageContent.propertyTable.setCellWidget(index, 1, checkBox)
+                    checkBox.setChecked(parameters[key]["value"] == "1")
+                if parameters[key]["informations"]["type"] == "int":
+                    spinBox = QSpinBox()
+                    if "max" in parameters[key]["informations"].keys():
+                        spinBox.setMaximum(int(parameters[key]["informations"]["max"]))
+                    if "min" in parameters[key]["informations"].keys():
+                        spinBox.setMinimum(int(parameters[key]["informations"]["min"]))
+                    if "long" in parameters[key]["informations"].keys():
+                        if bool(parameters[key]["informations"]["long"]):
+                            spinBox.setSuffix("L")
+                    self.pageContent.propertyTable.setCellWidget(index, 1, spinBox)
+                    spinBox.setValue(int(parameters[key]["value"]))
+            else:
+                self.pageContent.propertyTable.setItem(index, 1, QTableWidgetItem(parameters[key]["value"]))
     
     def moduleItemClicked(self):
         module = unicode(self.pageContent.moduleList.currentItem().text())