- ## int, long or undefined type property
- spinBox = QSpinBox()
- self.pageContent.propertyTable.setCellWidget(index, 1, spinBox)
- if "min" in configurations[property]["informations"].keys():
- minimum = int(configurations[property]["informations"]["min"])
- else:
- minimum = -32768
- spinBox.setMinimum(minimum)
- if "max" in configurations[property]["informations"].keys():
- maximum = int(configurations[property]["informations"]["max"])
- else:
- maximum = 32767
- spinBox.setMaximum(maximum)
- if "long" in configurations[property]["informations"].keys() and configurations[property]["informations"]["long"] == "True":
- spinBox.setSuffix("L")
- spinBox.setValue(int(configurations[property]["value"].replace("L", "")))
-
- def _saveData(self, previousRow, previousColumn):
- module = self._module(previousRow)
- moduleConfigurations = self._configurations(module)
- for index in range(self.pageContent.propertyTable.rowCount()):
- parameter = qvariant_converter.getString(self.pageContent.propertyTable.item(index, 0).data(Qt.UserRole))
- if "type" not in moduleConfigurations[parameter]["informations"].keys() or moduleConfigurations[parameter]["informations"]["type"] == "int":
- moduleConfigurations[parameter]["value"] = str(self.pageContent.propertyTable.cellWidget(index, 1).value())
- elif moduleConfigurations[parameter]["informations"]["type"] == "enum":
- moduleConfigurations[parameter]["value"] = unicode(self.pageContent.propertyTable.cellWidget(index, 1).currentText())
- elif moduleConfigurations[parameter]["informations"]["type"] == "boolean":
- if self.pageContent.propertyTable.cellWidget(index, 1).isChecked():
- moduleConfigurations[parameter]["value"] = "1"
- else:
- moduleConfigurations[parameter]["value"] = "0"
-
- def _pageChanged(self, row, column, previousRow, previousColumn):
- if previousRow != -1 and previousColumn != -1:
- self._saveData(previousRow, previousColumn)
- self._fillPropertyTable()
+ self.pageContent.propertyTable.setRowCount(0)
+
+ def _insertCheckBox(self, index, value):
+ ## boolean property
+ checkBox = QCheckBox()
+ self.pageContent.propertyTable.setCellWidget(index, 1, checkBox)
+ if value == "1":
+ checkBox.setChecked(True)
+ else:
+ checkBox.setChecked(False)
+ self._controlGroup.addControl(index, checkBox)
+
+ def _insertComboBox(self, index, value, value_list):
+ ## enum property
+ comboBox = QComboBox()
+ self.pageContent.propertyTable.setCellWidget(index, 1, comboBox)
+ enum = self._projectInfoRetrieve("LISTS")[value_list]
+ for i, element in enumerate(enum):
+ comboBox.addItem(element)
+ if element == value:
+ comboBox.setCurrentIndex(i)
+ self._controlGroup.addControl(index, comboBox)
+
+ def _insertSpinBox(self, index, value, informations):
+ ## int, long or undefined type property
+ spinBox = None
+ if bertos_utils.isLong(informations) or bertos_utils.isUnsignedLong(informations):
+ spinBox = QDoubleSpinBox()
+ spinBox.setDecimals(0)
+ else:
+ spinBox = QSpinBox()
+ self.pageContent.propertyTable.setCellWidget(index, 1, spinBox)
+ minimum = -32768
+ maximum = 32767
+ suff = ""
+ if bertos_utils.isLong(informations):
+ minimum = -2147483648
+ maximum = 2147483647
+ suff = "L"
+ elif bertos_utils.isUnsigned(informations):
+ minimum = 0
+ maximum = 65535
+ suff = "U"
+ elif bertos_utils.isUnsignedLong(informations):
+ minimum = 0
+ maximum = 4294967295
+ suff = "UL"
+ if "min" in informations.keys():
+ minimum = int(informations["min"])
+ if "max" in informations.keys():
+ maximum = int(informations["max"])
+ spinBox.setRange(minimum, maximum)
+ spinBox.setSuffix(suff)
+ spinBox.setValue(int(value.replace("L", "").replace("U", "")))
+ self._controlGroup.addControl(index, spinBox)
+