Workaround missing "IsMaximized" attribute for AuiPaneInfo in wxPython 4.1.0 wxPython4
authorEdouard Tisserant <edouard.tisserant@gmail.com>
Thu, 09 Sep 2021 09:37:03 +0200
branchwxPython4
changeset 3309 446b2c3da6e6
parent 3308 358ccd42e052
child 3310 6a6d3c318a6b
Workaround missing "IsMaximized" attribute for AuiPaneInfo in wxPython 4.1.0
IDEFrame.py
--- a/IDEFrame.py	Tue Sep 07 09:08:40 2021 +0200
+++ b/IDEFrame.py	Thu Sep 09 09:37:03 2021 +0200
@@ -1409,7 +1409,8 @@
         self.AuiTabCtrl = auitabctrl
         if self.TabsOpened.GetPageCount() == 0:
             pane = self.AUIManager.GetPane(self.TabsOpened)
-            if pane.IsMaximized():
+            # on wxPython 4.1.0, AuiPaneInfo has no "IsMaximized" attribute...
+            if (not hasattr(pane, "IsMaximized")) or pane.IsMaximized():
                 self.AUIManager.RestorePane(pane)
             self.AUIManager.Update()
 
@@ -1497,7 +1498,8 @@
 
     def SwitchPerspective(self, evt):
         pane = self.AUIManager.GetPane(self.TabsOpened)
-        if pane.IsMaximized():
+        # on wxPython 4.1.0, AuiPaneInfo has no "IsMaximized" attribute...
+        if (not hasattr(pane, "IsMaximized")) or pane.IsMaximized():
             self.AUIManager.RestorePane(pane)
         else:
             self.AUIManager.MaximizePane(pane)