From 8a705cd066bf82602ae57ef8055335542bab320b Mon Sep 17 00:00:00 2001 From: Jorge Moraleda Date: Wed, 29 Nov 2023 18:37:07 -0500 Subject: [PATCH] Preserve pane icons when loading a perspective in agw.aui --- wx/lib/agw/aui/framemanager.py | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/wx/lib/agw/aui/framemanager.py b/wx/lib/agw/aui/framemanager.py index 922826d8f..0452dbf2f 100644 --- a/wx/lib/agw/aui/framemanager.py +++ b/wx/lib/agw/aui/framemanager.py @@ -5223,6 +5223,7 @@ def LoadPerspective(self, layout, update=True, restorecaption=False): # mark all panes currently managed as docked and hidden saveCapt = {} # see restorecaption param + saveIcon = {} # icons are not preserved by perspectives, so preserve them for pane in self._panes: # dock the notebook pages @@ -5237,6 +5238,7 @@ def LoadPerspective(self, layout, update=True, restorecaption=False): pane.Dock().Hide() saveCapt[pane.name] = pane.caption + saveIcon[pane.name] = pane.icon # clear out the dock array; this will be reconstructed self._docks = [] @@ -5294,6 +5296,9 @@ def LoadPerspective(self, layout, update=True, restorecaption=False): if restorecaption: if pane.name in saveCapt: pane.Caption(saveCapt[pane.name]) + # restore icons from code. This is always done. Since icons are not saved in perspectives + if pane.name in saveIcon: + pane.icon = saveIcon[pane.name] if not p.IsOk(): if pane.IsNotebookControl():