Fixed Save As... function in Beremiz
authorLaurent Bessard
Wed, 24 Apr 2013 17:27:31 +0200
changeset 2133 ba0b2ca7db26
parent 2132 9f5e4dc43053
child 2134 6f4b08348a60
Fixed Save As... function in Beremiz
etherlab/EthercatMaster.py
etherlab/etherlab.py
--- a/etherlab/EthercatMaster.py	Mon Apr 22 23:54:22 2013 +0200
+++ b/etherlab/EthercatMaster.py	Wed Apr 24 17:27:31 2013 +0200
@@ -636,7 +636,7 @@
     def CTNTestModified(self):
         return self.ChangesToSave or not self.ModelIsSaved()    
 
-    def OnCTNSave(self):
+    def OnCTNSave(self, from_project_path=None):
         config_filepath = self.ConfigFileName()
         
         config_text = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"no\"?>\n"
--- a/etherlab/etherlab.py	Mon Apr 22 23:54:22 2013 +0200
+++ b/etherlab/etherlab.py	Wed Apr 24 17:27:31 2013 +0200
@@ -429,8 +429,16 @@
         self.ModulesLibrary = None
         self.LoadModulesLibrary()
     
-    def GetModulesLibraryPath(self):
-        return os.path.join(self.CTNPath(), "modules") 
+    def GetModulesLibraryPath(self, project_path=None):
+        if project_path is None:
+            project_path = self.CTNPath()
+        return os.path.join(project_path, "modules") 
+    
+    def OnCTNSave(self, from_project_path=None):
+        if from_project_path is not None:
+            shutil.copytree(self.GetModulesLibraryPath(from_project_path),
+                            self.GetModulesLibraryPath())
+        return True
     
     def CTNGenerate_C(self, buildpath, locations):
         return [],"",False