Fixing semantics
authorlaurent
Mon, 21 May 2012 18:49:49 +0200
changeset 691 361389f3ad2b
parent 690 a32548167224
child 692 e00ce7077bfc
Fixing semantics
PLCOpenEditor.py
--- a/PLCOpenEditor.py	Mon May 21 11:00:40 2012 +0200
+++ b/PLCOpenEditor.py	Mon May 21 18:49:49 2012 +0200
@@ -300,7 +300,7 @@
     TAB_BORDER = 7
     NOTEBOOK_BORDER = 2
 
-def SimplifyTabOrganization(tabs, rect):
+def SimplifyTabLayout(tabs, rect):
     for tab in tabs:
         if tab["pos"][0] == rect.x:
             others = [t for t in tabs if t != tab]
@@ -333,7 +333,7 @@
                         return True
     return False
     
-def ComputeTabsOrganization(tabs, rect):
+def ComputeTabsLayout(tabs, rect):
     if len(tabs) == 0:
         return tabs
     if len(tabs) == 1:
@@ -366,10 +366,10 @@
         split_tab = tabs.pop(idx)
         return {"split": split,
                 "tab": split_tab, 
-                "others": ComputeTabsOrganization(tabs, split_rect)}
+                "others": ComputeTabsLayout(tabs, split_rect)}
     else:
-        if SimplifyTabOrganization(tabs, rect):
-            return ComputeTabsOrganization(tabs, rect)
+        if SimplifyTabLayout(tabs, rect):
+            return ComputeTabsLayout(tabs, rect)
     return tabs
 
 #-------------------------------------------------------------------------------
@@ -770,7 +770,7 @@
 
     def OnResize(self, event):
         if self.Starting:
-            self.RestoreLastOrganization()
+            self.RestoreLastLayout()
             if wx.Platform == '__WXMSW__':
                 wx.CallAfter(self.ResetStarting)
             else:
@@ -819,7 +819,7 @@
                     return ("main", page_name)
         return None
     
-    def SaveTabOrganization(self, notebook):
+    def SaveTabLayout(self, notebook):
         tabs = []
         for child in notebook.GetChildren():
             if isinstance(child, wx.aui.AuiTabCtrl):
@@ -836,7 +836,7 @@
                 tabs.append(tab)
         tabs.sort(lambda x, y: cmp(x["pos"], y["pos"]))
         size = notebook.GetSize()
-        return ComputeTabsOrganization(tabs, wx.Rect(1, 1, size[0] - NOTEBOOK_BORDER, size[1] - NOTEBOOK_BORDER))
+        return ComputeTabsLayout(tabs, wx.Rect(1, 1, size[0] - NOTEBOOK_BORDER, size[1] - NOTEBOOK_BORDER))
     
     def LoadTab(self, notebook, page_infos):
         if page_infos[0] == "main":
@@ -858,19 +858,19 @@
                 return notebook.GetPageIndex(self.OpenDebugViewer(instance_infos["class"], instance_path, instance_infos["type"]))
         return None
             
-    def LoadTabOrganization(self, notebook, tabs, mode="all", first_index=None):
+    def LoadTabLayout(self, notebook, tabs, mode="all", first_index=None):
         if isinstance(tabs, ListType):
             if len(tabs) == 0:
                 return
             raise ValueError, "Not supported"
         
         if tabs.has_key("split"):
-            self.LoadTabOrganization(notebook, tabs["others"])
+            self.LoadTabLayout(notebook, tabs["others"])
             
             split_dir, split_ratio = tabs["split"]
-            first_index = self.LoadTabOrganization(notebook, tabs["tab"], mode="first")
+            first_index = self.LoadTabLayout(notebook, tabs["tab"], mode="first")
             notebook.Split(first_index, split_dir)
-            self.LoadTabOrganization(notebook, tabs["tab"], mode="others", first_index=first_index)
+            self.LoadTabLayout(notebook, tabs["tab"], mode="others", first_index=first_index)
             
         elif mode == "first":
             return self.LoadTab(notebook, tabs["pages"][0][0])
@@ -899,7 +899,7 @@
             for notebook, entry_name in [(self.LeftNoteBook, "leftnotebook"),
                                          (self.BottomNoteBook, "bottomnotebook"),
                                          (self.RightNoteBook, "rightnotebook")]:
-                self.LoadTabOrganization(notebook, notebooks.get(entry_name))
+                self.LoadTabLayout(notebook, notebooks.get(entry_name))
     
     def RestoreLastState(self):
         frame_size = None
@@ -912,12 +912,12 @@
         else:
             self.SetClientSize(frame_size)
         
-    def RestoreLastOrganization(self):
+    def RestoreLastLayout(self):
         notebooks = {}
         for notebook, entry_name in [(self.LeftNoteBook, "leftnotebook"),
                                      (self.BottomNoteBook, "bottomnotebook"),
                                      (self.RightNoteBook, "rightnotebook")]:
-            notebooks[entry_name] = self.SaveTabOrganization(notebook)
+            notebooks[entry_name] = self.SaveTabLayout(notebook)
         self.DefaultPerspective = {
             "perspective": self.AUIManager.SavePerspective(),
             "notebooks": notebooks,
@@ -937,11 +937,11 @@
                 for notebook, entry_name in [(self.LeftNoteBook, "leftnotebook"),
                                              (self.BottomNoteBook, "bottomnotebook"),
                                              (self.RightNoteBook, "rightnotebook")]:
-                    self.LoadTabOrganization(notebook, notebooks.get(entry_name))
+                    self.LoadTabLayout(notebook, notebooks.get(entry_name))
         except:
             self.ResetPerspective()
         
-        self.LoadProjectOrganization()
+        self.LoadProjectLayout()
     
     def SaveLastState(self):
         if not self.IsMaximized():
@@ -953,19 +953,19 @@
         for notebook, entry_name in [(self.LeftNoteBook, "leftnotebook"),
                                      (self.BottomNoteBook, "bottomnotebook"),
                                      (self.RightNoteBook, "rightnotebook")]:
-            notebooks[entry_name] = self.SaveTabOrganization(notebook)
+            notebooks[entry_name] = self.SaveTabLayout(notebook)
         self.Config.Write("notebooks", cPickle.dumps(notebooks))
         
         self.Config.Write("perspective", self.AUIManager.SavePerspective())
     
-        self.SaveProjectOrganization()
+        self.SaveProjectLayout()
         
         for i in xrange(self.TabsOpened.GetPageCount()):
             self.SavePageState(self.TabsOpened.GetPage(i))
         
         self.Config.Flush()
 
-    def SaveProjectOrganization(self):
+    def SaveProjectLayout(self):
         if self.Controler is not None:
             tabs = []
             
@@ -977,20 +977,20 @@
             	pass
             
             project_infos = projects.setdefault(os.path.realpath(self.Controler.GetFilePath()), {})
-            project_infos["tabs"] = self.SaveTabOrganization(self.TabsOpened)
+            project_infos["tabs"] = self.SaveTabLayout(self.TabsOpened)
             if self.EnableDebug:
                 project_infos["debug_vars"] = self.DebugVariablePanel.GetDebugVariables()
             
             self.Config.Write("projects", cPickle.dumps(projects))
             self.Config.Flush()
     
-    def LoadProjectOrganization(self):
+    def LoadProjectLayout(self):
         if self.Controler is not None:
             project = self.GetProjectConfiguration()
 		    
             try:
                 if project.has_key("tabs"):
-                    self.LoadTabOrganization(self.TabsOpened, project["tabs"])
+                    self.LoadTabLayout(self.TabsOpened, project["tabs"])
             except:
             	self.DeleteAllPages()
             	
@@ -2812,7 +2812,7 @@
                     self.LibraryPanel.SetControler(controler)
                     self.ProjectTree.Enable(True)
                     self.PouInstanceVariablesPanel.SetController(controler)
-                    self.LoadProjectOrganization()
+                    self.LoadProjectLayout()
                     self._Refresh(PROJECTTREE, LIBRARYTREE)
             self._Refresh(TITLE, EDITORTOOLBAR, FILEMENU, EDITMENU)
         dialog.Destroy()
@@ -2823,7 +2823,7 @@
     def OnCloseProjectMenu(self, event):
         if not self.CheckSaveBeforeClosing():
             return
-        self.SaveProjectOrganization()
+        self.SaveProjectLayout()
         self.ResetView()
         self._Refresh(TITLE, EDITORTOOLBAR, FILEMENU, EDITMENU)