Bug with maximize on Tab Double Click fixed
authorlbessard
Tue, 24 Mar 2009 17:31:11 +0100
changeset 337 388a00b05b6b
parent 336 80934ef1b1cd
child 338 87e5015330ae
Bug with maximize on Tab Double Click fixed
PLCOpenEditor.py
--- a/PLCOpenEditor.py	Tue Mar 24 10:50:49 2009 +0100
+++ b/PLCOpenEditor.py	Tue Mar 24 17:31:11 2009 +0100
@@ -752,7 +752,15 @@
             index = self.TabsImageList.Add(tmp_bitmap)
             self.TabsImageListIndexes[(icon1_name, icon2_name)] = index
             return index
-        
+    
+    def AddPage(self, window, text):
+        self.TabsOpened.AddPage(window, text)
+        if USE_AUI:
+            children = self.TabsOpened.GetChildren()
+            last_element = children[len(children) - 1]
+            if isinstance(last_element, wx.aui.AuiTabCtrl):
+                last_element.Bind(wx.EVT_LEFT_DCLICK, self.GetTabsOpenedDClickFunction(last_element))
+    
     def DeleteAllPages(self):
         if USE_AUI:
             for idx in xrange(self.TabsOpened.GetPageCount()):
@@ -1662,11 +1670,11 @@
         elif not onlyopened:
             if elementtype == ITEM_CONFIGURATION:
                 new_window = ConfigurationEditor(self.TabsOpened, tagname, self, self.Controler)
-                self.TabsOpened.AddPage(new_window, "")
+                self.AddPage(new_window, "")
                 self.VariablePanelIndexer.AddVariablePanel(tagname, "config")
             elif elementtype == ITEM_RESOURCE:
                 new_window = ResourceEditor(self.TabsOpened, tagname, self, self.Controler)
-                self.TabsOpened.AddPage(new_window, "")
+                self.AddPage(new_window, "")
                 self.VariablePanelIndexer.AddVariablePanel(tagname, "resource")
             elif elementtype in [ITEM_POU, ITEM_TRANSITION, ITEM_ACTION]:
                 bodytype = self.Controler.GetEditedElementBodyType(tagname, self.Debug)
@@ -1686,17 +1694,12 @@
                         new_window.SetKeywords(IL_KEYWORDS)
                     else:
                         new_window.SetKeywords(ST_KEYWORDS)
-                self.TabsOpened.AddPage(new_window, "")
+                self.AddPage(new_window, "")
                 words = tagname.split("::")
                 self.VariablePanelIndexer.AddVariablePanel(tagname, self.Controler.GetPouType(words[1], self.Debug))
             elif elementtype == ITEM_DATATYPE:
                 new_window = DataTypeEditor(self.TabsOpened, tagname, self, self.Controler)
-                self.TabsOpened.AddPage(new_window, "")
-            if wx.VERSION >= (2, 6, 0):
-                children = self.TabsOpened.GetChildren()
-                last_element = children[len(children) - 1]
-                if isinstance(last_element, wx.aui.AuiTabCtrl):
-                    last_element.Bind(wx.EVT_LEFT_DCLICK, self.GetTabsOpenedDClickFunction(last_element))  
+                self.AddPage(new_window, "")
             self.VariablePanelIndexer.ChangeVariablePanel(tagname)
             openedidx = self.IsOpened(tagname)
             old_selected = self.TabsOpened.GetSelection()
@@ -1919,12 +1922,7 @@
                         new_window.SetKeywords(IL_KEYWORDS)
                     else:
                         new_window.SetKeywords(ST_KEYWORDS)
-                self.TabsOpened.AddPage(new_window, "")
-                if wx.VERSION >= (2, 6, 0):
-                    children = self.TabsOpened.GetChildren()
-                    last_element = children[len(children) - 1]
-                    if isinstance(last_element, wx.aui.AuiTabCtrl):
-                        last_element.Bind(wx.EVT_LEFT_DCLICK, self.GetTabsOpenedDClickFunction(last_element))  
+                self.AddPage(new_window, "")
                 new_window.RefreshView()
                 new_window.SetFocus()
                 self.RefreshPageTitles()
@@ -1941,7 +1939,7 @@
                     parent_item = self.InstancesTree.GetItemParent(parent_item)
                 
                 new_window = GraphicViewer(self.TabsOpened, self, self.Controler, var_path)
-                self.TabsOpened.AddPage(new_window, "")
+                self.AddPage(new_window, "")
                 new_window.SetFocus()
                 self.RefreshPageTitles()
         event.Skip()
@@ -1976,7 +1974,7 @@
     def AddVariableGraphicFunction(self, iec_path):
         def AddVariableGraphic(event):
             new_window = GraphicViewer(self.TabsOpened, self, self.Controler, iec_path)
-            self.TabsOpened.AddPage(new_window, "")
+            self.AddPage(new_window, "")
             new_window.SetFocus()
             self.RefreshPageTitles()
             event.Skip()
@@ -2001,6 +1999,12 @@
                 item, root_cookie = self.InstancesTree.GetNextChild(root, root_cookie)
         return found
 
+    def ResetGraphicViewers(self):
+        for i in xrange(self.TabsOpened.GetPageCount()):
+            editor = self.TabsOpened.GetPage(i)
+            if isinstance(editor, GraphicViewer):
+                editor.ResetView()
+
 #-------------------------------------------------------------------------------
 #                         Library Tree Management Functions
 #-------------------------------------------------------------------------------