Inheritance diagram for AuiManager:
AuiManager manages the panes associated with it for a particular L{wx.Frame}, using a pane’s L{AuiPaneInfo} information to determine each pane’s docking and floating behavior. AuiManager uses wxPython’s 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 applications’ 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 L{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()
Layers, Rows and Directions, Positions:
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.
Bases: wx._core.EvtHandler
AuiManager manages the panes associated with it for a particular L{wx.Frame}, using a pane’s L{AuiPaneInfo} information to determine each pane’s docking and floating behavior. AuiManager uses wxPython’s 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 applications’ 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 L{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()
Layers, Rows and Directions, Positions:
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 to 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 (AUIDemo.py).
Default class constructor.
Parameters: |
|
---|
Flag name | Description |
---|---|
AUI_MGR_ALLOW_FLOATING | Allow floating of panes |
AUI_MGR_ALLOW_ACTIVE_PANE | If a pane becomes active, “highlight” it in the interface |
AUI_MGR_TRANSPARENT_DRAG | If the platform supports it, set transparency on a floating pane while it is dragged by the user |
AUI_MGR_TRANSPARENT_HINT | If the platform supports it, show a transparent hint window when the user is about to dock a floating pane |
AUI_MGR_VENETIAN_BLINDS_HINT | Show a “venetian blind” effect when the user is about to dock a floating pane |
AUI_MGR_RECTANGLE_HINT | Show a rectangle hint effect when the user is about to dock a floating pane |
AUI_MGR_HINT_FADE | If the platform supports it, the hint window will fade in and out |
AUI_MGR_NO_VENETIAN_BLINDS_FADE | Disables the “venetian blind” fade in and out |
AUI_MGR_LIVE_RESIZE | Live resize when the user drag a sash |
Default value for flags is: AUI_MGR_DEFAULT = AUI_MGR_ALLOW_FLOATING |
AUI_MGR_TRANSPARENT_HINT | AUI_MGR_HINT_FADE | AUI_MGR_NO_VENETIAN_BLINDS_FADE
Activates the pane to which window is associated.
Parameter: | window – a L{wx.Window} derived window. |
---|
Tells the frame manager to start managing a child window. There are three versions of this function. The first verison allows the full spectrum of pane parameter possibilities (AddPane1). The second version is used for simpler user interfaces which do not require as much configuration (AddPane2). The last version allows a drop position to be specified, which will determine where the pane will be added.
In wxPython, simply call AddPane.
Parameters: |
|
---|
Calculates the minimum and maximum sizes allowed for the input dock.
Parameter: | dock – the L{AuiDockInfo} structure to analyze. |
---|
CalculateHintRect() calculates the drop hint rectangle.
The method first calls L{DoDrop} to determine the exact position the pane would be at were if dropped. If the pane would indeed become docked at the specified drop point, the the rectangle hint will be returned in screen coordinates. Otherwise, an empty rectangle is returned.
Parameters: |
|
---|
Calculates the minimum and maximum sizes allowed for the input pane.
Parameters: |
|
---|
Returns whether a pane can be docked or not.
Parameter: | p – the L{AuiPaneInfo} class with all the pane’s information. |
---|
Checks if a UI part can be actually resized.
Parameter: | part – a UI part. |
---|
ClosePane() destroys or hides the pane depending on its flags.
Parameter: | pane_info – a L{AuiPaneInfo} instance. |
---|
Copies all the attributes of the input target into another L{AuiPaneInfo}.
Parameter: | target – the source L{AuiPaneInfo} from where to copy attributes. |
---|
Creates a floating frame for the windows.
Parameters: |
|
---|
DetachPane() tells the L{AuiManager} to stop managing the pane specified by window. The window, if in a floated frame, is reparented to the frame managed by AuiManager.
Parameter: | window – the window to be un-managed by the AuiManager. |
---|
DoDrop() is an important function. It basically takes a mouse position, and determines where the panes new position would be. If the pane is to be dropped, it performs the drop operation using the specified dock and pane arrays. By specifying copy dock and pane arrays when calling, a “what-if” scenario can be performed, giving precise coordinates for drop hints.
Parameters: |
|
---|
Handles the situation in which the dropped pane contains a normal window.
Parameters: |
|
---|
Handles the situation in which target is a single dock guide.
Parameters: |
|
---|
Handles the situation in which the dropped pane is not floating.
Parameters: |
|
---|
Drop a pane in the interface.
Parameters: |
|
---|
Insert a row in the interface before dropping.
Parameters: |
|
---|
Handles the situation in which the dropped pane contains a toolbar.
Parameters: |
|
---|
Ends a resize action, or for live update, resizes the sash.
Parameter: | event – a L{wx.MouseEvent} to be processed. |
---|
DrawHintRect() calculates the hint rectangle by calling L{CalculateHintRect}. If there is a rectangle, it shows it by calling L{ShowHint}, otherwise it hides any hint rectangle currently shown.
Parameters: |
|
---|
Draws a pane button in the caption (convenience function).
Parameters: |
|
---|
Returns all the attributes of a L{AuiPaneInfo}.
Parameter: | pane – a L{AuiPaneInfo} instance. |
---|
GetDockPixelOffset() is an internal function which returns a dock’s offset in pixels from the left side of the window (for horizontal docks) or from the top of the window (for vertical docks). This value is necessary for calculating fixed-pane/toolbar offsets when they are dragged.
Parameter: | test – a fake L{AuiPaneInfo} for testing purposes. |
---|
Returns the current dock constraint values.
See L{SetDockSizeConstraint} for more information.
This function will return the aui manager for a given window.
Parameter: | window – this parameter should be any child window or grand-child window (and so on) of the frame/window managed by L{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. |
---|
Returns the dimensions of the dock which lives opposite of the input dock.
Parameters: |
|
---|
GetPane() looks up a L{AuiPaneInfo} structure based on the supplied window pointer. Upon failure, GetPane() returns an empty L{AuiPaneInfo}, a condition which can be checked by calling L{AuiPaneInfo.IsOk()}.
The pane info’s structure may then be modified. Once a pane’s info is modified, L{AuiManager.Update()} must be called to realize the changes in the UI.
Parameter: | item – either a pane name or a L{wx.Window}. |
---|
@note: AG: added to handle 2 different versions of GetPane() for wxPython.
This version of L{GetPane()} looks up a pane based on a ‘pane name’, see below comment for more info.
Parameter: | name – the pane name. |
---|
This version of L{GetPane()} looks up a pane based on a ‘pane window’, see below comment for more info.
Parameter: | window – a L{wx.Window} derived window. |
---|
GetPanePart() looks up the pane border UI part of the pane specified. This allows the caller to get the exact rectangle of the pane in question, including decorations like caption and border.
Parameter: | wnd – the window to which the pane border belongs to. |
---|
Returns all the panes positions and sizes in a dock.
Parameter: | dock – a L{AuiDockInfo} instance. |
---|
Returns the rectangle surrounding the specified UI parts.
Parameter: | uiparts – UI parts. |
---|
Returns the partner dock for the input dock.
Parameter: | dock – a L{AuiDockInfo} instance. |
---|
Returns the partner pane for the input pane. They both need to live in the same L{AuiDockInfo}.
Parameters: |
|
---|
Returns the dimensions and proportion of the input dock.
Parameter: | dock – the L{AuiDockInfo} structure to analyze. |
---|
HitTest() is an internal function which determines which UI item the specified coordinates are over.
Parameter: | (x, y) – specify a position in client coordinates. |
---|
InsertPane() is used to insert either a previously unmanaged pane window into the frame manager, or to insert a currently managed pane somewhere else. InsertPane() will push all panes, rows, or docks aside and insert the window into the position specified by pane_info. Because pane_info can specify either a pane, dock row, or dock layer, the insert_level parameter is used to disambiguate this. The parameter insert_level can take a value of AUI_INSERT_PANE, AUI_INSERT_ROW or AUI_INSERT_DOCK.
Parameters: |
|
---|
Returns whether a pane button in the pane caption is visible.
Parameter: | part – the UI part to analyze. |
---|
Adds a dock into the existing layout.
Parameters: |
|
---|
Adds a pane into the existing layout (in an existing dock).
Parameters: |
|
---|
Layouts all the UI structures in the interface.
Parameters: |
|
---|
LoadPaneInfo() is similar to to L{LoadPerspective}, with the exception that it only loads information about a single pane. It is used in combination with L{SavePaneInfo()}.
Parameters: |
|
---|
LoadPerspective() loads a layout which was saved with L{SavePerspective()} If the update flag parameter is True, L{AuiManager.Update()} will be automatically invoked, thus realizing the saved perspective on screen.
Parameters: |
|
---|
MaximizePane() maximizes the input pane.
Parameter: | pane_info – a L{AuiPaneInfo} instance. |
---|
Minimizes a pane in a newly and automatically created L{auibar.AuiToolBar}.
Clicking on the minimize button causes a new L{auibar.AuiToolBar} to be created and added to the frame manager, (currently the implementation is such that panes at West will have a toolbar at the right, panes at South will have toolbars at the bottom etc...) and the pane is hidden in the manager.
Clicking on the restore button on the newly created toolbar will result in the toolbar being removed and the original pane being restored.
Parameter: | paneInfo – a L{AuiPaneInfo} instance for the pane to be minimized. |
---|
Handles the mouse double click on the pane caption.
Parameter: | pane_window – a L{wx.Window} derived window, managed by the pane. |
---|
Handles the wx.EVT_MOUSE_CAPTURE_LOST event for L{AuiManager}.
Parameter: | event – a L{wx.MouseCaptureLostEvent} to be processed. |
---|
Handles the wx.EVT_CHILD_FOCUS event for L{AuiManager}.
Parameter: | event – a L{wx.ChildFocusEvent} to be processed. |
---|
Handles the wx.EVT_ERASE_BACKGROUND event for L{AuiManager}. This is intentiobnally empty (excluding wxMAC) to reduce flickering while drawing.
Parameter: | event – L{wx.EraseEvent} to be processed. |
---|
Handles the EVT_AUI_FIND_MANAGER event for L{AuiManager}.
Parameter: | event – a EVT_AUI_FIND_MANAGER event to be processed. |
---|
Handles the activation event of a floating pane.
:param wnd a L{wx.Window} derived window, managed by the pane.
Handles the close event of a floating pane.
:param wnd a L{wx.Window} derived window, managed by the pane; :param event: a L{wx.CloseEvent} to be processed.
Handles the move event of a floating pane.
:param wnd a L{wx.Window} derived window, managed by the pane; :param event: a L{wx.MoveEvent} to be processed.
Handles the resizing of a floating pane.
:param wnd a L{wx.Window} derived window, managed by the pane; :param size: a L{wx.Size} object, specifying the new pane floating size.
Handles the mouse click on the pane gripper.
Parameters: |
|
---|
Handles the wx.EVT_TIMER event for L{AuiManager}.
Parameter: | event – a L{wx.TimerEvent} to be processed. |
---|
Handles the wx.EVT_LEAVE_WINDOW event for L{AuiManager}.
Parameter: | event – a L{wx.MouseEvent} to be processed. |
---|
Handles the wx.EVT_LEFT_DCLICK event for L{AuiManager}.
Parameter: | event – a L{wx.MouseEvent} to be processed. |
---|
Handles the wx.EVT_LEFT_DOWN event for L{AuiManager}.
Parameter: | event – a L{wx.MouseEvent} to be processed. |
---|
Handles the wx.EVT_LEFT_UP event for L{AuiManager}.
Parameter: | event – a L{wx.MouseEvent} to be processed. |
---|
Sub-handler for the L{OnLeftUp} event.
Parameter: | event – a L{wx.MouseEvent} to be processed. |
---|
Sub-handler for the L{OnLeftUp} event.
Parameter: | event – a L{wx.MouseEvent} to be processed. |
---|
Sub-handler for the L{OnLeftUp} event.
Parameter: | event – a L{wx.MouseEvent} to be processed. |
---|
Sub-handler for the L{OnLeftUp} event.
Parameter: | event – a L{wx.MouseEvent} to be processed. |
---|
Handles the wx.EVT_MOTION event for L{AuiManager}.
Parameter: | event – a L{wx.MouseEvent} to be processed. |
---|
Sub-handler for the L{OnMotion} event.
Parameter: | event – a L{wx.MouseEvent} to be processed. |
---|
Sub-handler for the L{OnMotion} event.
Parameter: | event – a L{wx.MouseEvent} to be processed. |
---|
Sub-handler for the L{OnMotion} event.
Parameter: | event – a L{wx.MouseEvent} to be processed. |
---|
Sub-handler for the L{OnMotion} event.
Parameter: | event – a L{wx.MouseEvent} to be processed. |
---|
Sub-handler for the L{OnMotion} event.
Parameter: | event – a L{wx.MouseEvent} to be processed. |
---|
Handles the wx.EVT_MOVE event for L{AuiManager}.
Parameter: | event – a L{wx.MoveEvent} to be processed. |
---|
Handles the wx.EVT_PAINT event for L{AuiManager}.
Parameter: | event – an instance of L{wx.PaintEvent} to be processed. |
---|
Handles the EVT_AUI_PANE_BUTTON event for L{AuiManager}.
Parameter: | event – a EVT_AUI_PANE_BUTTON to be processed. |
---|
OnRender() draws all of the pane captions, sashes, backgrounds, captions, grippers, pane borders and buttons. It renders the entire user interface.
Parameter: | event – an instance of L{AuiManagerEvent}. |
---|
Handles the EVT_AUI_PANE_MIN_RESTORE event for L{AuiManager}.
Parameter: | event – an instance of EVT_AUI_PANE_MIN_RESTORE to be processed. |
---|
Handles the wx.EVT_SET_CURSOR event for L{AuiManager}.
Parameter: | event – a L{wx.SetCursorEvent} to be processed. |
---|
Handles the wx.EVT_SIZE event for L{AuiManager}.
Parameter: | event – a L{wx.SizeEvent} to be processed. |
---|
Handles the L{auibook.EVT_AUINOTEBOOK_BEGIN_DRAG} event.
Parameter: | event – a L{auibook.EVT_AUINOTEBOOK_BEGIN_DRAG} event. |
---|
Handles the L{auibook.EVT_AUINOTEBOOK_PAGE_CLOSE} event.
Parameter: | event – a L{auibook.EVT_AUINOTEBOOK_PAGE_CLOSE} event. |
---|
Handles the L{auibook.EVT_AUINOTEBOOK_PAGE_CHANGED} event.
Parameter: | event – a L{auibook.EVT_AUINOTEBOOK_PAGE_CHANGED} event. |
---|
Returns a L{AuiPaneInfo} from a L{auibook.AuiNotebookEvent} event.
Parameter: | event – a L{auibook.AuiNotebookEvent} event. |
---|
Similar to L{HitTest}, but it checks in which L{AuiPaneInfo} rectangle the input point belongs to.
Parameters: |
|
---|
ProcessDockResult() is a utility function used by DoDrop() - it checks if a dock operation is allowed, the new dock position is copied into the target info. If the operation was allowed, the function returns True.
Parameters: |
|
---|
Process the AUI events sent to the manager.
Parameter: | event – the event to process. |
---|
Refreshes a pane button in the caption.
Parameter: | part – the UI part to analyze. |
---|
Render() fires a render event, which is normally handled by L{AuiManager.OnRender}. This allows the render function to be overridden via the render event.
This can be useful for painting custom graphics in the main window. Default behavior can be invoked in the overridden function by calling OnRender().
Parameter: | dc – : a L{wx.DC} device context object. |
---|
Repositions a pane after the main frame has been moved/resized.
Parameters: |
|
---|
Restores a previously minimized pane.
Parameter: | paneInfo – a L{AuiPaneInfo} instance for the pane to be restored. |
---|
RestorePane() restores the input pane from a previous maximized or minimized state.
Parameter: | pane_info – a L{AuiPaneInfo} instance. |
---|
SavePaneInfo() is similar to L{SavePerspective}, with the exception that it only saves information about a single pane. It is used in combination with L{LoadPaneInfo()}.
Parameter: | pane – a L{AuiPaneInfo} instance to save. |
---|
Instructs AuiManager to use art provider specified by the parameter art_provider for all drawing calls. This allows plugable look-and-feel features.
The previous art provider object, if any, will be deleted by L{AuiManager}.
Parameter: | art_provider – a AUI dock art provider. |
---|
Sets all the attributes contained in attrs to a L{AuiPaneInfo}.
Parameters: |
|
---|
When a user creates a new dock by dragging a window into a docked position, often times the large size of the window will create a dock that is unwieldly large.
L{AuiManager} by default limits the size of any new dock to 1/3 of the window size. For horizontal docks, this would be 1/3 of the window height. For vertical docks, 1/3 of the width. Calling this function will adjust this constraint value.
The numbers must be between 0.0 and 1.0. For instance, calling SetDockSizeContraint with 0.5, 0.5 will cause new docks to be limited to half of the size of the entire managed window.
Parameters: |
|
---|
This method is used to specify AuiManager’s settings flags.
Parameter: | flags – specifies options which allow the frame management behavior to be modified. flags can be one of the following style bits: |
---|
Flag name | Description |
---|---|
AUI_MGR_ALLOW_FLOATING | Allow floating of panes |
AUI_MGR_ALLOW_ACTIVE_PANE | If a pane becomes active, “highlight” it in the interface |
AUI_MGR_TRANSPARENT_DRAG | If the platform supports it, set transparency on a floating pane while it is dragged by the user |
AUI_MGR_TRANSPARENT_HINT | If the platform supports it, show a transparent hint window when the user is about to dock a floating pane |
AUI_MGR_VENETIAN_BLINDS_HINT | Show a “venetian blind” effect when the user is about to dock a floating pane |
AUI_MGR_RECTANGLE_HINT | Show a rectangle hint effect when the user is about to dock a floating pane |
AUI_MGR_HINT_FADE | If the platform supports it, the hint window will fade in and out |
AUI_MGR_NO_VENETIAN_BLINDS_FADE | Disables the “venetian blind” fade in and out |
AUI_MGR_LIVE_RESIZE | Live resize when the user drag a sash |
Called to specify the frame or window which is to be managed by L{AuiManager}. Frame management is not restricted to just frames. Child windows or custom controls are also allowed.
Parameter: | managed_window – specifies the window which should be managed by the frame manager. |
---|
Sets the master manager for an automatic L{auibook.AuiNotebook}.
Parameter: | manager – an instance of L{AuiManager}. |
---|
Modifies the snap limits used when snapping the managed_window to the screen (using L{SnapToScreen}) or when snapping the floating panes to one side of the managed_window (using L{SnapPane}).
To change the limit after which the managed_window or the floating panes are automatically stickled to the screen border (or to the managed_window side), set these two variables. Default values are 15 pixels.
Parameters: |
|
---|
Shows the AUI hint window.
Parameter: | rect – the hint rect calculated in advance. |
---|
Shows or hides a pane based on the window passed as input.
Parameters: |
|
---|
Used to intelligently shrink the docks’ size (if needed).
Parameters: |
|
---|
Snaps a floating pane to one of the main frame sides.
Parameters: |
|
---|
Snaps the main frame to specified position on the screen.
Parameters: |
|
---|
Switches the toolbar orientation from vertical to horizontal and vice-versa. This is especially useful for vertical docked toolbars once they float.
Parameter: | pane – an instance of L{AuiPaneInfo}, which may have a L{auibar.AuiToolBar} window associated with it. |
---|
Uninitializes the framework and should be called before a managed frame or window is destroyed. UnInit() is usually called in the managed wx.Frame’s destructor.
It is necessary to call this function before the managed frame or window is destroyed, otherwise the manager cannot remove its custom event handlers from a window.
This method is called after any number of changes are made to any of the managed panes. Update() must be invoked after L{AddPane} or L{InsertPane} are called in order to “realize” or “commit” the changes.
In addition, any number of changes may be made to L{AuiPaneInfo} structures (retrieved with L{AuiManager.GetPane}), but to realize the changes, Update() must be called. This construction allows pane flicker to be avoided by updating the whole layout at one time.
Updates/redraws the UI part containing a pane button.
Parameters: |
|
---|
Updates the docking guide windows positions and appearance.
Parameter: | paneInfo – a L{AuiPaneInfo} instance. |
---|