From 3e740b59451373ceaa880f970ceaaaa0e73ffb86 Mon Sep 17 00:00:00 2001 From: Christer Weinigel Date: Wed, 11 Jul 2018 21:52:26 +0200 Subject: [PATCH] Update AuiToolBar orientation in AuiManager.DoUpdate Fix an issue in wx.lib.agw.aui.AuiManager where the orientation of an AuiToolBar would not be updated when calling LoadPerspective. This means that if the orientation of the toolbar can be wrong after calling LoadPerspective. Example: The toolbar has been moved by the user to the right side of the aui widget so that it is oriented vertically. SavePerspective is called to save the arrangement of the aui panels before the application exits. When the application starts up the toolbar is created in the default position and is oriented horizontally. LoadPerspective is then called to restore the saved panel arrangement. The position of the toolbar will be restored but the orientation will be still horizonal after the call, which is probably not what the user expects. A call to SwitchToolBarOrientation in DoUpdate (which is called by LoadPerspective) has been commented out since the AuiManager class was imported into wxPython way back in 2009 so I have been unable to find out why it was commented out. Removing the comment makes the above scenario work properly. I have done some quick testing of the change and it does not seem to break anything. Fixes #917 --- CHANGES.rst | 4 +++- wx/lib/agw/aui/framemanager.py | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/CHANGES.rst b/CHANGES.rst index 7a890e6d..70894c0c 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -33,7 +33,9 @@ Changes in this release include the following: * Switch wx.lib.plot to issue deprecation warnings with PlotPendingDeprecation so it doesn't have to enable all warnings to get them to be shown by default. (#902) - + +* Fix an issue in wx.lib.agw.aui.AuiManager where the orientation of + an AuiToolBar would not be updated when calling LoadPerspective. diff --git a/wx/lib/agw/aui/framemanager.py b/wx/lib/agw/aui/framemanager.py index 4ff45a89..e17a44d8 100644 --- a/wx/lib/agw/aui/framemanager.py +++ b/wx/lib/agw/aui/framemanager.py @@ -6530,7 +6530,7 @@ class AuiManager(wx.EvtHandler): else: if p.IsToolbar(): -# self.SwitchToolBarOrientation(p) + self.SwitchToolBarOrientation(p) p.best_size = p.window.GetBestSize() if p.window and not p.IsNotebookPage() and p.window.IsShown() != p.IsShown():