wx.aui.AuiManager is the central class of the AUI
class framework.
wx.aui.AuiManager manages the panes associated with it for a particular wx.Frame, using a pane’s wx.aui.AuiPaneInfo information to determine each pane’s docking and floating behaviour.
wx.aui.AuiManager uses wxWidgets’ 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.
wx.aui.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, wx.aui.AuiManager‘s 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)
text2 = wx.TextCtrl(self)
self.mgr.AddPane(text1, wx.LEFT, "Pane Caption")
self.mgr.AddPane(text2, wx.BOTTOM, "Pane Caption")
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:
AUI
sample.This class supports the following styles:
wx.aui.AUI_MGR_ALLOW_FLOATING
: Allow a pane to be undocked to take the form of a wx.MiniFrame.wx.aui.AUI_MGR_ALLOW_ACTIVE_PANE
: Change the color of the title bar of the pane when it is activated.wx.aui.AUI_MGR_TRANSPARENT_DRAG
: Make the pane transparent during its movement.wx.aui.AUI_MGR_TRANSPARENT_HINT
: The possible location for docking is indicated by a translucent area.wx.aui.AUI_MGR_VENETIAN_BLINDS_HINT
: The possible location for docking is indicated by gradually appearing partially transparent hint.wx.aui.AUI_MGR_RECTANGLE_HINT
: The possible location for docking is indicated by a rectangular outline.wx.aui.AUI_MGR_HINT_FADE
: The translucent area where the pane could be docked appears gradually.wx.aui.AUI_MGR_NO_VENETIAN_BLINDS_FADE
: Used in complement of wx.aui.AUI_MGR_VENETIAN_BLINDS_HINT
to show the docking hint immediately.wx.aui.AUI_MGR_LIVE_RESIZE
: When a docked pane is resized, its content is refreshed in live (instead of moving the border alone and refreshing the content at the end).wx.aui.AUI_MGR_DEFAULT
: Default behavior, combines: wx.aui.AUI_MGR_ALLOW_FLOATING
| wx.aui.AUI_MGR_TRANSPARENT_HINT
| wx.aui.AUI_MGR_HINT_FADE
| wx.aui.AUI_MGR_NO_VENETIAN_BLINDS_FADE
.Handlers bound for the following event types will receive one of the wx.aui.AuiManagerEvent parameters.
See also
AUI Overview, wx.aui.AuiNotebook, wx.aui.AuiDockArt, wx.aui.AuiPaneInfo
__init__ |
Constructor. |
AddPane |
AddPane tells the frame manager to start managing a child window. |
DetachPane |
Tells the wx.aui.AuiManager to stop managing the pane specified by window. |
GetAllPanes |
Returns an array of all panes managed by the frame manager. |
GetArtProvider |
Returns the current art provider being used. |
GetDockSizeConstraint |
Returns the current dock constraint values. |
GetFlags |
Returns the current wx.aui.AuiManagerOption‘s flags. |
GetManagedWindow |
Returns the frame currently being managed by wx.aui.AuiManager. |
GetManager |
Calling this method will return the wx.aui.AuiManager for a given window. |
GetPane |
GetPane is used to lookup a wx.aui.AuiPaneInfo object either by window pointer or by pane name, which acts as a unique id for a window pane. |
HideHint |
HideHint hides any docking hint that may be visible. |
InsertPane |
This method is used to insert either a previously unmanaged pane window into the frame manager, or to insert a currently managed pane somewhere else. |
LoadPaneInfo |
LoadPaneInfo is similar to LoadPerspective, with the exception that it only loads information about a single pane. |
LoadPerspective |
Loads a saved perspective. |
ProcessDockResult |
ProcessDockResult is a protected member of the AUI layout manager. |
SavePaneInfo |
SavePaneInfo is similar to SavePerspective, with the exception that it only saves information about a single pane. |
SavePerspective |
Saves the entire user interface layout into an encoded String , which can then be stored by the application (probably using Config). |
SetArtProvider |
Instructs wx.aui.AuiManager to use art provider specified by parameter art_provider for all drawing calls. |
SetDockSizeConstraint |
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. |
SetFlags |
This method is used to specify wx.aui.AuiManagerOption‘s flags. |
SetManagedWindow |
Called to specify the frame or window which is to be managed by wx.aui.AuiManager. |
ShowHint |
This function is used by controls to explicitly show a hint window at the specified rectangle. |
UnInit |
Uninitializes the framework and should be called before a managed frame or window is destroyed. |
Update |
This method is called after any number of changes are made to any of the managed panes. |
AllPanes |
See GetAllPanes |
ArtProvider |
See GetArtProvider and SetArtProvider |
Flags |
See GetFlags and SetFlags |
ManagedWindow |
See GetManagedWindow and SetManagedWindow |
wx.aui.
AuiManager
(EvtHandler)¶Possible constructors:
AuiManager(managed_wnd=None, flags=AUI_MGR_DEFAULT)
AuiManager is the central class of the AUI
class framework.
__init__
(self, managed_wnd=None, flags=AUI_MGR_DEFAULT)¶Constructor.
Parameters: |
|
---|
AddPane
(self, *args, **kw)¶AddPane
tells the frame manager to start managing a child window.
There are several versions of this function. The first version allows the full spectrum of pane parameter possibilities. The second version is used for simpler user interfaces which do not require as much configuration. The last version allows a drop position to be specified, which will determine where the pane will be added.
AddPane (self, window, pane_info)
Parameters: |
|
---|---|
Return type: | bool |
AddPane (self, window, direction=LEFT, caption=””)
Parameters: |
|
---|---|
Return type: | bool |
AddPane (self, window, pane_info, drop_pos)
Parameters: |
|
---|---|
Return type: | bool |
DetachPane
(self, window)¶Tells the wx.aui.AuiManager to stop managing the pane specified by window.
The window, if in a floated frame, is reparented to the frame managed by wx.aui.AuiManager.
Parameters: | window (wx.Window) – |
---|---|
Return type: | bool |
GetAllPanes
(self)¶Returns an array of all panes managed by the frame manager.
Return type: | AuiPaneInfoArray |
---|
GetArtProvider
(self)¶Returns the current art provider being used.
Return type: | wx.aui.AuiDockArt |
---|
See also
GetDockSizeConstraint
(self, widthpct, heightpct)¶Returns the current dock constraint values.
See SetDockSizeConstraint
for more information.
Parameters: |
|
---|
GetFlags
(self)¶Returns the current wx.aui.AuiManagerOption‘s flags.
Return type: | int |
---|
GetManagedWindow
(self)¶Returns the frame currently being managed by wx.aui.AuiManager.
Return type: | Window |
---|
GetManager
(window)¶Calling this method will return the wx.aui.AuiManager for a given window.
The window parameter should specify any child window or sub-child window of the frame or window managed by wx.aui.AuiManager.
The window parameter need not 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.
Parameters: | window (wx.Window) – |
---|---|
Return type: | wx.aui.AuiManager |
GetPane
(self, *args, **kw)¶GetPane
is used to lookup a wx.aui.AuiPaneInfo object either by window pointer or by pane name, which acts as a unique id for a window pane.
The returned wx.aui.AuiPaneInfo object may then be modified to change a pane’s look, state or position. After one or more modifications to wx.aui.AuiPaneInfo, wx.aui.AuiManager.Update
should be called to commit the changes to the user interface. If the lookup failed (meaning the pane could not be found in the manager), a call to the returned wx.aui.AuiPaneInfo‘s IsOk() method will return False
.
GetPane (self, window)
Parameters: | window (wx.Window) – |
---|---|
Return type: | wx.aui.AuiPaneInfo |
GetPane (self, name)
Parameters: | name (string) – |
---|---|
Return type: | wx.aui.AuiPaneInfo |
InsertPane
(self, window, insert_location, insert_level=AUI_INSERT_PANE)¶This method 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 insert_location.
Because insert_location 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: |
|
---|---|
Return type: | bool |
LoadPaneInfo
(self, pane_part, pane)¶LoadPaneInfo
is similar to LoadPerspective, with the exception that it only loads information about a single pane.
It is used in combination with SavePaneInfo
.
Parameters: |
|
---|
LoadPerspective
(self, perspective, update=True)¶Loads a saved perspective.
If update is True
, wx.aui.AuiManager.Update
is automatically invoked, thus realizing the saved perspective on screen.
Parameters: |
|
---|---|
Return type: | bool |
ProcessDockResult
(self, target, new_pos)¶ProcessDockResult
is a protected member of the AUI
layout manager.
It can be overridden by derived classes to provide custom docking calculations.
Parameters: |
|
---|---|
Return type: | bool |
SavePaneInfo
(self, pane)¶SavePaneInfo
is similar to SavePerspective, with the exception that it only saves information about a single pane.
It is used in combination with LoadPaneInfo
.
Parameters: | pane (wx.aui.AuiPaneInfo) – |
---|---|
Return type: | string |
SavePerspective
(self)¶Saves the entire user interface layout into an encoded String , which can then be stored by the application (probably using Config).
When a perspective is restored using LoadPerspective
, the entire user interface will return to the state it was when the perspective was saved.
Return type: | string |
---|
SetArtProvider
(self, art_provider)¶Instructs wx.aui.AuiManager to use art provider specified by 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 wx.aui.AuiManager.
Parameters: | art_provider (wx.aui.AuiDockArt) – |
---|
See also
SetDockSizeConstraint
(self, widthpct, heightpct)¶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.
wx.aui.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: |
|
---|
SetFlags
(self, flags)¶This method is used to specify wx.aui.AuiManagerOption‘s flags.
flags specifies options which allow the frame management behaviour to be modified.
Parameters: | flags (int) – |
---|
SetManagedWindow
(self, managed_wnd)¶Called to specify the frame or window which is to be managed by wx.aui.AuiManager.
Frame management is not restricted to just frames. Child windows or custom controls are also allowed.
Parameters: | managed_wnd (wx.Window) – |
---|
ShowHint
(self, rect)¶This function is used by controls to explicitly show a hint window at the specified rectangle.
It is rarely called, and is mostly used by controls implementing custom pane drag/drop behaviour. The specified rectangle should be in screen coordinates.
Parameters: | rect (wx.Rect) – |
---|
UnInit
(self)¶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.
Update
(self)¶This method is called after any number of changes are made to any of the managed panes.
Update
must be invoked after AddPane
or InsertPane
are called in order to “realize” or “commit” the changes. In addition, any number of changes may be made to wx.aui.AuiPaneInfo structures (retrieved with wx.aui.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.
AllPanes
¶See GetAllPanes
ArtProvider
¶See GetArtProvider
and SetArtProvider
ManagedWindow
¶See GetManagedWindow
and SetManagedWindow