framemanager.py is the central module of the AUI class framework.
AuiManager
manages the panes associated with it for a particular wx.Frame
, using
a pane’s AuiPaneInfo
information to determine each pane’s docking and floating
behavior. AuiManager uses wxPython’ sizer mechanism to plan the layout of each frame.
It uses a replaceable dock art class to do all drawing, so all drawing is localized
in one area, and may be customized depending on an application’s specific needs.
AuiManager works as follows: the programmer adds panes to the class, or makes
changes to existing pane properties (dock position, floating state, show state, etc…).
To apply these changes, AuiManager’s AuiManager.Update()
function is called. This batch
processing can be used to avoid flicker, by modifying more than one pane at a time,
and then “committing” all of the changes at once by calling Update().
Panes can be added quite easily:
text1 = wx.TextCtrl(self, -1)
text2 = wx.TextCtrl(self, -1)
self._mgr.AddPane(text1, AuiPaneInfo().Left().Caption("Pane Number One"))
self._mgr.AddPane(text2, AuiPaneInfo().Bottom().Caption("Pane Number Two"))
self._mgr.Update()
Later on, the positions can be modified easily. The following will float an existing pane in a tool window:
self._mgr.GetPane(text1).Float()
Inside AUI, the docking layout is figured out by checking several pane parameters. Four of these are important for determining where a pane will end up.
Direction - Each docked pane has a direction, Top, Bottom, Left, Right, or Center. This is fairly self-explanatory. The pane will be placed in the location specified by this variable.
Position - More than one pane can be placed inside of a “dock”. Imagine two panes being docked on the left side of a window. One pane can be placed over another. In proportionally managed docks, the pane position indicates it’s sequential position, starting with zero. So, in our scenario with two panes docked on the left side, the top pane in the dock would have position 0, and the second one would occupy position 1.
Row - A row can allow for two docks to be placed next to each other. One of the most common places for this to happen is in the toolbar. Multiple toolbar rows are allowed, the first row being in row 0, and the second in row 1. Rows can also be used on vertically docked panes.
Layer - A layer is akin to an onion. Layer 0 is the very center of the managed pane. Thus, if a pane is in layer 0, it will be closest to the center window (also sometimes known as the “content window”). Increasing layers “swallow up” all layers of a lower value. This can look very similar to multiple rows, but is different because all panes in a lower level yield to panes in higher levels. The best way to understand layers is by running the AUI sample (AUI.py).
Static function which returns if the input manager should have “live resize” |
|
Static function which returns if the input manager should use native |
|
Checks on which edge of a window the drop action has taken place. |
|
Checks if a point is outside the window rectangle. |
|
This utility function creates shallow copies of |
|
This utility function creates full copies of |
|
This is an internal function that inserts a new dock |
|
This is an internal function that inserts a new dock |
|
This is an internal function that inserts a new pane |
|
Draws a resize hint while a sash is dragged. |
|
Changes |
|
This is an internal function that returns a list of docks which meet |
|
This is an internal function that returns a list of docks |
|
This method looks up a specified window pointer inside a dock. |
|
Returns the window rectangle excluding toolbars. |
|
This function will return the aui manager for a given window. |
|
This is an internal function which returns |
|
This is an internal function which returns |
|
Returns the |
|
Returns the toolbar dock offsets (top-left and bottom-right). |
|
Returns whether pane1 and pane2 are in a different docking position |
|
This function is used to sort panes by dock position. |
|
Refreshes the docking guide windows. |
|
Removes a pane window from all docks |
|
Takes a dock and assigns sequential numbers |
|
Sets the active pane, as well as cycles through |
|
Shows or hide the docking guide windows. |
A docking guide window for multiple docking hint (diamond-shaped HUD). |
|
A class to store all properties of a dock. |
|
Base class for |
|
A class which holds information about VS2005 docking guide windows. |
|
Target class for |
|
The original wxAUI docking window hint. |
|
A class which holds attributes for a UI part in the interface. |
|
AuiFloatingFrame is the frame class that holds floating panes. |
|
AuiManager manages the panes associated with it for a particular |
|
A class similar to |
|
A specialized command event class for events sent by |
|
A simple class which describes the caption pane button attributes. |
|
AuiPaneInfo specifies all the parameters for a pane. These parameters specify where |
|
A docking guide window for single docking hint (not diamond-shaped HUD). |
AuiManager_HasLiveResize
(manager)¶Static function which returns if the input manager should have “live resize” behaviour.
manager – an instance of AuiManager
.
Note
This method always returns True
on wxMAC as this platform doesn’t have
the ability to use ScreenDC
to draw sashes.
AuiManager_UseNativeMiniframes
(manager)¶Static function which returns if the input manager should use native MiniFrame
as
floating panes.
manager – an instance of AuiManager
.
Note
This method always returns True
on wxMAC as this platform doesn’t have
the ability to use custom drawn miniframes.
CheckEdgeDrop
(window, docks, pt)¶Checks on which edge of a window the drop action has taken place.
window – a wx.Window
derived window;
docks – a list of AuiDockInfo
structures;
pt – a wx.Point
object.
CheckOutOfWindow
(window, pt)¶Checks if a point is outside the window rectangle.
CopyDocksAndPanes
(src_docks, src_panes)¶This utility function creates shallow copies of
the dock and pane info. AuiManager
usually contain pointers
to AuiPaneInfo
classes, thus this function is necessary to reliably
reconstruct that relationship in the new dock info and pane info arrays.
src_docks – a list of AuiDockInfo
classes;
src_panes – a list of AuiPaneInfo
classes.
CopyDocksAndPanes2
(src_docks, src_panes)¶This utility function creates full copies of
the dock and pane info. AuiManager
usually contain pointers
to AuiPaneInfo
classes, thus this function is necessary to reliably
reconstruct that relationship in the new dock info and pane info arrays.
src_docks – a list of AuiDockInfo
classes;
src_panes – a list of AuiPaneInfo
classes.
DoInsertDockLayer
(panes, dock_direction, dock_layer)¶This is an internal function that inserts a new dock layer by incrementing all existing dock layer values by one.
panes – a list of AuiPaneInfo
;
dock_direction (integer) – the AuiDockInfo
docking direction to analyze;
dock_layer (integer) – the AuiDockInfo
layer to analyze.
DoInsertDockRow
(panes, dock_direction, dock_layer, dock_row)¶This is an internal function that inserts a new dock row by incrementing all existing dock row values by one.
panes – a list of AuiPaneInfo
;
dock_direction (integer) – the AuiDockInfo
docking direction to analyze;
dock_layer (integer) – the AuiDockInfo
layer to analyze;
dock_row (integer) – the AuiDockInfo
row to analyze.
DoInsertPane
(panes, dock_direction, dock_layer, dock_row, dock_pos)¶This is an internal function that inserts a new pane by incrementing all existing dock position values by one.
panes – a list of AuiPaneInfo
;
dock_direction (integer) – the AuiDockInfo
docking direction to analyze;
dock_layer (integer) – the AuiDockInfo
layer to analyze.
dock_row (integer) – the AuiDockInfo
row to analyze;
dock_pos (integer) – the AuiDockInfo
position to analyze.
DrawResizeHint
(dc, rect)¶Draws a resize hint while a sash is dragged.
rect (wx.Rect) – a rectangle which specifies the sash dimensions.
EscapeDelimiters
(s)¶Changes ;
into \
and |
into |\
in the input string.
s (string) – the string to be analyzed.
Note
This is an internal functions which is used for saving perspectives.
FindDocks
(docks, dock_direction, dock_layer=-1, dock_row=-1, reverse=False)¶This is an internal function that returns a list of docks which meet the specified conditions in the parameters and returns a sorted array (sorted by layer and then row).
docks – a list of AuiDockInfo
;
dock_direction (integer) – the AuiDockInfo
docking direction to analyze;
dock_layer (integer) – the AuiDockInfo
layer to analyze.
dock_row (integer) – the AuiDockInfo
row to analyze;
FindOppositeDocks
(docks, dock_direction)¶This is an internal function that returns a list of docks which is related to the opposite direction.
docks – a list of AuiDockInfo
;
dock_direction (integer) – the AuiDockInfo
docking direction to analyze;
FindPaneInDock
(dock, window)¶This method looks up a specified window pointer inside a dock.
If found, the corresponding AuiDockInfo
pointer is returned, otherwise None
.
dock – a AuiDockInfo
structure;
window (wx.Window) – the window associated to the pane we are seeking.
GetInternalFrameRect
(window, docks)¶Returns the window rectangle excluding toolbars.
window – a wx.Window
derived window;
docks – a list of AuiDockInfo
structures.
GetManager
(window)¶This function will return the aui manager for a given window.
window (wx.Window) – this parameter should be any child window or grand-child
window (and so on) of the frame/window managed by AuiManager
. The window
does not need to be managed by the manager itself, nor does it even need
to be a child or sub-child of a managed window. It must however be inside
the window hierarchy underneath the managed window.
GetMaxLayer
(docks, dock_direction)¶This is an internal function which returns the highest layer inside the specified dock.
docks – a list of AuiDockInfo
;
dock_direction – the AuiDockInfo
docking direction to analyze.
GetMaxRow
(panes, dock_direction, dock_layer)¶This is an internal function which returns the highest layer inside the specified dock.
panes – a list of AuiPaneInfo
;
dock_direction (integer) – the AuiDockInfo
docking direction to analyze;
dock_layer (integer) – the AuiDockInfo
layer to analyze.
GetNotebookRoot
(panes, notebook_id)¶Returns the AuiNotebook
which has the specified notebook_id.
panes – a list of AuiPaneInfo
instances;
notebook_id (integer) – the target notebook id.
GetToolBarDockOffsets
(docks)¶Returns the toolbar dock offsets (top-left and bottom-right).
docks – a list of AuiDockInfo
to analyze.
IsDifferentDockingPosition
(pane1, pane2)¶Returns whether pane1 and pane2 are in a different docking position based on pane status, docking direction, docking layer and docking row.
pane1 – a AuiPaneInfo
instance;
pane2 – another AuiPaneInfo
instance.
PaneSortFunc
(p1, p2)¶This function is used to sort panes by dock position.
p1 – the first pane instance to compare, an instance of AuiPaneInfo
;
p2 – the second pane instance to compare, an instance of AuiPaneInfo
.
RefreshDockingGuides
(guides)¶Refreshes the docking guide windows.
guides – a list of AuiDockingGuide
classes;
RemovePaneFromDocks
(docks, pane, exc=None)¶Removes a pane window from all docks with a possible exception specified by parameter exc.
docks – a list of AuiDockInfo
structures;
pane – the pane to be removed, an instance of AuiPaneInfo
;
exc – the possible pane exception, an instance of AuiPaneInfo
.
RenumberDockRows
(docks)¶Takes a dock and assigns sequential numbers to existing rows. Basically it takes out the gaps so if a dock has rows with numbers 0, 2, 5, they will become 0, 1, 2.
docks – a list of AuiDockInfo
structures.
SetActivePane
(panes, active_pane)¶Sets the active pane, as well as cycles through every other pane and makes sure that all others’ active flags are turned off.
panes – a list of AuiPaneInfo
structures;
active_pane – the pane to be made active (if found), an instance of AuiPaneInfo
.
ShowDockingGuides
(guides, show)¶Shows or hide the docking guide windows.
guides – a list of AuiDockingGuide
classes;
show (bool) – whether to show or hide the docking guide windows.