+ ####
+
+ ## Slots ##
+
+ def moduleClicked(self, item, column):
+ self.setBold(item, False)
+
+ def fillPropertyTable(self):
+ """
+ Slot called when the user selects a module from the module tree.
+ Fills the property table using the configuration parameters defined in
+ the source tree.
+ """
+ module = self.currentModule()
+ if module:
+ try:
+ 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(module))
+ supported = True
+ self._control_group.clear()
+ configuration = self.projectInfo("MODULES")[module]["configuration"]
+ module_description = self.projectInfo("MODULES")[module]["description"]
+ self.pageContent.moduleLabel.setText(module_description)
+ self.pageContent.moduleLabel.setVisible(True)
+ if not supported:
+ self.pageContent.warningLabel.setVisible(True)
+ selected_cpu = self.projectInfo("CPU_NAME")
+ self.pageContent.warningLabel.setText(self.tr("<font color='#FF0000'>Warning: the selected module, \
+ is not completely supported by the %1.</font>").arg(selected_cpu))
+ else:
+ self.pageContent.warningLabel.setVisible(False)
+ self.pageContent.propertyTable.clear()
+ self.pageContent.propertyTable.setRowCount(0)
+ if configuration != "":
+ configurations = self.projectInfo("CONFIGURATIONS")[configuration]
+ param_list = sorted(configurations["paramlist"])
+ 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
+ continue
+ try:
+ param_supported = bertos_utils.isSupported(self.project, property_id=(configuration, property))
+ except SupportedException, e:
+ self.exceptionOccurred(self.tr("Error evaluating \"%1\" for parameter %2").arg(e.support_string).arg(property))
+ 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.setFlags(item.flags() & ~Qt.ItemIsSelectable)
+ tooltip = property
+ description = configurations[property].get("description", None)
+ if description:
+ tooltip = tooltip + ": " + description
+ item.setToolTip(tooltip)
+ item.setData(Qt.UserRole, qvariant_converter.convertString(property))
+ self.pageContent.propertyTable.setItem(index, 0, item)
+ if "type" in configurations[property]["informations"] and configurations[property]["informations"]["type"] == "boolean":
+ self.insertCheckBox(index, configurations[property]["value"])
+ elif "type" in configurations[property]["informations"] 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"])
+ elif "type" in configurations[property]["informations"] and configurations[property]["informations"]["type"] == "hex":
+ self.insertLineEdit(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
+ if self.pageContent.propertyTable.rowCount() == 0:
+ module_label = self.pageContent.moduleLabel.text()
+ module_label += "\n\nNo configuration needed."
+ self.pageContent.moduleLabel.setText(module_label)
+ else:
+ self.pageContent.moduleLabel.setText("")
+ self.pageContent.moduleLabel.setVisible(False)
+ self.pageContent.propertyTable.clear()
+ self.pageContent.propertyTable.setRowCount(0)
+
+ def dependencyCheck(self, item):
+ """
+ Checks the dependencies of the module associated with the given item.
+ """
+ checked = False
+ module = unicode(item.text(0))
+ if item.checkState(0) == Qt.Checked:
+ self.moduleSelected(module)
+ else:
+ self.moduleUnselected(module)
+ self.removeFileDependencies(module)
+
+ def showPropertyDescription(self):
+ """
+ Slot called when the property selection changes. Shows the description
+ of the selected property.
+ """
+ self.resetPropertyDescription()
+ configurations = self.currentModuleConfigurations()
+ if self.currentProperty() in configurations:
+ description = configurations[self.currentProperty()]["brief"]
+ name = self.currentProperty()
+ self.currentPropertyItem().setText(description + "\n" + name)
+
+ def saveValue(self, index):
+ """
+ Slot called when the user modifies one of the configuration parameters.
+ It stores the new value."""