- def _showPropertyDescription(self):
- self._resetPropertyDescription()
- configurations = self._currentModuleConfigurations()
- if self._currentProperty() in configurations.keys():
- description = configurations[self._currentProperty()]["description"]
- name = self._currentProperty()
- self._currentPropertyItem().setText(name + "\n" + description)
-
- def _setupUi(self):
- self.pageContent.moduleTable.horizontalHeader().setResizeMode(QHeaderView.ResizeToContents)
- self.pageContent.moduleTable.horizontalHeader().setStretchLastSection(True)
- self.pageContent.moduleTable.horizontalHeader().setVisible(False)
- self.pageContent.moduleTable.verticalHeader().setResizeMode(QHeaderView.ResizeToContents)
- self.pageContent.moduleTable.verticalHeader().setVisible(False)
- self.pageContent.moduleTable.setColumnCount(2)
- self.pageContent.moduleTable.setRowCount(0)
- 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.moduleTable, SIGNAL("itemSelectionChanged()"), self._fillPropertyTable)
- self.connect(self.pageContent.propertyTable, SIGNAL("itemSelectionChanged()"), self._showPropertyDescription)
- self.connect(self._controlGroup, 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._buttonGroup.button(index).isChecked():
- self._moduleSelected(module)
- else:
- self._moduleUnselected(module)
-
- def _moduleSelected(self, selectedModule):
- modules = self._projectInfoRetrieve("MODULES")
- modules[selectedModule]["enabled"] = True
- self._projectInfoStore("MODULES", modules)
- depends = self._projectInfoRetrieve("MODULES")[selectedModule]["depends"]
- unsatisfied = self.selectDependencyCheck(selectedModule)
- if len(unsatisfied) > 0:
- message = self.tr("The module %1 needs the following modules:\n%2.\n\nDo you want to resolve automatically the problem?")
- message = message.arg(selectedModule).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: