Add support for hiding Editor toolbar when not needed
authorLaurent Bessard
Sun, 10 Jun 2012 20:21:07 +0200
changeset 708 cf8f5749558d
parent 707 e850bc674852
child 709 2507f2736a3e
Add support for hiding Editor toolbar when not needed
PLCOpenEditor.py
--- a/PLCOpenEditor.py	Fri Jun 08 12:36:24 2012 +0200
+++ b/PLCOpenEditor.py	Sun Jun 10 20:21:07 2012 +0200
@@ -1511,8 +1511,9 @@
                     self.EnsureTabVisible(self.DebugVariablePanel)
                     wx.CallAfter(self.PouInstanceVariablesPanel.SetPouType, tagname, instance_path)
             wx.CallAfter(self._Refresh, FILEMENU, EDITMENU, DISPLAYMENU, EDITORTOOLBAR)
-        event.Skip()
-
+        else:
+            event.Skip()
+        
     def RefreshEditor(self):
         selected = self.TabsOpened.GetSelection()
         if selected >= 0:
@@ -2179,6 +2180,7 @@
         if EditorToolBar:
             EditorToolBar.Realize()
             self.AUIManager.GetPane("EditorToolBar").BestSize(EditorToolBar.GetBestSize())
+            self.AUIManager.GetPane("EditorToolBar").Hide()
             self.AUIManager.Update()
 
     def RefreshEditorToolBar(self):
@@ -2186,10 +2188,11 @@
         menu = None
         if selected != -1:
             window = self.TabsOpened.GetPage(selected)
-            if not window.IsDebugging():
-                menu = self.Controler.GetEditedElementBodyType(window.GetTagName())
-            else:
-                menu = "debug"
+            if isinstance(window, (Viewer, TextViewer, GraphicViewer)):
+                if not window.IsDebugging():
+                    menu = self.Controler.GetEditedElementBodyType(window.GetTagName())
+                else:
+                    menu = "debug"
         if menu is not None and menu != self.CurrentMenu:
             self.ResetEditorToolBar()
             self.CurrentMenu = menu
@@ -2206,8 +2209,9 @@
                         self.CurrentEditorToolBar.append(id)
                 EditorToolBar.Realize()
                 self.AUIManager.GetPane("EditorToolBar").BestSize(EditorToolBar.GetBestSize())
+                self.AUIManager.GetPane("EditorToolBar").Show()
                 self.AUIManager.Update()
-        elif not menu:
+        elif menu is None:
             self.ResetEditorToolBar()
             self.CurrentMenu = menu
         self.ResetCurrentMode()