- self.pageContent.propertyTable.item(index, 0).setText(self._currentModuleConfigurations()[property_name]['brief'])
-
- 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.keys():
- description = configurations[self._currentProperty()]["brief"]
- name = self._currentProperty()
- self._currentPropertyItem().setText(description + "\n" + name)
-
- def _setupUi(self):
- """
- Set up the user interface.
- """
- self.pageContent.moduleTree.clear()
- self.pageContent.moduleTree.setHeaderHidden(True)
- self.pageContent.propertyTable.horizontalHeader().setResizeMode(QHeaderView.Stretch)
- self.pageContent.propertyTable.horizontalHeader().setVisible(False)
- self.pageContent.propertyTable.verticalHeader().setResizeMode(QHeaderView.ResizeToContents)
- self.pageContent.propertyTable.verticalHeader().setVisible(False)
- self.pageContent.propertyTable.setColumnCount(2)
- self.pageContent.propertyTable.setRowCount(0)
- self.pageContent.moduleLabel.setVisible(False)
-
- def _connectSignals(self):
- """
- Connect the signals with the related slots.
- """
- self.connect(self.pageContent.moduleTree, SIGNAL("itemPressed(QTreeWidgetItem*, int)"), self._fillPropertyTable)
- self.connect(self.pageContent.moduleTree, SIGNAL("itemChanged(QTreeWidgetItem*, int)"), self._dependencyCheck)
- self.connect(self.pageContent.propertyTable, SIGNAL("itemSelectionChanged()"), self._showPropertyDescription)
- self.connect(self._control_group, SIGNAL("stateChanged"), self._saveValue)
-
- 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._projectInfoRetrieve("MODULES")[self._currentModule()]["configuration"]
- configurations = self._projectInfoRetrieve("CONFIGURATIONS")
- if "type" not in configurations[configuration][property]["informations"].keys() or configurations[configuration][property]["informations"]["type"] == "int":
- configurations[configuration][property]["value"] = str(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"
- self._projectInfoStore("CONFIGURATIONS", configurations)
-
- def _moduleSelectionChanged(self, index):
- """
- Slot called when the user selects or unselects a module from the module
- tree.
- """
- module = unicode(self.pageContent.moduleTable.item(index, 1).text())
- if self._button_group.button(index).isChecked():
- self._moduleSelected(module)
- else:
- self._moduleUnselected(module)
-
- 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)