From: duplo Date: Mon, 26 Jan 2009 12:25:05 +0000 (+0000) Subject: Add automatic correction of dependencies X-Git-Tag: 2.1.0~459 X-Git-Url: https://codewiz.org/gitweb?a=commitdiff_plain;h=30c78a97f5d3e99d02d90d766956e36f8ff517f6;p=bertos.git Add automatic correction of dependencies git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2223 38d2e660-2303-0410-9eaa-f027e97ec537 --- diff --git a/wizard/BModulePage.py b/wizard/BModulePage.py index 3c32a44f..48ad0892 100644 --- a/wizard/BModulePage.py +++ b/wizard/BModulePage.py @@ -156,7 +156,14 @@ class BModulePage(BWizardPage): 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)) - QMessageBox.warning(self, self.tr("Dependency error"), message, QMessageBox.Yes | QMessageBox.No, QMessageBox.Yes) + choice = QMessageBox.warning(self, self.tr("Dependency error"), message, QMessageBox.Yes | QMessageBox.No, QMessageBox.Yes) + if choice == QMessageBox.Yes: + for module in unsatisfied: + modules = self._projectInfoRetrieve("MODULES") + modules[module]["enabled"] = True + for index in range(self.pageContent.moduleTable.rowCount()): + if unicode(self.pageContent.moduleTable.item(index, 1).text()) in unsatisfied: + self._buttonGroup.button(index).setChecked(True) def _moduleUnselected(self, unselectedModule): modules = self._projectInfoRetrieve("MODULES") @@ -166,7 +173,15 @@ class BModulePage(BWizardPage): if len(unsatisfied) > 0: message = self.tr("The module %1 is needed by the following modules:\n%2.\n\nDo you want to resolve automatically the problem?") message = message.arg(unselectedModule).arg(", ".join(unsatisfied)) - QMessageBox.warning(self, self.tr("Dependency error"), message, QMessageBox.Yes | QMessageBox.No, QMessageBox.Yes) + choice = QMessageBox.warning(self, self.tr("Dependency error"), message, QMessageBox.Yes | QMessageBox.No, QMessageBox.Yes) + if choice == QMessageBox.Yes: + for module in unsatisfied: + modules = self._projectInfoRetrieve("MODULES") + modules[module]["enabled"] = False + for index in range(self.pageContent.moduleTable.rowCount()): + if unicode(self.pageContent.moduleTable.item(index, 1).text()) in unsatisfied: + self._buttonGroup.button(index).setChecked(False) + def selectDependencyCheck(self, module): unsatisfied = set()