- self.pageContent.propertyTable.item(index, 0).setText(self._currentModuleConfigurations()[property_name]['brief'])
-
- def _showPropertyDescription(self):
- 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):
- 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):
- 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):
- 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):
- 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):
- checked = False
- module = unicode(item.text(0))
- if item.checkState(0) == Qt.Checked:
- self._moduleSelected(module)
- else:
- self._moduleUnselected(module)
- self.removeFileDependencies(module)
-
- def _moduleSelected(self, selectedModule):
- modules = self._projectInfoRetrieve("MODULES")
- modules[selectedModule]["enabled"] = True
- self._projectInfoStore("MODULES", modules)
- depends = self._projectInfoRetrieve("MODULES")[selectedModule]["depends"]
- unsatisfied = []
- if self.pageContent.automaticFix.isChecked():
- unsatisfied = self.selectDependencyCheck(selectedModule)
- if len(unsatisfied) > 0:
- for module in unsatisfied:
- modules = self._projectInfoRetrieve("MODULES")
- modules[module]["enabled"] = True
- for category in range(self.pageContent.moduleTree.topLevelItemCount()):
- item = self.pageContent.moduleTree.topLevelItem(category)
- for child in range(item.childCount()):
- if unicode(item.child(child).text(0)) in unsatisfied:
- item.child(child).setCheckState(0, Qt.Checked)