{"action":"closed","issue":{"url":"https://api.github.com/repos/wxWidgets/Phoenix/issues/917","repository_url":"https://api.github.com/repos/wxWidgets/Phoenix","labels_url":"https://api.github.com/repos/wxWidgets/Phoenix/issues/917/labels{/name}","comments_url":"https://api.github.com/repos/wxWidgets/Phoenix/issues/917/comments","events_url":"https://api.github.com/repos/wxWidgets/Phoenix/issues/917/events","html_url":"https://github.com/wxWidgets/Phoenix/issues/917","id":340387083,"node_id":"MDU6SXNzdWUzNDAzODcwODM=","number":917,"title":"AuiManager.LoadPerspective does not update orientation of AuiToolBar","user":{"login":"wingel","id":5725282,"node_id":"MDQ6VXNlcjU3MjUyODI=","avatar_url":"https://avatars2.githubusercontent.com/u/5725282?v=4","gravatar_id":"","url":"https://api.github.com/users/wingel","html_url":"https://github.com/wingel","followers_url":"https://api.github.com/users/wingel/followers","following_url":"https://api.github.com/users/wingel/following{/other_user}","gists_url":"https://api.github.com/users/wingel/gists{/gist_id}","starred_url":"https://api.github.com/users/wingel/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wingel/subscriptions","organizations_url":"https://api.github.com/users/wingel/orgs","repos_url":"https://api.github.com/users/wingel/repos","events_url":"https://api.github.com/users/wingel/events{/privacy}","received_events_url":"https://api.github.com/users/wingel/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":1,"created_at":"2018-07-11T20:06:46Z","updated_at":"2018-10-04T02:33:06Z","closed_at":"2018-10-04T02:33:05Z","author_association":"NONE","body":"I'm trying to use SavePerspective and LoadPerspective of AuiManager.  This works fairly well except that the orientation of a docked AuiToolBar is not restored properly by LoadPerspective.\r\n\r\nA complete test program is included below.  To reproduce the problem, start the program, use the menu item Perspective->Save, move the toolbar from the top and dock it on the left or right side.   The toolbar changes orientation as it should and becomes vertical.  Now use the menu item Perspective->Load.  The toolbar is moved back to the saved position, but it is still vertically oriented.  The same thing happens if the other direction, if the perspective is saved with the toolbar in the vertical direction and the toolbar is moved to the horizontal direction and the perspective is loaded.\r\n\r\nThe fix seems to be easy, edit wx/lib/agw/aui/framemanager.py and remove the comment below in the DoUpdate method:\r\n\r\n```python\r\n                if p.IsToolbar():\r\n#                    self.SwitchToolBarOrientation(p)\r\n                    p.best_size = p.window.GetBestSize()\r\n```\r\n\r\nWith this change the toolbar orientation is updated on LoadPerspective.\r\n\r\nSystem info:\r\n\r\nUbuntu 16.04\r\nPython version: 3.5.2 (default, Nov 23 2017, 16:37:01) [GCC 5.4.0 20160609]\r\n\r\nwxWidgets version: 4.0.3 gtk3 (phoenix) wxWidgets 3.0.5\r\n\r\nwhich I installed with:\r\n\r\npip install -f https://extras.wxpython.org/wxPython4/extras/linux/gtk3/ubuntu-16.04 wxPython\r\n\r\nTest program:\r\n\r\n```python\r\n#! /usr/bin/python\r\nimport wx\r\nimport wx.lib.agw.aui as aui\r\n\r\nclass MyFrame(wx.Frame):\r\n    def __init__(self, parent, id=-1, title=\"AUI Test\", pos=wx.DefaultPosition,\r\n                 size=(800, 600), style=wx.DEFAULT_FRAME_STYLE):\r\n        wx.Frame.__init__(self, parent, id, title, pos, size, style)\r\n\r\n        self.SetName('main')\r\n\r\n        self.makeMenuBar()\r\n\r\n        self._mgr = aui.AuiManager()\r\n\r\n        self._mgr.SetManagedWindow(self)\r\n\r\n        bmp = wx.ArtProvider.GetBitmap(wx.ART_NORMAL_FILE, wx.ART_OTHER, wx.Size(16, 16))\r\n\r\n        self.toolbar = aui.AuiToolBar(self, -1, wx.DefaultPosition, wx.DefaultSize, agwStyle=aui.AUI_TB_DEFAULT_STYLE | aui.AUI_TB_OVERFLOW | aui.AUI_TB_TEXT | aui.AUI_TB_HORZ_TEXT)\r\n        self.toolbar.AddSimpleTool(-1, \"Item 1\", bmp)\r\n        self.toolbar.AddSimpleTool(-1, \"Item 2\", bmp)\r\n        self.toolbar.AddSimpleTool(-1, \"Item 3\", bmp)\r\n        self.toolbar.SetToolBitmapSize(wx.Size(8, 8))\r\n        self.toolbar.SetName(\"tb1\")\r\n\r\n        self.text1 = wx.TextCtrl(self, -1, \"Pane 1 - sample text\", wx.DefaultPosition, wx.Size(200,150), wx.NO_BORDER | wx.TE_MULTILINE)\r\n        self.text2 = wx.TextCtrl(self, -1, \"Pane 2 - sample text\", wx.DefaultPosition, wx.Size(200,150), wx.NO_BORDER | wx.TE_MULTILINE)\r\n        self.text3 = wx.TextCtrl(self, -1, \"Main content window\",  wx.DefaultPosition, wx.Size(200,150), wx.NO_BORDER | wx.TE_MULTILINE)\r\n\r\n        self._mgr.AddPane(self.toolbar, aui.AuiPaneInfo().ToolbarPane().Top().Name('toolbar').Caption(\"Simple Toolbar\"))\r\n        self._mgr.AddPane(self.text1, aui.AuiPaneInfo().Left().Caption(\"Pane Number One\").Name('text1'))\r\n        self._mgr.AddPane(self.text2, aui.AuiPaneInfo().Bottom().Caption(\"Pane Number Two\").Name('text2'))\r\n        self._mgr.AddPane(self.text3, aui.AuiPaneInfo().CenterPane().Name('text3'))\r\n\r\n        self._mgr.Update()\r\n\r\n        self.OnSave(None)\r\n\r\n        self.Bind(wx.EVT_CLOSE, self.OnClose)\r\n\r\n    def makeMenuBar(self):\r\n        perspectiveMenu = wx.Menu()\r\n        saveItem = perspectiveMenu.Append(-1, \"&Save\", \"Save perspective\")\r\n        loadItem = perspectiveMenu.Append(-1, \"&Load\", \"Load perspective\")\r\n        exitItem = perspectiveMenu.Append(wx.ID_EXIT)\r\n\r\n        menuBar = wx.MenuBar()\r\n        menuBar.Append(perspectiveMenu, \"&Perspective\")\r\n\r\n        self.SetMenuBar(menuBar)\r\n\r\n        self.Bind(wx.EVT_MENU, self.OnLoad, loadItem)\r\n        self.Bind(wx.EVT_MENU, self.OnSave, saveItem)\r\n\r\n    def OnClose(self, event):\r\n        # deinitialize the frame manager\r\n        self._mgr.UnInit()\r\n        event.Skip()\r\n\r\n    def OnExit(self, event):\r\n        \"\"\"Close the frame, terminating the application.\"\"\"\r\n        self.Close(True)\r\n\r\n    def OnSave(self, event):\r\n        \"\"\"Save perspective.\"\"\"\r\n        self.perspective = self._mgr.SavePerspective()\r\n\r\n    def OnLoad(self, event):\r\n        \"\"\"Load perspective.\"\"\"\r\n        self._mgr.LoadPerspective(self.perspective)\r\n\r\ndef main():\r\n    app = wx.App()\r\n    frame = MyFrame(None)\r\n    frame.Show()\r\n    app.MainLoop()\r\n\r\nif __name__ == '__main__':\r\n    main()\r\n```\r\n"}}
{"actor":{"display_login":"RobinD42"}}