Discussion:
[GRASSGUI] can't dock map display with AUI
Michael Barton
2007-11-14 22:56:51 UTC
Permalink
It looks like we can't doc the map display using AUI unless we redo the main
window as a wx.Window or wx.Panel. I don't know if that would be a real
problem to do or not.

See correspondence form the wxPython/wxWidgets list below.

Michael
__________________________________________
Michael Barton, Professor of Anthropology
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton


------ Forwarded Message
Date: Thu, 07 Jun 2007 23:02:16 -0700
Subject: [ wxwindows-Bugs-1732558 ] strange behavior managing wx.Frame with
wx.AUIManager
Bugs item #1732558, was opened at 2007-06-07 04:26
Message generated for change (Comment added) made by biwillia76
https://sourceforge.net/tracker/?func=detail&atid=109863&aid=1732558&group_id=
9863
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: CM Barton (cmbarton)
Assigned to: Nobody/Anonymous (nobody)
Summary: strange behavior managing wx.Frame with wx.AUIManager
Platform: Mac OS X 10.4.9
wxPython 2.8.4
I want to manage a wx.Frame under AUI.
I define a base AUI managed window with wx.AUIManager(windowname)
I create the wx.Frame object
However, when I try add this to the base AUI window with AddPane, it produces
very odd results.
The pane is created within the base window in the proper location and with the
proper attributes.
However, the window is created outside the base AUI window, as if it were an
independent window, not a managed pane. That is it is NOT in the pane produced
with AddPane but at a completely different screen location. However, it is the
same SIZE as the pane created with AddPane
Weirdly, if I change the size of the AUI-managed pane, it also changes the
size of the independent window (i.e., the one outside the AUI base window)
accordingly.
If I define the managed pane as Float(), I get the original window AND a
second AUI pane, exactly the same as the original window and setting directly
on top of it. The AUI pane can be docked (though it doesn't dock correctly).
Again, changing the size of the AUI pane changes the size of the original
window, even though the 2 are in different screen positions.
Pane management works correctly with wx.Window, wx.TextCtrl, wx.NoteBook, and
wx.ToolBar.
Michael
----------------------------------------------------------------------
Comment By: Benjamin I. Williams (biwillia76)
Date: 2007-06-08 06:02
Logged In: YES
user_id=383645
Originator: NO
Hi Michael,
Yes. In order to do what you've described, you need to create one frame,
and then the other window as a wxWindow or wxPanel derived object. Let
wxAuiManager place a frame around it then, and do the floating and docking.
Creating two wxFrames is not the way that wxAuiManager is intended to be
used.
Good luck!
All the best,
Ben
----------------------------------------------------------------------
Comment By: CM Barton (cmbarton)
Date: 2007-06-07 19:26
Logged In: YES
user_id=1716814
Originator: YES
Ben,
Thanks for the quick and informative response.
What you say fits with the behavior I've seen. Here is our situation. Our
application (GRASS GIS) has two primary windows. They have been designed as
independent windows so far, each with their own toolbars and other
contents. So each is defined initially as a frame (wx.Frame). There has
been some discussion on the possibility of allowing one of these windows
(the one that displays maps) to be docked inside the other one (a kind of
controls window). AUI seemed like a good way to go about this. However,
from the behavior I reported and your comments, it seems like we'd have to
redefine the map display window as a wx.Window in order to do this.
Correct?
Michael
----------------------------------------------------------------------
Comment By: Benjamin I. Williams (biwillia76)
Date: 2007-06-07 12:52
Logged In: YES
user_id=383645
Originator: NO
Hello,
It sounds to me like you are trying to manage a child wxFrame. If so,
this is not the way that wxAuiManager was intended to be used. You can
manage many child windows inside a single wxFrame. Each wxFrame should
only have one manager. There is a one-to-one relationship between the
two.
Please let me know if I misunderstood your bug report.
Thanks,
Ben
----------------------------------------------------------------------
https://sourceforge.net/tracker/?func=detail&atid=109863&aid=1732558&group_id=
9863
------ End of Forwarded Message
Glynn Clements
2007-11-14 22:56:51 UTC
Permalink
Post by Michael Barton
It looks like we can't doc the map display using AUI unless we redo the main
window as a wx.Window or wx.Panel. I don't know if that would be a real
problem to do or not.
For a docking UI, you normally need at least one top-level window
which cannot itself be docked. Children can either be docked into this
window or undocked as separate top-level windows. If you undock
everything, you end up with an empty[1] main window whose only purpose
is to sit around in case you want to re-dock the children.

[1] Or almost empty. There may be some components which can't be
undocked, e.g. the menu bar.
--
Glynn Clements <***@gclements.plus.com>
Michael Barton
2007-11-14 22:56:51 UTC
Permalink
That's what I understand from the information I've received. Our problem at
the moment is that map displays are indeed children of the initial GIS
Manager/layer manager, but they are created as top-level windows (wx.Frame).

So there are a couple of questions that we will need to answer if we want to
try docking via AUI.

1) Can mapdisplay.MapFrame be changed from wx.Frame to wx.Window (or
wx.Panel or something else that works) fairly easily or will it take an
enormous amount of reprogramming?

2) If we can changed mapdisplay.MapFrame to wx.Window, for example, can we
still have dockable AUI menubars INSIDE the map display like we do now? Does
it matter if we do or don't? I can't see the digitizing toolbar to check
this out because of an apparent bug in the Mac version of AUI that makes
toolbar controls invisible. Given this, I'd argue that maybe we want to drop
the dockable toolbars, but I don't know how they function with respect to
the digitizing module in progress.

Michael
Post by Glynn Clements
Post by Michael Barton
It looks like we can't doc the map display using AUI unless we redo the main
window as a wx.Window or wx.Panel. I don't know if that would be a real
problem to do or not.
For a docking UI, you normally need at least one top-level window
which cannot itself be docked. Children can either be docked into this
window or undocked as separate top-level windows. If you undock
everything, you end up with an empty[1] main window whose only purpose
is to sit around in case you want to re-dock the children.
[1] Or almost empty. There may be some components which can't be
undocked, e.g. the menu bar.
__________________________________________
Michael Barton, Professor of Anthropology
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton
Daniel Calvelo
2007-11-14 22:56:51 UTC
Permalink
Hi all,
Post by Michael Barton
That's what I understand from the information I've received. Our problem at
the moment is that map displays are indeed children of the initial GIS
Manager/layer manager, but they are created as top-level windows (wx.Frame).
So there are a couple of questions that we will need to answer if we want to
try docking via AUI.
1) Can mapdisplay.MapFrame be changed from wx.Frame to wx.Window (or
wx.Panel or something else that works) fairly easily or will it take an
enormous amount of reprogramming?
It should be easy: both Frame and Panel are subclasses of Window. In
wx vocabulary, a window is something akin to a rectangular area, not
what you would call a "window" as in "window manager" (i.e. border,
independent, movable, possibly resizable, rectangular area). Frames
are akin to the latter. Panels are in-between.

In general, you want your custom complex widgets to return Panel
objects, so that they can be surrounded by a sizer and inserted inside
other Windows.

Daniel.
Post by Michael Barton
2) If we can changed mapdisplay.MapFrame to wx.Window, for example, can we
still have dockable AUI menubars INSIDE the map display like we do now? Does
it matter if we do or don't? I can't see the digitizing toolbar to check
this out because of an apparent bug in the Mac version of AUI that makes
toolbar controls invisible. Given this, I'd argue that maybe we want to drop
the dockable toolbars, but I don't know how they function with respect to
the digitizing module in progress.
Michael
Post by Glynn Clements
Post by Michael Barton
It looks like we can't doc the map display using AUI unless we redo the main
window as a wx.Window or wx.Panel. I don't know if that would be a real
problem to do or not.
For a docking UI, you normally need at least one top-level window
which cannot itself be docked. Children can either be docked into this
window or undocked as separate top-level windows. If you undock
everything, you end up with an empty[1] main window whose only purpose
is to sit around in case you want to re-dock the children.
[1] Or almost empty. There may be some components which can't be
undocked, e.g. the menu bar.
__________________________________________
Michael Barton, Professor of Anthropology
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University
phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton
--
-- Daniel Calvelo Aros
Michael Barton
2007-11-14 22:56:51 UTC
Permalink
My main question is whether there are a lot (or only a few) specific methods
used in this instance of wx.Frame that are not available if we switch it to
wx.Window. For example, what do we need to do for toolbars and status bars
that are built into frames?

I also don't know if we will need to drop AUI management of map display tool
bars. I'll start playing around with it maybe this weekend.

Michael
Post by Daniel Calvelo
Hi all,
Post by Michael Barton
That's what I understand from the information I've received. Our problem at
the moment is that map displays are indeed children of the initial GIS
Manager/layer manager, but they are created as top-level windows (wx.Frame).
So there are a couple of questions that we will need to answer if we want to
try docking via AUI.
1) Can mapdisplay.MapFrame be changed from wx.Frame to wx.Window (or
wx.Panel or something else that works) fairly easily or will it take an
enormous amount of reprogramming?
It should be easy: both Frame and Panel are subclasses of Window. In
wx vocabulary, a window is something akin to a rectangular area, not
what you would call a "window" as in "window manager" (i.e. border,
independent, movable, possibly resizable, rectangular area). Frames
are akin to the latter. Panels are in-between.
In general, you want your custom complex widgets to return Panel
objects, so that they can be surrounded by a sizer and inserted inside
other Windows.
Daniel.
Post by Michael Barton
2) If we can changed mapdisplay.MapFrame to wx.Window, for example, can we
still have dockable AUI menubars INSIDE the map display like we do now? Does
it matter if we do or don't? I can't see the digitizing toolbar to check
this out because of an apparent bug in the Mac version of AUI that makes
toolbar controls invisible. Given this, I'd argue that maybe we want to drop
the dockable toolbars, but I don't know how they function with respect to
the digitizing module in progress.
Michael
Post by Glynn Clements
Post by Michael Barton
It looks like we can't doc the map display using AUI unless we redo the
main
window as a wx.Window or wx.Panel. I don't know if that would be a real
problem to do or not.
For a docking UI, you normally need at least one top-level window
which cannot itself be docked. Children can either be docked into this
window or undocked as separate top-level windows. If you undock
everything, you end up with an empty[1] main window whose only purpose
is to sit around in case you want to re-dock the children.
[1] Or almost empty. There may be some components which can't be
undocked, e.g. the menu bar.
__________________________________________
Michael Barton, Professor of Anthropology
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University
phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton
__________________________________________
Michael Barton, Professor of Anthropology and Director of Graduate Studies
School of Human Evolution & Social Change
Center for Social Dynamics and Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton
Glynn Clements
2007-11-14 22:56:51 UTC
Permalink
Post by Michael Barton
My main question is whether there are a lot (or only a few) specific methods
used in this instance of wx.Frame that are not available if we switch it to
wx.Window. For example, what do we need to do for toolbars and status bars
that are built into frames?
A Frame is a TopLevelWindow with a built-in menu bar, status bar and
tool bar. If you don't use a Frame, you can still add these components
manually (although you might get better Mac compatibility with a
Frame's built-in menu bar).

The AUI demo (AUI_DockingWindowMgr.py) includes dockable toolbars.
--
Glynn Clements <***@gclements.plus.com>
Michael Barton
2007-11-14 22:56:51 UTC
Permalink
What I don't know is if you can get these to dock as toolbars into a child
window (i.e., a map display window), or only in the main window.

Michael
Post by Glynn Clements
The AUI demo (AUI_DockingWindowMgr.py) includes dockable toolbars.
__________________________________________
Michael Barton, Professor of Anthropology and Director of Graduate Studies
School of Human Evolution & Social Change
Center for Social Dynamics and Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton
Glynn Clements
2007-11-14 22:56:51 UTC
Permalink
Post by Michael Barton
What I don't know is if you can get these to dock as toolbars into a child
window (i.e., a map display window), or only in the main window.
AFAICT, you can manage any wxFrame with a wxAuiManager, and you can
add any widget as a child.

However, it has just occurred to me that wxAUI isn't as general as it
could be. AFAICT, you're limited to one level of docking, e.g. you
can't have a map display which can be undocked from the main window
and also have components which can be undocked from the map display.

Is that what you're referring to?

If this is the case, I would be inclined to give up on wxAUI and
implement the docking functionality manually using
wx.Window.Reparent().
--
Glynn Clements <***@gclements.plus.com>
Michael Barton
2007-11-14 22:56:51 UTC
Permalink
Post by Glynn Clements
Post by Michael Barton
What I don't know is if you can get these to dock as toolbars into a child
window (i.e., a map display window), or only in the main window.
AFAICT, you can manage any wxFrame with a wxAuiManager, and you can
add any widget as a child.
However, it has just occurred to me that wxAUI isn't as general as it
could be. AFAICT, you're limited to one level of docking, e.g. you
can't have a map display which can be undocked from the main window
and also have components which can be undocked from the map display.
Is that what you're referring to?
Yes. But since there is a problem with the dockable menu (the combobox is
invisible on the Mac), maybe we can just make it a normal menu.
Post by Glynn Clements
If this is the case, I would be inclined to give up on wxAUI and
implement the docking functionality manually using
wx.Window.Reparent().
I'm not sure how to use this for docking, but will look at the docs.

Michael


__________________________________________
Michael Barton, Professor of Anthropology
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton
Michael Barton
2007-11-14 22:56:51 UTC
Permalink
Post by Glynn Clements
Post by Michael Barton
What I don't know is if you can get these to dock as toolbars into a child
window (i.e., a map display window), or only in the main window.
AFAICT, you can manage any wxFrame with a wxAuiManager, and you can
add any widget as a child.
However, it has just occurred to me that wxAUI isn't as general as it
could be. AFAICT, you're limited to one level of docking, e.g. you
can't have a map display which can be undocked from the main window
and also have components which can be undocked from the map display.
Is that what you're referring to?
Yes. But since there is a problem with the dockable menu (the combobox is
invisible on the Mac), maybe we can just make it a normal menu.
Post by Glynn Clements
If this is the case, I would be inclined to give up on wxAUI and
implement the docking functionality manually using
wx.Window.Reparent().
I'm not sure how to use this for docking, but will look at the docs.

Michael


__________________________________________
Michael Barton, Professor of Anthropology
School of Human Evolution & Social Change
Center for Social Dynamics & Complexity
Arizona State University

phone: 480-965-6213
fax: 480-965-7671
www: http://www.public.asu.edu/~cmbarton

Loading...