Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AuiManager: Incorrect loading of minimized panes #2348

Open
lindakarlovska opened this issue Feb 14, 2023 · 2 comments
Open

AuiManager: Incorrect loading of minimized panes #2348

lindakarlovska opened this issue Feb 14, 2023 · 2 comments

Comments

@lindakarlovska
Copy link

lindakarlovska commented Feb 14, 2023

Operating system:
Description: Ubuntu 22.04.1 LTS
Python 3.10.6 (main, Nov 14 2022, 16:10:14) [GCC 11.3.0]
wx.version: 4.2.0 gtk3 (phoenix) wxWidgets 3.2.0

Description of the problem:
When I minimized the pane and then save a perspective and load it again, the warning "A pane with the name '__notebook_0_min' already exists in the manager!" is displayed in the command line. This is a bit strange, however the main problem is that the minimized button for this pane is added to GUI. So that we have two minimized buttons (one related to the previously minimized pane and one related to the incorrectly added pane). The button added after loading does not work. The original button works for minimizing and maximizing as expected.

To reproduce:

  1. Start AUI.py demo and minimize the bottom called "A Third Auto-NB Pane" (btw does not matter which pane is minimized, the problems occurs on every minimizable pane)
    Screenshot from 2023-02-14 20-14-02

  2. Create a perspective in Perspectives -> Frame perspectives -> Create perspective

  3. Immediately load this perspective by Perspectives -> Frame perspectives -> choose the above-created perspective

  4. Then this error occurs in CLI:

/home/linduska/.local/lib/python3.10/site-packages/wx/lib/agw/aui/framemanager.py:4546: UserWarning: A pane with the name '__notebook_0_min' already exists in the manager!
  warnings.warn("A pane with the name '%s' already exists in the manager!" % pane_info.name)

And the minimized button is added to the bottom (the right one). This button does not work.
Screenshot from 2023-02-14 20-18-52

Expected behavior: It should deal with the same name of the loaded pane and it should not add the new unfunctional button.

@lindakarlovska lindakarlovska changed the title Issue in AuiManager: Incorrect loading of minimized panes AuiManager: Incorrect loading of minimized panes Feb 14, 2023
@tianzhuqiao
Copy link

I think the issue is in the way to handle the min pane generated when we minimize a pane (wx/lib/agw/aui/framemanager.py). Looks like it works "correctly" with the following change.

def SavePerspective(self):
        ...
        for pane in self._panes:
            if pane.name.endswith('_min'):
                # ignore the generated '_min' panes
                continue
            result += self.SavePaneInfo(pane) + "|"
         ...

def LoadPerspective(self, layout, update=True, restorecaption=False):
        input = layout

        # check layout string version
        #    'layout1' = wxAUI 0.9.0 - wxAUI 0.9.2
        #    'layout2' = wxAUI 0.9.2 (wxWidgets 2.8)
        index = input.find("|")
        part = input[0:index].strip()
        input = input[index + 1:]

        if part != "layout2":
            return False
        
        # delete all the generated 'min' pane
        for pane in self._panes:
            if pane.name.endswith('_min'):
                self.RestoreMinimizedPane(pane)
        ...

@lindakarlovska
Copy link
Author

Thanks @tianzhuqiao for analyzing it! Could you create the fixing PR so that it will be fixed in the next wxPython version?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants