pyui.base
index
c:\projects\pyuicvs\pyui\base.py

# PyUI
# Copyright (C) 2001-2002 Sean C. Riley

# This library is free software; you can redistribute it and/or
# modify it under the terms of version 2.1 of the GNU Lesser General Public
# License as published by the Free Software Foundation.

# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
# Lesser General Public License for more details.

# You should have received a copy of the GNU Lesser General Public
# License along with this library; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA

 
Modules
            
pyui.layouts
pyui
 
Classes
            
Base
Panel
Window
 
class Base
      Base GUI object that all other drawable object derive from.
this object implements:
    - containment of other GUI objects
    - position and size
    - event handling
    - unique identity of all GUI objects
 
self.rect is in absolute co-ordinates, self.windowRect is in relative window co-ordinates.
self.posX and self.posY are relative to the parent object
 
   Methods defined here:
__del__(self)
__init__(self)
Initialize and register the base widget. widgets are added to the global widget list initially.
addChild(self, child)
Add a child widget.
addPopup(self, popup)
calcSize(self)
This sets up self.rect to be absolute co-ordinates. also sets up self.windowRect
to be relative to the upper left of the parent Window
checkHit(self, pos)
clearDirty(self)
Clears this widgets dirty flag.
destroy(self)
Call this to remove all references to the widget from the system.
draw(self, renderer)
To be overridden by derived objects.
getFocus(self)
Acquire the gui system's focus. only one Base may have the focus
getToolTipInfo(self, pos)
return a tuple of the text and rectangle for the tooltip for when the
mouse is in <pos> within the window. This uses the member variable toolTipInfo
if it is populated.
handleEvent(self, event)
 event processing for base objects
hasFocus(self)
hit(self, pos)
Check for a hit using absolute coordinates.
loseFocus(self)
lose the gui system's focus.
move(self, dx, dy)
move relative to current position.
moveto(self, x, y)
move to absolute position.
pack(self)
used by panels & layout managers
postEvent(self, eventType)
Post an event to be processed next time through the event loop
registerEvent(self, eventType, handler)
Setup handler for an event
removeChild(self, child)
resize(self, w, h)
 resize absolute size of the widget
setDirty(self, collide=1)
Sets this widget to redraw itself and notifies window.
setParent(self, parent)
Set the parent of this widget
setShow(self, value)
setWindow(self, window)
unregisterEvent(self, eventType)
Remove handler for an event

Data and non-method functions defined here:
__doc__ = 'Base GUI object that all other drawable object d... self.posY are relative to the parent object\n '
str(object) -> string
 
Return a nice string representation of the object.
If the argument is a string, the return value is the same object.
__module__ = 'pyui.base'
str(object) -> string
 
Return a nice string representation of the object.
If the argument is a string, the return value is the same object.
canTab = 0
int(x[, base]) -> integer
 
Convert a string or number to an integer, if possible.  A floating point
argument will be truncated towards zero (this does not include a string
representation of a floating point number!)  When converting a string, use
the optional base.  It is an error to supply a base when converting a
non-string.
widgetLabel = 'Base'
str(object) -> string
 
Return a nice string representation of the object.
If the argument is a string, the return value is the same object.
 
class Panel(Base)
      Used for handling interior window drawing and layouts.
This is the simplest type of panel that other are derived from.
 
   Methods defined here:
__init__(self)
_pyuiKeyDown(self, event)
addChild(self, child, option=None)
destroy(self)
draw(self, renderer)
draw the panel's children
getFocus(self)
nextTab(self, step=1)
pack(self)
resize(self, w, h)
setLayout(self, layout)

Data and non-method functions defined here:
__doc__ = 'Used for handling interior window drawing and la...t type of panel that other are derived from.\n '
str(object) -> string
 
Return a nice string representation of the object.
If the argument is a string, the return value is the same object.
__module__ = 'pyui.base'
str(object) -> string
 
Return a nice string representation of the object.
If the argument is a string, the return value is the same object.

Methods inherited from Base:
__del__(self)
addPopup(self, popup)
calcSize(self)
This sets up self.rect to be absolute co-ordinates. also sets up self.windowRect
to be relative to the upper left of the parent Window
checkHit(self, pos)
clearDirty(self)
Clears this widgets dirty flag.
getToolTipInfo(self, pos)
return a tuple of the text and rectangle for the tooltip for when the
mouse is in <pos> within the window. This uses the member variable toolTipInfo
if it is populated.
handleEvent(self, event)
 event processing for base objects
hasFocus(self)
hit(self, pos)
Check for a hit using absolute coordinates.
loseFocus(self)
lose the gui system's focus.
move(self, dx, dy)
move relative to current position.
moveto(self, x, y)
move to absolute position.
postEvent(self, eventType)
Post an event to be processed next time through the event loop
registerEvent(self, eventType, handler)
Setup handler for an event
removeChild(self, child)
setDirty(self, collide=1)
Sets this widget to redraw itself and notifies window.
setParent(self, parent)
Set the parent of this widget
setShow(self, value)
setWindow(self, window)
unregisterEvent(self, eventType)
Remove handler for an event

Data and non-method functions inherited from Base:
canTab = 0
int(x[, base]) -> integer
 
Convert a string or number to an integer, if possible.  A floating point
argument will be truncated towards zero (this does not include a string
representation of a floating point number!)  When converting a string, use
the optional base.  It is an error to supply a base when converting a
non-string.
widgetLabel = 'Base'
str(object) -> string
 
Return a nice string representation of the object.
If the argument is a string, the return value is the same object.
 
class Window(Base)
      window - contains other objects. 
Windows have a main panel (_panel) which can be replaced with a custom panel. this main panel is
kept the size of the interior of the window.
 
   Methods defined here:
__init__(self, x, y, w, h, topmost=0)
addChild(self, child, option=None)
# for windows, children get added to the content panel
addDrawCallback(self, callback)
destroy(self)
draw(self, renderer)
draw the children of this window. this can be over-ridden by derived classes
to do drawing on the window.
drawWindow(self, renderer)
Sets up window drawing for the renderer, and then calls standard draw() method.
move(self, x, y)
moveto(self, x, y)
pack(self)
replacePanel(self, panel)
resize(self, w, h)
setDirty(self, collide=1)
setLayout(self, layout)
setShow(self, value)
setTopMost(self, value)

Data and non-method functions defined here:
__doc__ = 'window - contains other objects. \n Windows ha...kept the size of the interior of the window.\n '
str(object) -> string
 
Return a nice string representation of the object.
If the argument is a string, the return value is the same object.
__module__ = 'pyui.base'
str(object) -> string
 
Return a nice string representation of the object.
If the argument is a string, the return value is the same object.

Methods inherited from Base:
__del__(self)
addPopup(self, popup)
calcSize(self)
This sets up self.rect to be absolute co-ordinates. also sets up self.windowRect
to be relative to the upper left of the parent Window
checkHit(self, pos)
clearDirty(self)
Clears this widgets dirty flag.
getFocus(self)
Acquire the gui system's focus. only one Base may have the focus
getToolTipInfo(self, pos)
return a tuple of the text and rectangle for the tooltip for when the
mouse is in <pos> within the window. This uses the member variable toolTipInfo
if it is populated.
handleEvent(self, event)
 event processing for base objects
hasFocus(self)
hit(self, pos)
Check for a hit using absolute coordinates.
loseFocus(self)
lose the gui system's focus.
postEvent(self, eventType)
Post an event to be processed next time through the event loop
registerEvent(self, eventType, handler)
Setup handler for an event
removeChild(self, child)
setParent(self, parent)
Set the parent of this widget
setWindow(self, window)
unregisterEvent(self, eventType)
Remove handler for an event

Data and non-method functions inherited from Base:
canTab = 0
int(x[, base]) -> integer
 
Convert a string or number to an integer, if possible.  A floating point
argument will be truncated towards zero (this does not include a string
representation of a floating point number!)  When converting a string, use
the optional base.  It is an error to supply a base when converting a
non-string.
widgetLabel = 'Base'
str(object) -> string
 
Return a nice string representation of the object.
If the argument is a string, the return value is the same object.
 
Data
             __file__ = r'.\pyui\base.pyc'
__name__ = 'pyui.base'
veri = 0