- 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)
-
- def _moduleUnselected(self, unselectedModule):
- modules = self._projectInfoRetrieve("MODULES")
- modules[unselectedModule]["enabled"] = False
- self._projectInfoStore("MODULES", modules)
- unsatisfied = []
- if self.pageContent.automaticFix.isChecked():
- unsatisfied = self.unselectDependencyCheck(unselectedModule)
- if len(unsatisfied) > 0:
- message = self.tr("The module %1 is needed by the following modules:\n%2.\n\nDo you want to remove these modules too?")
- message = message.arg(unselectedModule).arg(", ".join(unsatisfied))
- choice = QMessageBox.warning(self, self.tr("Dependency error"), message, QMessageBox.Yes | QMessageBox.No, QMessageBox.Yes)
- if choice == QMessageBox.Yes:
+ def setBold(self, item, bold):
+ self.pageContent.moduleTree.blockSignals(True)
+ font = item.font(0)
+ font.setBold(bold)
+ item.setFont(0, font)
+ self.pageContent.moduleTree.blockSignals(False)
+
+ def isBold(self, item):
+ return item.font(0).bold()
+
+ def moduleSelected(self, selectedModule):
+ """
+ Resolves the selection dependencies.
+ """
+ try:
+ qApp.setOverrideCursor(Qt.WaitCursor)
+ modules = self.projectInfo("MODULES")
+ modules[selectedModule]["enabled"] = True
+ self.setProjectInfo("MODULES", modules)
+ depends = self.projectInfo("MODULES")[selectedModule]["depends"]
+ unsatisfied = []
+ if self.pageContent.automaticFix.isChecked():
+ unsatisfied = self.selectDependencyCheck(selectedModule)
+ if len(unsatisfied) > 0: