Merged in Surkovsv/beremiz (pull request #4)
authorAndrey Skvortsov <andrej.skvortzov@gmail.com>
Mon, 12 Sep 2016 16:46:09 +0300
changeset 1531 d2b3bbbb1028
parent 1529 0a131f6a4c86 (current diff)
parent 1530 24d8e8c233bd (diff)
child 1532 a191e137a5bb
Merged in Surkovsv/beremiz (pull request #4)

Add hotkey (F12) for switching perspective.
--- a/Beremiz.py	Mon Sep 12 10:15:39 2016 +0500
+++ b/Beremiz.py	Mon Sep 12 16:46:09 2016 +0300
@@ -393,6 +393,11 @@
         inspectorID = wx.NewId()
         self.Bind(wx.EVT_MENU, self.OnOpenWidgetInspector, id=inspectorID)
         accels = [wx.AcceleratorEntry(wx.ACCEL_CTRL|wx.ACCEL_ALT, ord('I'), inspectorID)]
+
+        keyID = wx.NewId()
+        self.Bind(wx.EVT_MENU, self.SwitchFullScrMode, id=keyID)
+        accels += [wx.AcceleratorEntry(wx.ACCEL_NORMAL, wx.WXK_F12, keyID)]
+
         for method,shortcut in [("Stop",     wx.WXK_F4),
                                 ("Run",      wx.WXK_F5),
                                 ("Transfer", wx.WXK_F6),
--- a/IDEFrame.py	Mon Sep 12 10:15:39 2016 +0500
+++ b/IDEFrame.py	Mon Sep 12 16:46:09 2016 +0300
@@ -64,7 +64,8 @@
 
 # Define PLCOpenEditor DisplayMenu extra items id
 [ID_PLCOPENEDITORDISPLAYMENURESETPERSPECTIVE,
-] = [wx.NewId() for _init_coll_DisplayMenu_Items in range(1)]
+ ID_PLCOPENEDITORDISPLAYMENUSWITCHPERSPECTIVE,
+] = [wx.NewId() for _init_coll_DisplayMenu_Items in range(2)]
 
 #-------------------------------------------------------------------------------
 #                            EditorToolBar definitions
@@ -442,6 +443,10 @@
             self.Bind(wx.EVT_MENU, self.GenerateZoomFunction(idx), id=new_id)
 
         parent.AppendSeparator()
+        AppendMenu(parent, help='', id=ID_PLCOPENEDITORDISPLAYMENUSWITCHPERSPECTIVE,
+                   kind=wx.ITEM_NORMAL, text=_(u'Switch perspective') + '\tF12')
+        self.Bind(wx.EVT_MENU, self.SwitchFullScrMode, id=ID_PLCOPENEDITORDISPLAYMENUSWITCHPERSPECTIVE)
+
         AppendMenu(parent, help='', id=ID_PLCOPENEDITORDISPLAYMENURESETPERSPECTIVE,
               kind=wx.ITEM_NORMAL, text=_(u'Reset Perspective'))
         self.Bind(wx.EVT_MENU, self.OnResetPerspective, id=ID_PLCOPENEDITORDISPLAYMENURESETPERSPECTIVE)
@@ -1438,15 +1443,18 @@
         def OnTabsOpenedDClick(event):
             pos = event.GetPosition()
             if tabctrl.TabHitTest(pos.x, pos.y, None):
-                pane = self.AUIManager.GetPane(self.TabsOpened)
-                if pane.IsMaximized():
-                    self.AUIManager.RestorePane(pane)
-                else:
-                    self.AUIManager.MaximizePane(pane)
-                self.AUIManager.Update()
+                self.SwitchFullScrMode(event)
             event.Skip()
         return OnTabsOpenedDClick
 
+    def SwitchFullScrMode(self,evt):
+        pane = self.AUIManager.GetPane(self.TabsOpened)
+        if pane.IsMaximized():
+            self.AUIManager.RestorePane(pane)
+        else:
+            self.AUIManager.MaximizePane(pane)
+        self.AUIManager.Update()
+
 #-------------------------------------------------------------------------------
 #                         Types Tree Management Functions
 #-------------------------------------------------------------------------------