+ 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."""
+ property = qvariant_converter.getString(self.pageContent.propertyTable.item(index, 0).data(Qt.UserRole))
+ configuration = self.projectInfo("MODULES")[self.currentModule()]["configuration"]
+ configurations = self.projectInfo("CONFIGURATIONS")
+ if "type" not in configurations[configuration][property]["informations"] or configurations[configuration][property]["informations"]["type"] == "int":
+ configurations[configuration][property]["value"] = unicode(int(self.pageContent.propertyTable.cellWidget(index, 1).value()))
+ elif configurations[configuration][property]["informations"]["type"] == "enum":
+ configurations[configuration][property]["value"] = unicode(self.pageContent.propertyTable.cellWidget(index, 1).currentText())
+ elif configurations[configuration][property]["informations"]["type"] == "boolean":
+ if self.pageContent.propertyTable.cellWidget(index, 1).isChecked():
+ configurations[configuration][property]["value"] = "1"
+ else:
+ configurations[configuration][property]["value"] = "0"
+ elif configurations[configuration][property]["informations"]["type"] == "hex":
+ configurations[configuration][property]["value"] = unicode(self.pageContent.propertyTable.cellWidget(index, 1).text())
+ self.setProjectInfo("CONFIGURATIONS", configurations)
+ if self.moduleItem(self.currentModule()).checkState(0) == Qt.Checked:
+ self.dependencyCheck(self.moduleItem(self.currentModule()))
+
+ ####
+
+ def loadModuleData(self):
+ """
+ Loads the module data.
+ """
+ # Do not load the module data again when the Wizard is in editing mode
+ # or when it's working on a preset.
+ if not self.project.edit and not self.project.from_preset:
+ # Load the module data every time so that if the user changed the cpu
+ # the right configurations are picked up.
+ try:
+ self.project.loadModuleData()
+ except ModuleDefineException, e:
+ self.exceptionOccurred(self.tr("Error parsing line '%2' in file %1").arg(e.path).arg(e.line))
+ except EnumDefineException, e:
+ self.exceptionOccurred(self.tr("Error parsing line '%2' in file %1").arg(e.path).arg(e.line))
+ except ConfigurationDefineException, e:
+ self.exceptionOccurred(self.tr("Error parsing line '%2' in file %1").arg(e.path).arg(e.line))
+
+ def fillModuleTree(self):
+ """
+ Fills the module tree with the module entries separated in categories.
+ """
+ self.pageContent.moduleTree.clear()
+ modules = self.projectInfo("MODULES")
+ if not modules:
+ return
+ categories = {}
+ for module, information in modules.items():
+ if information["category"] not in categories:
+ categories[information["category"]] = []
+ categories[information["category"]].append(module)
+ for category, module_list in categories.items():
+ item = QTreeWidgetItem(QStringList([category]))
+ for module in module_list:
+ enabled = modules[module]["enabled"]
+ module_item = QTreeWidgetItem(item, QStringList([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
+ if not supported:
+ module_item.setForeground(0, QBrush(QColor(Qt.red)))
+ if enabled:
+ module_item.setCheckState(0, Qt.Checked)