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

wx.lib.agw.aui may not be able to dock pane next to a notebook #2362

Open
tianzhuqiao opened this issue Mar 7, 2023 · 0 comments
Open

wx.lib.agw.aui may not be able to dock pane next to a notebook #2362

tianzhuqiao opened this issue Mar 7, 2023 · 0 comments

Comments

@tianzhuqiao
Copy link

Operating system: MacOS 13.2.1
wxPython version & source: 4.2.0
Python version & source: 3.9.5

Description of the problem:
Sometime, it may not be able to dock a pane next to a notebook.

aui_drop_pane_fail

The problem is when calling DoDropFloatingPane, if the index of the notebook page in panes is smaller than the notebook, PaneHitTest will return the notebook page, and its dock info (e.g., dock_direction) is not correct to dock the pane.

def DoDropFloatingPane(self, docks, panes, target, pt):
        ...
        screenPt = self._frame.ClientToScreen(pt)
        paneInfo = self.PaneHitTest(panes, pt)
        ...
        for i in range(len(self._guides) - 1, -1, -1):
            ...

            if dir == wx.ALL:  # target is a single dock guide
                return self.DoDropLayer(docks, target, guide.dock_direction)

            elif dir == wx.CENTER:
                ...
            else:

                drop_pane = False
                drop_row = False

                # if the paneInfo is a notebook page, the following info may not be correct
                insert_dir = paneInfo.dock_direction
                insert_layer = paneInfo.dock_layer
                insert_row = paneInfo.dock_row
                insert_pos = paneInfo.dock_pos
    ...

Looks like if we use the notebook pane (instead of the notebook page pane), the problem goes away.

def DoDropFloatingPane(self, docks, panes, target, pt):
        ...
        for i in range(len(self._guides) - 1, -1, -1):
            ...

            if dir == wx.ALL:  # target is a single dock guide
                return self.DoDropLayer(docks, target, guide.dock_direction)

            elif dir == wx.CENTER:
                ...
            else:

                drop_pane = False
                drop_row = False

                if paneInfo.IsNotebookPage():
                     # use the notebook where paneInfo is in
                     paneInfo = GetNotebookRoot(panes, paneInfo.notebook_id)

                # if the paneInfo is a notebook page, the following info may not be correct
                insert_dir = paneInfo.dock_direction
                insert_layer = paneInfo.dock_layer
                insert_row = paneInfo.dock_row
                insert_pos = paneInfo.dock_pos
    ...

aui_drop_pane_pass

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

1 participant