X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=wizard%2FBEditingDialog.py;h=4fae34231e1bc1557158bcde35dcb875a91a86a9;hb=eea2624b23b44f93fb894a4c98689c683c3d60d9;hp=7b7589e6756aaf734dae343274657d2d71afd400;hpb=efa322fd22f708abb3cb46c750908b065ba6290e;p=bertos.git diff --git a/wizard/BEditingDialog.py b/wizard/BEditingDialog.py index 7b7589e6..4fae3423 100644 --- a/wizard/BEditingDialog.py +++ b/wizard/BEditingDialog.py @@ -115,38 +115,38 @@ class BEditingDialog(QDialog): dialog.toolchain_page.setProjectInfo("TOOLCHAIN", toolchain) def changeBertosVersion(self): + current_version = self.module_page.projectInfo("SOURCES_PATH") dialog = BVersionDialog() if dialog.exec_(): - version = qvariant_converter.getString(version_page.currentItem().data(Qt.UserRole)) - if version != current_version: - if QMessageBox.question( - version_page, - self.tr("BeRTOS version update"), - self.tr("Changing the BeRTOS version will destroy all the modification done on the BeRTOS sources"), - QMessageBox.Ok | QMessageBox.Cancel - ) == QMessageBox.Ok: - qApp.setOverrideCursor(QCursor(Qt.WaitCursor)) - version_page.setProjectInfo("SOURCES_PATH", version) - version_page.setProjectInfo("OLD_SOURCES_PATH", current_version) - enabled_modules = bertos_utils.enabledModules(version_page.project()) - old_configuration = version_page.projectInfo("CONFIGURATIONS") - bertos_utils.loadSourceTree(version_page.project()) - bertos_utils.loadModuleData(version_page.project()) - new_configuration = version_page.projectInfo("CONFIGURATIONS") - merged_configuration = {} - for conf in new_configuration: - if conf in old_configuration: - configuration = bertos_utils.updateConfigurationValues(new_configuration[conf], old_configuration[conf]) - else: - configuration = new_configuration[conf] - merged_configuration[conf] = configuration - version_page.setProjectInfo("CONFIGURATIONS", merged_configuration) - bertos_utils.setEnabledModules(version_page.project(), enabled_modules) - self.module_page.fillModuleTree() - qApp.restoreOverrideCursor() - else: - # Rollback version to the previous selected one. - version_page.setProjectInfo("SOURCES_PATH", current_version) + version = qvariant_converter.getString(dialog.version_page.currentItem().data(Qt.UserRole)) + if QMessageBox.question( + dialog.version_page, + self.tr("BeRTOS version update"), + self.tr("Changing the BeRTOS version will destroy all the modification done on the BeRTOS sources"), + QMessageBox.Ok | QMessageBox.Cancel + ) == QMessageBox.Ok: + qApp.setOverrideCursor(QCursor(Qt.WaitCursor)) + dialog.version_page.setProjectInfo("SOURCES_PATH", version) + dialog.version_page.setProjectInfo("OLD_SOURCES_PATH", current_version) + enabled_modules = bertos_utils.enabledModules(dialog.version_page.project()) + old_configuration = dialog.version_page.projectInfo("CONFIGURATIONS") + bertos_utils.loadSourceTree(dialog.version_page.project()) + bertos_utils.loadModuleData(dialog.version_page.project()) + new_configuration = dialog.version_page.projectInfo("CONFIGURATIONS") + merged_configuration = {} + for conf in new_configuration: + if conf in old_configuration: + configuration = bertos_utils.updateConfigurationValues(new_configuration[conf], old_configuration[conf]) + else: + configuration = new_configuration[conf] + merged_configuration[conf] = configuration + dialog.version_page.setProjectInfo("CONFIGURATIONS", merged_configuration) + bertos_utils.setEnabledModules(dialog.version_page.project(), enabled_modules) + self.module_page.fillModuleTree() + qApp.restoreOverrideCursor() + else: + # Rollback version to the previous selected one. + dialog.version_page.setProjectInfo("SOURCES_PATH", current_version) def apply(self): qApp.setOverrideCursor(QCursor(Qt.WaitCursor))