445 new_item = AppendMenu(zoommenu, help='', |
445 new_item = AppendMenu(zoommenu, help='', |
446 kind=wx.ITEM_RADIO, text=str(int(round(value * 100))) + "%") |
446 kind=wx.ITEM_RADIO, text=str(int(round(value * 100))) + "%") |
447 self.Bind(wx.EVT_MENU, self.GenerateZoomFunction(idx), new_item) |
447 self.Bind(wx.EVT_MENU, self.GenerateZoomFunction(idx), new_item) |
448 |
448 |
449 parent.AppendSeparator() |
449 parent.AppendSeparator() |
450 AppendMenu(parent, help='', id=ID_PLCOPENEDITORDISPLAYMENUSWITCHPERSPECTIVE, |
450 if wx.VERSION >= (4, 1, 0): |
451 kind=wx.ITEM_NORMAL, text=_('Switch perspective') + '\tF12') |
451 AppendMenu(parent, help='', id=ID_PLCOPENEDITORDISPLAYMENUSWITCHPERSPECTIVE, |
452 self.Bind(wx.EVT_MENU, self.SwitchPerspective, id=ID_PLCOPENEDITORDISPLAYMENUSWITCHPERSPECTIVE) |
452 kind=wx.ITEM_NORMAL, text=_('Switch perspective') + '\tF12') |
|
453 self.Bind(wx.EVT_MENU, self.SwitchPerspective, id=ID_PLCOPENEDITORDISPLAYMENUSWITCHPERSPECTIVE) |
453 |
454 |
454 AppendMenu(parent, help='', id=ID_PLCOPENEDITORDISPLAYMENUFULLSCREEN, |
455 AppendMenu(parent, help='', id=ID_PLCOPENEDITORDISPLAYMENUFULLSCREEN, |
455 kind=wx.ITEM_NORMAL, text=_('Full screen') + '\tShift-F12') |
456 kind=wx.ITEM_NORMAL, text=_('Full screen') + '\tShift-F12') |
456 self.Bind(wx.EVT_MENU, self.SwitchFullScrMode, id=ID_PLCOPENEDITORDISPLAYMENUFULLSCREEN) |
457 self.Bind(wx.EVT_MENU, self.SwitchFullScrMode, id=ID_PLCOPENEDITORDISPLAYMENUFULLSCREEN) |
457 |
458 |
1403 def RefreshTabCtrlEvent(self): |
1404 def RefreshTabCtrlEvent(self): |
1404 auitabctrl = [] |
1405 auitabctrl = [] |
1405 for child in self.TabsOpened.GetChildren(): |
1406 for child in self.TabsOpened.GetChildren(): |
1406 if isinstance(child, wx.aui.AuiTabCtrl): |
1407 if isinstance(child, wx.aui.AuiTabCtrl): |
1407 auitabctrl.append(child) |
1408 auitabctrl.append(child) |
1408 if child not in self.AuiTabCtrl: |
1409 if wx.VERSION > (4, 1, 0) and child not in self.AuiTabCtrl: |
1409 child.Bind(wx.EVT_LEFT_DCLICK, self.GetTabsOpenedDClickFunction(child)) |
1410 child.Bind(wx.EVT_LEFT_DCLICK, self.GetTabsOpenedDClickFunction(child)) |
1410 self.AuiTabCtrl = auitabctrl |
1411 self.AuiTabCtrl = auitabctrl |
1411 if self.TabsOpened.GetPageCount() == 0: |
1412 # on wxPython 4.0.7, AuiManager has no "RestorePane" method... |
|
1413 if wx.VERSION > (4, 1, 0) and self.TabsOpened.GetPageCount() == 0: |
1412 pane = self.AUIManager.GetPane(self.TabsOpened) |
1414 pane = self.AUIManager.GetPane(self.TabsOpened) |
1413 # on wxPython 4.1.0, AuiPaneInfo has no "IsMaximized" attribute... |
1415 # on wxPython 4.1.0, AuiPaneInfo has no "IsMaximized" attribute... |
1414 if (not hasattr(pane, "IsMaximized")) or pane.IsMaximized(): |
1416 if (not hasattr(pane, "IsMaximized")) or pane.IsMaximized(): |
1415 self.AUIManager.RestorePane(pane) |
1417 self.AUIManager.RestorePane(pane) |
1416 self.AUIManager.Update() |
1418 self.AUIManager.Update() |
1496 self.SwitchPerspective(event) |
1498 self.SwitchPerspective(event) |
1497 event.Skip() |
1499 event.Skip() |
1498 return OnTabsOpenedDClick |
1500 return OnTabsOpenedDClick |
1499 |
1501 |
1500 def SwitchPerspective(self, evt): |
1502 def SwitchPerspective(self, evt): |
|
1503 if not hasattr(self.AUIManager, "MaximizePane"): |
|
1504 return |
1501 pane = self.AUIManager.GetPane(self.TabsOpened) |
1505 pane = self.AUIManager.GetPane(self.TabsOpened) |
1502 # on wxPython 4.1.0, AuiPaneInfo has no "IsMaximized" attribute... |
1506 # on wxPython 4.1.0, AuiPaneInfo has no "IsMaximized" attribute... |
1503 IsMaximized = pane.IsMaximized() if hasattr(pane, "IsMaximized") \ |
1507 IsMaximized = pane.IsMaximized() if hasattr(pane, "IsMaximized") \ |
1504 else (self.TabBookIsMaximized if hasattr(self, "TabBookIsMaximized") \ |
1508 else (self.TabBookIsMaximized if hasattr(self, "TabBookIsMaximized") \ |
1505 else False) |
1509 else False) |