Add stub of sources merge functionality
authorduplo <duplo@38d2e660-2303-0410-9eaa-f027e97ec537>
Mon, 31 Aug 2009 08:52:42 +0000 (08:52 +0000)
committerduplo <duplo@38d2e660-2303-0410-9eaa-f027e97ec537>
Mon, 31 Aug 2009 08:52:42 +0000 (08:52 +0000)
git-svn-id: https://src.develer.com/svnoss/bertos/trunk@2823 38d2e660-2303-0410-9eaa-f027e97ec537

wizard/BEditingDialog.py
wizard/BToolchainPage.py
wizard/BVersionPage.py
wizard/bertos_utils.py

index 6ed7e621c3fab625c664c3666fb58e2709a3aae7..d9b4d1bd33c86413e0a64638168b86dfc5d96f85 100644 (file)
@@ -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)
index f85dbb1f30c44b417d01fb7c8b88eda138e65c81..24105c196d50391811ff6570d6929417cd7c9476 100644 (file)
@@ -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()
index ded8395e7d2bced1569f85c288007116684f9ad3..c12bd6b7a93313dac6fb8c3daab735770f87d230 100644 (file)
@@ -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
+
index f67da76a2b2dcb0e14cdd3a25f5fc050c360b90d..463051e6165f4d560d36c94b45e4c044f7867684 100644 (file)
@@ -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()