Reparenting in agw.aui on GTK

1 view
Skip to first unread message

Rob McMullen

unread,
Dec 18, 2009, 11:40:37 AM12/18/09
to wxpyth...@googlegroups.com
Don't know if these sorts of bug reports are better off on
wxpython-dev or wxpython-users...

Just discovered two issues, both only occur on GTK, and both seem to
be related to reparenting panes in the agw.aui.AuiManager. (Note that
I checked my sample app on MSW and OS X and both work fine.)

1) detach the tree widget from the manager so it's a floating frame.
Then use the menu item to toggle its visiblity. Crash:

The program 'python2.5' received an X Window System error.
This probably reflects a bug in the program.
The error was 'BadWindow (invalid Window parameter)'.
(Details: serial 12507 error_code 3 request_code 15 minor_code 0)
(Note to programmers: normally, X errors are reported asynchronously;
that is, you will receive the error a while after causing it.
To debug your program, run it with the --sync command line
option to change this behavior. You can then get a meaningful
backtrace from your debugger if you break on the gdk_x_error() function.)

Note that you can toggle till you've toggled yourself out if the tree
is still in the AuiManager and it is shown and hidden with no
problems. It only crashes when it's a floating frame.

2) start again. Detach the CustomTreeCtrl from the manager so it's a
floating frame again, but this time dock it back in the AuiManager.
When it's re-docked, the tree doesn't get redrawn -- it's all gray and
doesn't respond to any clicks. If I start the widget inspector and
ask it to highlight the CustomTreeCtrl, it highlights it at 0,0 on the
global screen (i.e. the upper left corner of the monitor), not
relative to the tree itself. Note that the native wx.TreeCtrl doesn't
seem to have this problem, so is this really a PyScrolledWindow
problem?

I didn't notice any GTK specific stuff in aui regarding reparenting.
Anyone know if that's needed?

Rob

auitest.py

Andrea Gavana

unread,
Dec 18, 2009, 11:58:20 AM12/18/09
to wxpyth...@googlegroups.com
Hi Rob,

2009/12/18 Rob McMullen:


> Don't know if these sorts of bug reports are better off on
> wxpython-dev or wxpython-users...
>
> Just discovered two issues, both only occur on GTK, and both seem to
> be related to reparenting panes in the agw.aui.AuiManager.  (Note that
> I checked my sample app on MSW and OS X and both work fine.)
>
> 1) detach the tree widget from the manager so it's a floating frame.
> Then use the menu item to toggle its visiblity.  Crash:
> The program 'python2.5' received an X Window System error.
> This probably reflects a bug in the program.
> The error was 'BadWindow (invalid Window parameter)'.
>  (Details: serial 12507 error_code 3 request_code 15 minor_code 0)
>  (Note to programmers: normally, X errors are reported asynchronously;
>   that is, you will receive the error a while after causing it.
>   To debug your program, run it with the --sync command line
>   option to change this behavior. You can then get a meaningful
>   backtrace from your debugger if you break on the gdk_x_error() function.)
>
> Note that you can toggle till you've toggled yourself out if the tree
> is still in the AuiManager and it is shown and hidden with no
> problems.  It only crashes when it's a floating frame.

Uhm, not sure what the problem is, and currently don't have a GTK VM
to test AUI on it. One thing you could try is, on line 6157 of
framemanager.py, substitute this part:

if p.frame and p.needsTransparency:
p.frame.SetTransparent(p.transparent)
p.needsTransparency = False

With this one:

if p.frame and p.needsTransparency:
if p.frame.IsShown():
p.frame.SetTransparent(p.transparent)
p.needsTransparency = False

>
> 2) start again.  Detach the CustomTreeCtrl from the manager so it's a
> floating frame again, but this time dock it back in the AuiManager.
> When it's re-docked, the tree doesn't get redrawn -- it's all gray and
> doesn't respond to any clicks.  If I start the widget inspector and
> ask it to highlight the CustomTreeCtrl, it highlights it at 0,0 on the
> global screen (i.e. the upper left corner of the monitor), not
> relative to the tree itself.  Note that the native wx.TreeCtrl doesn't
> seem to have this problem, so is this really a PyScrolledWindow
> problem?

Not sure about this issue, if it happens with CustomTreeCtrl only it
may be something related to PyScrolledWindow, or some strange bug in
CustomTreeCtrl/AUI themselves. It's hard to say without testing it...

Andrea.

"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/
http://thedoomedcity.blogspot.com/

Rob McMullen

unread,
Dec 18, 2009, 12:12:42 PM12/18/09
to wxpyth...@googlegroups.com
Andrea,

On Fri, Dec 18, 2009 at 8:58 AM, Andrea Gavana <andrea...@gmail.com> wrote:
> With this one:
>
>            if p.frame and p.needsTransparency:
>                if p.frame.IsShown():
>                    p.frame.SetTransparent(p.transparent)
>                p.needsTransparency = False

Nice work! That change fixes the problem.

> Not sure about this issue, if it happens with CustomTreeCtrl only it
> may be something related to PyScrolledWindow, or some strange bug in
> CustomTreeCtrl/AUI themselves. It's hard to say without testing it...

I'll see if I can try it with another PyScrolledWindow and see if that
narrows it down.

Rob

Rob McMullen

unread,
Dec 18, 2009, 1:49:26 PM12/18/09
to wxpyth...@googlegroups.com
Andrea,

On Fri, Dec 18, 2009 at 9:12 AM, Rob McMullen <rob.mc...@gmail.com> wrote:
>> Not sure about this issue, if it happens with CustomTreeCtrl only it
>> may be something related to PyScrolledWindow, or some strange bug in
>> CustomTreeCtrl/AUI themselves. It's hard to say without testing it...
>
> I'll see if I can try it with another PyScrolledWindow and see if that
> narrows it down.

It seems like it's a CustomTreeCtrl issue; I tried adding a simple
PyScrolledWindow to the test and that window seems fine.

The CustomTreeCtrl, when undocked and then redocked, still responds to
EVT_SIZE, but no longer to EVT_PAINT or EVT_MOUSE or any other event.

When trying to highlight the window using the widget inspector, I get:

(python2.5:958): Gdk-CRITICAL **: gdk_window_get_origin: assertion
`GDK_IS_WINDOW (window)' failed

so it seems like the window itself gets messed up, but I haven't been
able to narrow it down. Any suggestions?

Rob

auitest.py

Andrea Gavana

unread,
Dec 18, 2009, 4:28:50 PM12/18/09
to wxpyth...@googlegroups.com
Hi Rob,

2009/12/18 Rob McMullen:

A couple of them, but I am not sure any of them will work:

1) Around line 6191, there is this code:

p.window.Refresh()
p.window.Update()

Can you try to put them in a wx.CallAfter() and see if the issue goes away?

2) CustomTreeCtrl implements a method called "OnInternalIdle", which
basically checks if the widget needs repainting (delay repainting),
the items need to be repositioned and so on... If you try and disable
it (for example by putting a self._dirty=False at the beginning of the
method, or by Freeze()ing the widget in framemanager.py and Thaw()ing
it after), it might work.

Other than that, I am lost. I need to download a 800 MB virtual
machine tonight and see what's wrong. In any case, any help in
narrowing this thing down is more than welcome.

Rob McMullen

unread,
Dec 18, 2009, 5:26:08 PM12/18/09
to wxpyth...@googlegroups.com
Andrea,

> A couple of them, but I am not sure any of them will work:

Good suggestions, but none seemed to make a difference. Attached is a
diff of what I tried if you want to use it as a starting point.

When forcing the _dirty = True in OnInternalIdle, when I was dragging
the pane around in order to dock it, it froze. It pegged the CPU,
which isn't so bad, but the mouse was captured, so I had to ssh in and
kill it from another machine. Just FYI if you try that on your
virtual machine. I don't know if there's another way to break out of
the mouse capture.

Without the Freeze/Thaw, OnInternalIdle doesn't get called, but even
with the Freeze/Thaw and setting _dirty = True on CustomTreeCtrls: the
OnInternalIdle gets called but doesn't redraw the window. Hmmm.

Don't know what's happening.

Rob

agwdiff.py

Andrea Gavana

unread,
Dec 18, 2009, 5:29:38 PM12/18/09
to wxpyth...@googlegroups.com
Hi Rob,

2009/12/18 Rob McMullen:

I doubt it will change anything, but in my post I wrote "self._dirty =
False", not True :-D

I'll try and see what's going on.

Rob McMullen

unread,
Dec 18, 2009, 5:59:49 PM12/18/09
to wxpyth...@googlegroups.com
On Fri, Dec 18, 2009 at 2:29 PM, Andrea Gavana <andrea...@gmail.com> wrote:
> I doubt it will change anything, but in my post I wrote "self._dirty =
> False", not True :-D

Heh, woops. For some reason I thought you were trying to force the
CalculatePosition/Refresh/AdjustMyScrollbars so I thought "True!"

Just goes to show the importance of a single bit. :)

But, you're right, it doesn't fix the problem.

Rob

Andrea Gavana

unread,
Dec 18, 2009, 6:06:12 PM12/18/09
to wxpyth...@googlegroups.com
Hi Rob,

2009/12/18 Rob McMullen:

My VM installation doesn't look good. I downloaded the Ubuntu Karmic
Koala appliance (and this is the second time I wish to congratulate
the Ubuntu devs for such a name, after Jaunty JalalafelWhatever) and
was ready to hunt for the bug... but nope, no wireless connection in
this wonderful Ubuntu world (meaning it cannot resolve my wireless
connection somehow). So no wxPython, no svn client, no AGW, no
nothing. I'll wait for my super new laptop, obviously with Windows 7.

It's curious though, every single time I have tried to use a VM I got
so many problems... Maybe I'll try with VirtualBox...

Kevin Ollivier

unread,
Dec 18, 2009, 6:25:07 PM12/18/09
to wxpyth...@googlegroups.com
Hi Andrea,

On Dec 18, 2009, at 3:06 PM, Andrea Gavana wrote:

> Hi Rob,
>
> 2009/12/18 Rob McMullen:
>> On Fri, Dec 18, 2009 at 2:29 PM, Andrea Gavana <andrea...@gmail.com> wrote:
>>> I doubt it will change anything, but in my post I wrote "self._dirty =
>>> False", not True :-D
>>
>> Heh, woops. For some reason I thought you were trying to force the
>> CalculatePosition/Refresh/AdjustMyScrollbars so I thought "True!"
>>
>> Just goes to show the importance of a single bit. :)
>>
>> But, you're right, it doesn't fix the problem.
>
> My VM installation doesn't look good. I downloaded the Ubuntu Karmic
> Koala appliance (and this is the second time I wish to congratulate
> the Ubuntu devs for such a name, after Jaunty JalalafelWhatever) and
> was ready to hunt for the bug... but nope, no wireless connection in
> this wonderful Ubuntu world (meaning it cannot resolve my wireless
> connection somehow). So no wxPython, no svn client, no AGW, no
> nothing. I'll wait for my super new laptop, obviously with Windows 7.

Why are you trying to setup a wireless connection in your VM? Does using the "host" OS' networking (known as "bridged" mode in VMWare) not work for you?

Regards,

Kevin

> It's curious though, every single time I have tried to use a VM I got
> so many problems... Maybe I'll try with VirtualBox...
>
> Andrea.
>
> "Imagination Is The Only Weapon In The War Against Reality."
> http://xoomer.alice.it/infinity77/
> http://thedoomedcity.blogspot.com/
>

> --
> To unsubscribe, send email to wxPython-dev...@googlegroups.com
> or visit http://groups.google.com/group/wxPython-dev?hl=en

Rob McMullen

unread,
Dec 18, 2009, 6:26:19 PM12/18/09
to wxpyth...@googlegroups.com
On Fri, Dec 18, 2009 at 3:06 PM, Andrea Gavana <andrea...@gmail.com> wrote:
> It's curious though, every single time I have tried to use a VM I got
> so many problems... Maybe I'll try with VirtualBox...

I have had very good experiences with VirtualBox and much prefer it
over VMware. Small, fast, cheap.

I have XP and Vista running all the time (iTunes in XP, Outlook in
Vista), and have installed Karmic Koala with success. VirtualBox
emulates a wired network using a bridged network so you shouldn't have
to install wireless drivers inside the VM; it should just work. For
my install, I just booted the live CD and installed it to a virtual
disk, I didn't try any appliance version of it.

Rob

Andrea Gavana

unread,
Dec 18, 2009, 6:27:49 PM12/18/09
to wxpyth...@googlegroups.com
Hi Kevin,

2009/12/18 Kevin Ollivier:


> Hi Andrea,
>
> On Dec 18, 2009, at 3:06 PM, Andrea Gavana wrote:
>
>> Hi Rob,
>>
>> 2009/12/18 Rob McMullen:
>>> On Fri, Dec 18, 2009 at 2:29 PM, Andrea Gavana <andrea...@gmail.com> wrote:
>>>> I doubt it will change anything, but in my post I wrote "self._dirty =
>>>> False", not True :-D
>>>
>>> Heh, woops.  For some reason I thought you were trying to force the
>>> CalculatePosition/Refresh/AdjustMyScrollbars so I thought "True!"
>>>
>>> Just goes to show the importance of a single bit. :)
>>>
>>> But, you're right, it doesn't fix the problem.
>>
>> My VM installation doesn't look good. I downloaded the Ubuntu Karmic
>> Koala appliance (and this is the second time I wish to congratulate
>> the Ubuntu devs for such a name, after Jaunty JalalafelWhatever) and
>> was ready to hunt for the bug... but nope, no wireless connection in
>> this wonderful Ubuntu world (meaning it cannot resolve my wireless
>> connection somehow). So no wxPython, no svn client, no AGW, no
>> nothing. I'll wait for my super new laptop, obviously with Windows 7.
>
> Why are you trying to setup a wireless connection in your VM? Does using the "host" OS' networking (known as "bridged" mode in VMWare) not work for you?

No, I am not setting up a wireless connection. In the past, the host
OS connection was "Just Working" for me (back when I installed Hardy),
but now Karmic and/or the virtual appliance is telling me that I don't
have any wireless or wired connection. Nothing, zero, zilch.

Andrea Gavana

unread,
Dec 22, 2009, 3:23:57 AM12/22/09
to wxpyth...@googlegroups.com
Hi Rob,

2009/12/18 Rob McMullen:

I have managed to install VMWare on my new machine, and I am able to
reproduce this issue on Ubuntu Karmic. The only problem is, I have no
idea on how to fix it :-D . It seems like CustomTreeCtrl remains stuck
somewhere (a size event? a paint event?) but I was not able to narrow
it down, mostly because it's so complicated for an inexperienced user
like me to work on an Ubuntu machine, I can't find a friendly enough
debugger (oh I miss PythonWin!) on Ubuntu (suggestions welcome!) and
overall Linux seems to be in its own world when it comes to wxPython
applications (meaning it does things in unexpected ways, it doesn't
respect programmer inputs and so on).

I'll let you know if I discover a possible fix.

Robin Dunn

unread,
Dec 23, 2009, 12:09:45 PM12/23/09
to wxpyth...@googlegroups.com
On 12/22/09 12:23 AM, Andrea Gavana wrote:
> I was not able to narrow
> it down, mostly because it's so complicated for an inexperienced user
> like me to work on an Ubuntu machine, I can't find a friendly enough
> debugger (oh I miss PythonWin!) on Ubuntu (suggestions welcome!)

WingIDE works well on all the platforms, (although it's *very* un-native
on Mac.)

If you already know emacs then its gud mode for Python works fairly
well. If you don't already know emacs then don't bother.

It's been a while since I used it but Boa's debugger should work well on
Linux.

Winpdb is not as advanced of a debugger as WingIDE, but it works.


--
Robin Dunn
Software Craftsman
http://wxPython.org

Mikhail Terekhov

unread,
Jan 11, 2010, 1:05:52 PM1/11/10
to wxpyth...@lists.wxwidgets.org
Andrea Gavana <andrea.gavana <at> gmail.com> writes:
> it down, mostly because it's so complicated for an inexperienced user
> like me to work on an Ubuntu machine, I can't find a friendly enough
> debugger (oh I miss PythonWin!) on Ubuntu (suggestions welcome!) and

You can try eric4 IDE it has very nice debugger, see
http://eric-ide.python-projects.org/

Regards,
Mikhail

Reply all
Reply to author
Forward
0 new messages