AWG AuiNotebook: Trouble Moving Tabs Around

I am running wxPython3.0.0 with 32-bit python2.6.

I run the following example. It creates three tabs side by side: “PanelOne”, “PanelTwo”, and “PanelThree”.

I want to use the mouse to drag the tabs on top of each other in order top to bottom: “PanelOne”, “PanelTwo”, and “PanelThree”.

I grab the “PanelTwo” tab and drag it to the bottom. I get a C++ assertion “!wxMouseCapture::IsInCaptureStack(this)”, but after wiggling the mouse carefully I am able to drop the panel below “PanelOne” / “PanelThree” in its own split.

Next I grab the “PanelThree” tab and drag it to the bottom. The blue highlighter doesn’t want to cover the whole bottom of the screen. It wants me to drop the tab into the same split with “PanelTwo” either left or right.

With a little wiggling I get the highlighter to cover the bottom half of the screen. When I release it, “PanelThree” is now the entire bottom split, “PanelTwo” is at the top, and “PanelOne” is barely visible hidden behind “PanelTwo” at the top.

Is this a bug in the component or a bug in my code?

Thanks for the help!

import wx

import wx.lib.agw.aui as aui

class TestPanel(wx.Panel):

def init(self,parent):

wx.Panel.init(self, parent=parent, id=wx.ID_ANY)

sizer = wx.BoxSizer(wx.VERTICAL)

txtOne = wx.TextCtrl(self, wx.ID_ANY, “”)

sizer.Add(txtOne, 0, wx.ALL, 5)

txtTwo = wx.TextCtrl(self, wx.ID_ANY, “”)

sizer.Add(txtTwo, 0, wx.ALL, 5)

self.SetSizer(sizer)

class DemoFrame(wx.Frame):

def init(self):

wx.Frame.init(self, None, -1, “Test”, size=(800,800))

self._mgr = aui.AuiManager()

self._mgr.SetManagedWindow(self)

notebook = aui.AuiNotebook(self)

panelOne = TestPanel(notebook)

panelTwo = TestPanel(notebook)

panelThree = TestPanel(notebook)

notebook.AddPage(panelOne, “PanelOne”, False)

notebook.AddPage(panelTwo, “PanelTwo”, False)

notebook.AddPage(panelThree, “PanelThree”, False)

self._mgr.AddPane(notebook,

aui.AuiPaneInfo().Name(“notebook_content”).

CenterPane().PaneBorder(False))

self._mgr.Update()

#notebook.Split(0,wx.RIGHT)

#notebook.Split(1,wx.BOTTOM)

if name == “main”:

app = wx.PySimpleApp()

frame = DemoFrame()

frame.Show()

app.MainLoop()

Hi Christopher,

···

On 4/21/2014 20:06, Christopher Cantrell wrote:

I am running wxPython3.0.0 with 32-bit python2.6.

I run the following example. It creates three tabs side by side: "PanelOne", "PanelTwo", and "PanelThree".

I want to use the mouse to drag the tabs on top of each other in order top to bottom: "PanelOne", "PanelTwo", and "PanelThree".

I grab the "PanelTwo" tab and drag it to the bottom. I get a C++ assertion "!wxMouseCapture::IsInCaptureStack(this)", but after wiggling the mouse carefully I am able to drop the panel below "PanelOne" / "PanelThree" in its own split.

Next I grab the "PanelThree" tab and drag it to the bottom. The blue highlighter doesn't want to cover the whole bottom of the screen. It wants me to drop the tab into the same split with "PanelTwo" either left or right.

With a little wiggling I get the highlighter to cover the bottom half of the screen. When I release it, "PanelThree" is now the entire bottom split, "PanelTwo" is at the top, and "PanelOne" is barely visible hidden behind "PanelTwo" at the top.

Is this a bug in the component or a bug in my code?

Looks like a bug in wx.lib.agw.aui, I see it with 3.0.1Phoenix too, not quite the same error but I can't move panels, but it works for me with 2.9.5.

I'll try and have a closer look tomorrow unless someone else beats me to it.

See you
Werner

I have already beat you to the answer. I keep forgetting to do a pull request on it.
I’ll try to get to that in a few days here.

There are a couple of things involved that need tweaked.
depending on classic and phoenix it is different.

One part has to do with the use of DragImage/GenericDragImage, depending on classic or phoenix.
The other part is a carefully placed MouseRelease before the drag call is allowed to continue.

I’ve had this solved for quite some time now, but havn’t gotten around to it.
Will try to rib Robin for a quick fix when I round it up. I’m on a different HHD atm doing a Kubuntu package, so my phoenix git is on the other.

···

On Monday, April 21, 2014 12:38:26 PM UTC-6, werner wrote:

Hi Christopher,

On 4/21/2014 20:06, Christopher Cantrell wrote:

I am running wxPython3.0.0 with 32-bit python2.6.

I run the following example. It creates three tabs side by side:
“PanelOne”, “PanelTwo”, and “PanelThree”.

I want to use the mouse to drag the tabs on top of each other in order
top to bottom: “PanelOne”, “PanelTwo”, and “PanelThree”.

I grab the “PanelTwo” tab and drag it to the bottom. I get a C++
assertion “!wxMouseCapture::IsInCaptureStack(this)”, but after
wiggling the mouse carefully I am able to drop the panel below
“PanelOne” / “PanelThree” in its own split.

Next I grab the “PanelThree” tab and drag it to the bottom. The blue
highlighter doesn’t want to cover the whole bottom of the screen. It
wants me to drop the tab into the same split with “PanelTwo” either
left or right.

With a little wiggling I get the highlighter to cover the bottom half
of the screen. When I release it, “PanelThree” is now the entire
bottom split, “PanelTwo” is at the top, and “PanelOne” is barely
visible hidden behind “PanelTwo” at the top.

Is this a bug in the component or a bug in my code?

Looks like a bug in wx.lib.agw.aui, I see it with 3.0.1Phoenix too, not
quite the same error but I can’t move panels, but it works for me with
2.9.5.

I’ll try and have a closer look tomorrow unless someone else beats me to it.

See you

Werner

Actually I have It on my thumbdrive. I include my own custom aui with SourceCoder.

… for classic here is what you need to do Chris in the meantime…

Locate your wx source files in your python packages.

wx/lib/agw/aui/auibook.py

search for this in the OnMotion method.

if self._agwFlags & AUI_NB_TAB_FLOAT:
self._drag_image.BeginDrag(wx.Point(0,0), self, fullScreen=True)
else:
self._drag_image.BeginDragBounded(wx.Point(0,0), self, self.GetParent())

…then add this right before it…

if self.HasCapture(): # SourceCoder wx30 Fix
self.ReleaseMouse() # SourceCoder wx30 Fix

… so that the code looks like…

if self.HasCapture(): # SourceCoder wx30 Fix
self.ReleaseMouse() # SourceCoder wx30 Fix

                if self._agwFlags & AUI_NB_TAB_FLOAT:
                    self._drag_image.BeginDrag(wx.Point(0,0), self, fullScreen=True)
                else:
                    self._drag_image.BeginDragBounded(wx.Point(0,0), self, self.GetParent())

…then save the file and recheck the dragging. This should fix it for classic…

For phoenix, you will need to change the DragImage subclass the AuiNotebook is calling in aui_utilities.py from…

DragImage
…to…
GenericDragImage

-MCow

@Christopher Cantrell: Pull REQz is awaiting here for phoenix on Robin’s github.
https://github.com/RobinD42/Phoenix/pull/77
…or follow instructions in previous post. :slight_smile:

should be this:
http://trac.wxwidgets.org/ticket/15947

Marco

···

On Tuesday, April 22, 2014 5:13:50 AM UTC+2, Metallicow wrote:

@Christopher Cantrell: Pull REQz is awaiting here for phoenix on Robin’s github.
https://github.com/RobinD42/Phoenix/pull/77
…or follow instructions in previous post. :slight_smile: