From a861d8e4e8a484679865bf5cd4e26954f76452da Mon Sep 17 00:00:00 2001 From: duplo Date: Mon, 31 Aug 2009 08:52:42 +0000 Subject: [PATCH] Add stub of sources merge functionality git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2823 38d2e660-2303-0410-9eaa-f027e97ec537 --- wizard/BEditingDialog.py | 17 +++++++++++++++-- wizard/BToolchainPage.py | 4 +++- wizard/BVersionPage.py | 3 ++- wizard/bertos_utils.py | 7 +++---- 4 files changed, 23 insertions(+), 8 deletions(-) diff --git a/wizard/BEditingDialog.py b/wizard/BEditingDialog.py index 6ed7e621..d9b4d1bd 100644 --- a/wizard/BEditingDialog.py +++ b/wizard/BEditingDialog.py @@ -101,7 +101,9 @@ class BEditingDialog(QDialog): layout.addLayout(button_layout) dialog.setLayout(layout) dialog.connect(ok_button, SIGNAL("clicked()"), dialog.accept) - dialog.exec_() + if dialog.exec_(): + toolchain = qvariant_converter.getStringDict(toolchain_page.currentItem().data(Qt.UserRole)) + toolchain_page.setProjectInfo("TOOLCHAIN", toolchain) def changeBertosVersion(self): dialog = QDialog() @@ -119,7 +121,18 @@ class BEditingDialog(QDialog): layout.addLayout(button_layout) dialog.setLayout(layout) dialog.connect(ok_button, SIGNAL("clicked()"), dialog.accept) - dialog.exec_() + current_version = version_page.projectInfo("SOURCES_PATH") + 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: + version_page.setProjectInfo("SOURCES_PATH", version) + version_page.setProjectInfo("OLD_SOURCES_PATH", current_version) def apply(self): createBertosProject(self.module_page.project(), edit=True) diff --git a/wizard/BToolchainPage.py b/wizard/BToolchainPage.py index f85dbb1f..24105c19 100644 --- a/wizard/BToolchainPage.py +++ b/wizard/BToolchainPage.py @@ -288,4 +288,6 @@ class BToolchainPage(BWizardPage): Enable the remove button. """ self.pageContent.removeButton.setEnabled(True) - \ No newline at end of file + + def currentItem(self): + return self.pageContent.toolchainList.currentItem() diff --git a/wizard/BVersionPage.py b/wizard/BVersionPage.py index ded8395e..c12bd6b7 100644 --- a/wizard/BVersionPage.py +++ b/wizard/BVersionPage.py @@ -250,4 +250,5 @@ class BVersionPage(BWizardPage): import winreg_importer if version in winreg_importer.getBertosDirs(): return True - return False \ No newline at end of file + return False + diff --git a/wizard/bertos_utils.py b/wizard/bertos_utils.py index f67da76a..463051e6 100644 --- a/wizard/bertos_utils.py +++ b/wizard/bertos_utils.py @@ -110,6 +110,7 @@ def projectFileGenerator(project_info): def createBertosProject(project_info, edit=False): directory = project_info.info("PROJECT_PATH") sources_dir = project_info.info("SOURCES_PATH") + old_sources_dir = project_info.info("OLD_SOURCES_PATH") if not edit: if os.path.isdir(directory): shutil.rmtree(directory, True) @@ -124,13 +125,11 @@ def createBertosProject(project_info, edit=False): # If not in editing mode it copies all the bertos sources in the /bertos subdirectory of the project shutil.rmtree(srcdir, True) copytree.copytree(sources_dir + "/bertos", srcdir, ignore_list=const.IGNORE_LIST) - else: + elif old_sources_dir: # If in editing mode it merges the current bertos sources with the selected ones # TODO: implement the three way merge algotihm # - # mergeSources(srcdir, sources_dir, old_sources_dir) - # - pass + mergeSources(srcdir, sources_dir, old_sources_dir) # Destination makefile makefile = directory + "/Makefile" makefile = open("mktemplates/Makefile").read() -- 2.25.1