Package diffpy :: Package pdfgui :: Package gui :: Module PyAUI
[hide private]
[frames] | no frames]

Module PyAUI

source code


PyAUI is an Advanced User Interface library that aims to implement "cutting-edge"
interface usability and design features so developers can quickly and easily create
beautiful and usable application interfaces.

Vision and Design Principles

PyAUI attempts to encapsulate the following aspects of the user interface:

* Frame Management: Frame management provides the means to open, move and hide common
controls that are needed to interact with the document, and allow these configurations
to be saved into different perspectives and loaded at a later time. 

* Toolbars: Toolbars are a specialized subset of the frame management system and should
behave similarly to other docked components. However, they also require additional
functionality, such as "spring-loaded" rebar support, "chevron" buttons and end-user
customizability. 

* Modeless Controls: Modeless controls expose a tool palette or set of options that
float above the application content while allowing it to be accessed. Usually accessed
by the toolbar, these controls disappear when an option is selected, but may also be
"torn off" the toolbar into a floating frame of their own. 

* Look and Feel: Look and feel encompasses the way controls are drawn, both when shown
statically as well as when they are being moved. This aspect of user interface design
incorporates "special effects" such as transparent window dragging as well as frame animation. 

PyAUI adheres to the following principles:

- Use native floating frames to obtain a native look and feel for all platforms;
- Use existing wxPython code where possible, such as sizer implementation for frame management; 
- Use standard wxPython coding conventions.


Usage:

The following example shows a simple implementation that utilizes FrameManager to manage
three text controls in a frame window:

class MyFrame(wx.Frame):

    def __init__(self, parent, id=-1, title="PyAUI Test", pos=wx.DefaultPosition,
                 size=(800, 600), style=wx.DEFAULT_FRAME_STYLE):

        wx.Frame.__init__(self, parent, id, title, pos, size, style)

        self._mgr = PyAUI.FrameManager()
        
        # notify PyAUI which frame to use
        self._mgr.SetFrame(self)

        # create several text controls
        text1 = wx.TextCtrl(self, -1, "Pane 1 - sample text",
                            wx.DefaultPosition, wx.Size(200,150),
                            wx.NO_BORDER | wx.TE_MULTILINE)
                                           
        text2 = wx.TextCtrl(self, -1, "Pane 2 - sample text",
                            wx.DefaultPosition, wx.Size(200,150),
                            wx.NO_BORDER | wx.TE_MULTILINE)
                                           
        text3 = wx.TextCtrl(self, -1, "Main content window",
                            wx.DefaultPosition, wx.Size(200,150),
                            wx.NO_BORDER | wx.TE_MULTILINE)
        
        # add the panes to the manager
        self._mgr.AddPane(text1, wx.LEFT, "Pane Number One")
        self._mgr.AddPane(text2, wx.BOTTOM, "Pane Number Two")
        self._mgr.AddPane(text3, wx.CENTER)
                              
        # tell the manager to "commit" all the changes just made
        self._mgr.Update()

        self.Bind(wx.EVT_CLOSE, self.OnClose)


    def OnClose(self, event):

        # deinitialize the frame manager
        self._mgr.UnInit()

        self.Destroy()        
        event.Skip()        


# our normal wxApp-derived class, as usual

app = wx.PySimpleApp()

frame = MyFrame(None)
app.SetTopWindow(frame)
frame.Show()

app.MainLoop()

What's New:

PyAUI version 0.9.2 Adds:

* Fixes For Display Glitches;
* Fixes For Other Bugs Found In Previous Versions.


License And Version:

PyAUI Library Is Freeware And Distributed Under The wxPython License. 

Latest Revision: Andrea Gavana @ 30 Jun 2006, 21.00 GMT
Version 0.9.2. 



Classes [hide private]
  DockInfo
  DockUIPart
  PaneButton
  FrameManagerEvent
  DefaultDockArt
  PaneInfo
  FloatingPaneBaseClass
  FloatingPane
  FrameManager
Functions [hide private]
 
GetCloseData() source code
 
GetCloseBitmap() source code
 
GetCloseImage() source code
 
StepColour(c, percent)
StepColour() it a utility function that simply darkens a color by the specified percentage.
source code
 
LightContrastColour(c) source code
 
BitmapFromBits(color, type=0)
BitmapFromBits() is a utility function that creates a masked bitmap from raw bits (XBM format).
source code
 
DrawGradientRectangle(dc, rect, start_color, end_color, direction) source code
 
PaneCreateStippleBitmap() source code
 
DrawResizeHint(dc, rect) source code
 
CopyDocksAndPanes(src_docks, src_panes)
CopyDocksAndPanes() - this utility function creates shallow copies of the dock and pane info.
source code
 
CopyDocksAndPanes2(src_docks, src_panes)
CopyDocksAndPanes2() - this utility function creates full copies of the dock and pane info.
source code
 
GetMaxLayer(docks, dock_direction)
GetMaxLayer() is an internal function which returns the highest layer inside the specified dock.
source code
 
GetMaxRow(panes, direction, layer)
GetMaxRow() is an internal function which returns the highest layer inside the specified dock.
source code
 
DoInsertDockLayer(panes, dock_direction, dock_layer)
DoInsertDockLayer() is an internal function that inserts a new dock layer by incrementing all existing dock layer values by one.
source code
 
DoInsertDockRow(panes, dock_direction, dock_layer, dock_row)
DoInsertDockRow() is an internal function that inserts a new dock row by incrementing all existing dock row values by one.
source code
 
DoInsertPane(panes, dock_direction, dock_layer, dock_row, dock_pos) source code
 
FindDocks(docks, dock_direction, dock_layer=-1, dock_row=-1, arr=[])
FindDocks() 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).
source code
 
FindPaneInDock(dock, window)
FindPaneInDock() looks up a specified window pointer inside a dock.
source code
 
RemovePaneFromDocks(docks, pane, exc=None)
RemovePaneFromDocks() removes a pane window from all docks with a possible exception specified by parameter "except".
source code
 
RenumberDockRows(docks)
RenumberDockRows() takes a dock and assigns sequential numbers to existing rows.
source code
 
SetActivePane(panes, active_pane) source code
 
PaneSortFunc(p1, p2)
This function is used to sort panes by dock position.
source code
 
EscapeDelimiters(s)
EscapeDelimiters() changes "" into "" and "|" into "\|" in the input string.
source code
Variables [hide private]
  wxver = '2.8.7.1'
  _newversion = True
  _libimported = None
  _carbon_dll = None
  AUI_DOCK_NONE = 0
  AUI_DOCK_TOP = 1
  AUI_DOCK_RIGHT = 2
  AUI_DOCK_BOTTOM = 3
  AUI_DOCK_LEFT = 4
  AUI_DOCK_CENTER = 5
  AUI_DOCK_CENTRE = 5
  AUI_MGR_ALLOW_FLOATING = 1
  AUI_MGR_ALLOW_ACTIVE_PANE = 2
  AUI_MGR_TRANSPARENT_DRAG = 4
  AUI_MGR_TRANSPARENT_HINT = 8
  AUI_MGR_TRANSPARENT_HINT_FADE = 16
  AUI_MGR_DEFAULT = 29
  AUI_ART_SASH_SIZE = 0
  AUI_ART_CAPTION_SIZE = 1
  AUI_ART_GRIPPER_SIZE = 2
  AUI_ART_PANE_BORDER_SIZE = 3
  AUI_ART_PANE_BUTTON_SIZE = 4
  AUI_ART_BACKGROUND_COLOUR = 5
  AUI_ART_SASH_COLOUR = 6
  AUI_ART_ACTIVE_CAPTION_COLOUR = 7
  AUI_ART_ACTIVE_CAPTION_GRADIENT_COLOUR = 8
  AUI_ART_INACTIVE_CAPTION_COLOUR = 9
  AUI_ART_INACTIVE_CAPTION_GRADIENT_COLOUR = 10
  AUI_ART_ACTIVE_CAPTION_TEXT_COLOUR = 11
  AUI_ART_INACTIVE_CAPTION_TEXT_COLOUR = 12
  AUI_ART_BORDER_COLOUR = 13
  AUI_ART_GRIPPER_COLOUR = 14
  AUI_ART_CAPTION_FONT = 15
  AUI_ART_GRADIENT_TYPE = 16
  AUI_GRADIENT_NONE = 0
  AUI_GRADIENT_VERTICAL = 1
  AUI_GRADIENT_HORIZONTAL = 2
  AUI_BUTTON_STATE_NORMAL = 0
  AUI_BUTTON_STATE_HOVER = 1
  AUI_BUTTON_STATE_PRESSED = 2
  AUI_INSERT_PANE = 0
  AUI_INSERT_ROW = 1
  AUI_INSERT_DOCK = 2
  close_bits = '\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00...
  pin_bits = '\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\x...
  wxEVT_AUI_PANEBUTTON = 10285
  EVT_AUI_PANEBUTTON = wx.PyEventBinder(wxEVT_AUI_PANEBUTTON, 0)
  NonePaneInfo = <diffpy.pdfgui.gui.PyAUI.PaneInfo instance at 0...
  actionNone = 0
  actionResize = 1
  actionClickButton = 2
  actionClickCaption = 3
  actionDragToolbarPane = 4
  actionDragFloatingPane = 5
  auiInsertRowPixels = 10
  auiNewRowPixels = 40
  auiLayerInsertPixels = 40
  auiLayerInsertOffset = 5
Function Details [hide private]

CopyDocksAndPanes(src_docks, src_panes)

source code 

CopyDocksAndPanes() - this utility function creates shallow copies of
the dock and pane info.  DockInfo's usually contain pointers
to PaneInfo classes, thus this function is necessary to reliably
reconstruct that relationship in the new dock info and pane info arrays.

CopyDocksAndPanes2(src_docks, src_panes)

source code 

CopyDocksAndPanes2() - this utility function creates full copies of
the dock and pane info.  DockInfo's usually contain pointers
to PaneInfo classes, thus this function is necessary to reliably
reconstruct that relationship in the new dock info and pane info arrays.

FindPaneInDock(dock, window)

source code 

FindPaneInDock() looks up a specified window pointer inside a dock.
If found, the corresponding PaneInfo pointer is returned, otherwise None.

RenumberDockRows(docks)

source code 

RenumberDockRows() 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.

EscapeDelimiters(s)

source code 

EscapeDelimiters() changes "" into "" and "|" into "\|"
in the input string.  This is an internal functions which is
used for saving perspectives.


Variables Details [hide private]

close_bits

Value:
'\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\\
x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xef\x00\x0\
0\x00\xfb\x00\x00\x00\xcf\x00\x00\x00\xf9\x00\x00\x00\x9f\x00\x00\x00\\
xfc\x00\x00\x00?\x00\x00\x00\xfe\x00\x00\x00?\x00\x00\x00\xfe\x00\x00\\
x00\x9f\x00\x00\x00\xfc\x00\x00\x00\xcf\x00\x00\x00\xf9\x00\x00\x00\xe\
f\x00\x00\x00\xfb\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\\
x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x0\
0\xff\x00\x00\x00'

pin_bits

Value:
'\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\\
x00\x00\x00\xff\x00\x00\x00\x1f\x00\x00\x00\xfc\x00\x00\x00\xdf\x00\x0\
0\x00\xfc\x00\x00\x00\xdf\x00\x00\x00\xfc\x00\x00\x00\xdf\x00\x00\x00\\
xfc\x00\x00\x00\xdf\x00\x00\x00\xfc\x00\x00\x00\xdf\x00\x00\x00\xfc\x0\
0\x00\x00\x0f\x00\x00\x00\xf8\x00\x00\x00\x7f\x00\x00\x00\xff\x00\x00\\
x00\x7f\x00\x00\x00\xff\x00\x00\x00\x7f\x00\x00\x00\xff\x00\x00\x00\xf\
f\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\x00\x00\xff\x00\\
x00\x00\xff\x00\x00\x00'

NonePaneInfo

Value:
PaneInfo()