Fix sequel of wxPython 4 port : double click on tab wasn't maximizing and was showing exception. wxPython4
authorEdouard Tisserant <edouard.tisserant@gmail.com>
Mon, 28 Feb 2022 21:29:46 +0100
branchwxPython4
changeset 3434 1402d5c0e27e
parent 3433 e60bb9b3d498
child 3435 c17155fd8573
Fix sequel of wxPython 4 port : double click on tab wasn't maximizing and was showing exception.
IDEFrame.py
--- a/IDEFrame.py	Fri Feb 25 14:04:09 2022 +0100
+++ b/IDEFrame.py	Mon Feb 28 21:29:46 2022 +0100
@@ -1496,7 +1496,7 @@
     def GetTabsOpenedDClickFunction(self, tabctrl):
         def OnTabsOpenedDClick(event):
             pos = event.GetPosition()
-            if tabctrl.TabHitTest(pos.x, pos.y, None):
+            if tabctrl.TabHitTest(pos.x, pos.y):
                 self.SwitchPerspective(event)
             event.Skip()
         return OnTabsOpenedDClick
@@ -1504,10 +1504,15 @@
     def SwitchPerspective(self, evt):
         pane = self.AUIManager.GetPane(self.TabsOpened)
         # on wxPython 4.1.0, AuiPaneInfo has no "IsMaximized" attribute...
-        if (not hasattr(pane, "IsMaximized")) or pane.IsMaximized():
+        IsMaximized = pane.IsMaximized() if hasattr(pane, "IsMaximized") \
+            else (self.TabBookIsMaximized if hasattr(self, "TabBookIsMaximized") \
+                else False)
+        if IsMaximized:
             self.AUIManager.RestorePane(pane)
+            self.TabBookIsMaximized = False
         else:
             self.AUIManager.MaximizePane(pane)
+            self.TabBookIsMaximized = True
         self.AUIManager.Update()
 
     def SwitchFullScrMode(self, evt):