Disabled project layout saving and restoring
authorLaurent Bessard
Sun, 10 Mar 2013 20:29:55 +0100
changeset 970 0dd89c8eeef5
parent 969 1950fe687dde
child 971 c4550f76ae05
child 973 211e78636b6b
Disabled project layout saving and restoring
Beremiz.py
IDEFrame.py
--- a/Beremiz.py	Fri Mar 08 00:15:28 2013 +0100
+++ b/Beremiz.py	Sun Mar 10 20:29:55 2013 +0100
@@ -433,7 +433,8 @@
         if projectOpen is not None:
             projectOpen = DecodeFileSystemPath(projectOpen, False)
         
-        if ctr is None and projectOpen is None and self.Config.HasEntry("currenteditedproject"):
+        if (self.EnableSaveProjectState() and ctr is None and 
+            projectOpen is None and self.Config.HasEntry("currenteditedproject")):
             try:
                 projectOpen = DecodeFileSystemPath(self.Config.Read("currenteditedproject"))
                 if projectOpen == "":
--- a/IDEFrame.py	Fri Mar 08 00:15:28 2013 +0100
+++ b/IDEFrame.py	Sun Mar 10 20:29:55 2013 +0100
@@ -718,6 +718,9 @@
             self.RestoreLastLayout()
         event.Skip()
     
+    def EnableSaveProjectState(self):
+        return False
+    
     def GetProjectConfiguration(self):
         projects = {}
         try:
@@ -887,7 +890,8 @@
         except:
             self.ResetPerspective()
         
-        self.LoadProjectLayout()
+        if self.EnableSaveProjectState():
+            self.LoadProjectLayout()
         
         self._Refresh(EDITORTOOLBAR)
         
@@ -914,11 +918,12 @@
         if pane.IsMaximized():
             self.AUIManager.RestorePane(pane)
         self.Config.Write("perspective", self.AUIManager.SavePerspective())
-    
-        self.SaveProjectLayout()
-        
-        for i in xrange(self.TabsOpened.GetPageCount()):
-            self.SavePageState(self.TabsOpened.GetPage(i))
+        
+        if self.EnableSaveProjectState():
+            self.SaveProjectLayout()
+        
+            for i in xrange(self.TabsOpened.GetPageCount()):
+                self.SavePageState(self.TabsOpened.GetPage(i))
         
         self.Config.Flush()
 
@@ -993,7 +998,8 @@
             window = self.TabsOpened.GetPage(selected)
             
             if window.CheckSaveBeforeClosing():
-                self.SavePageState(window)
+                if self.EnableSaveProjectState():
+                    self.SavePageState(window)
                 
                 # Refresh all window elements that have changed
                 wx.CallAfter(self._Refresh, TITLE, EDITORTOOLBAR, FILEMENU, EDITMENU, DISPLAYMENU)
@@ -1855,14 +1861,15 @@
                     new_window.SetIcon(GetBitmap("DATATYPE"))
                     self.AddPage(new_window, "")
             if new_window is not None:
-                project_infos = self.GetProjectConfiguration()
-                if project_infos.has_key("editors_state"):
-                    if new_window.IsDebugging():
-                        state = project_infos["editors_state"].get(new_window.GetInstancePath())
-                    else:
-                        state = project_infos["editors_state"].get(tagname)
-                    if state is not None:
-                        wx.CallAfter(new_window.SetState, state)
+                if self.EnableSaveProjectState():
+                    project_infos = self.GetProjectConfiguration()
+                    if project_infos.has_key("editors_state"):
+                        if new_window.IsDebugging():
+                            state = project_infos["editors_state"].get(new_window.GetInstancePath())
+                        else:
+                            state = project_infos["editors_state"].get(tagname)
+                        if state is not None:
+                            wx.CallAfter(new_window.SetState, state)
                 
                 openedidx = self.IsOpened(tagname)
                 old_selected = self.TabsOpened.GetSelection()
@@ -2066,11 +2073,12 @@
                     icon = GetBitmap("ACTION", bodytype)
         
         if new_window is not None:
-            project_infos = self.GetProjectConfiguration()
-            if project_infos.has_key("editors_state"):
-                state = project_infos["editors_state"].get(instance_path)
-                if state is not None:
-                    wx.CallAfter(new_window.SetState, state)
+            if self.EnableSaveProjectState():
+                project_infos = self.GetProjectConfiguration()
+                if project_infos.has_key("editors_state"):
+                    state = project_infos["editors_state"].get(instance_path)
+                    if state is not None:
+                        wx.CallAfter(new_window.SetState, state)
             
             new_window.SetIcon(icon)
             self.AddPage(new_window, "")