Module component :: Class Component
[hide private]
[frames] | no frames]

Class Component

source code

object --+
         |
        Component

Base class for component plugins.

Instance Methods [hide private]
 
__init__(self, klass, groups, attributes, **kargs)
Construct a new Component object.
source code
 
addStyles(self, *styles)
Add more styles.
source code
 
addExStyles(self, *styles)
Add more extra styles.
source code
 
setSpecial(self, attrName, attrClass)
Set special attribute class for processing XML.
source code
 
setParamClass(self, attrName, paramClass)
Set special attribute panel class for editing attribute value.
source code
 
getTreeImageId(self, node) source code
 
getTreeText(self, node) source code
 
addEvents(self, *events)
Add more events.
source code
 
__cmp__(self, other) source code
 
__repr__(self)
repr(x)
source code
 
canHaveChild(self, component)
True if the current component can have child of given type.
source code
 
canBeReplaced(self, component)
True if the current component can be replaced by component.
source code
 
isContainer(self)
True if component is a container (can have child nodes).
source code
 
getAttribute(self, node, attribute) source code
 
addAttribute(self, node, attribute, value)
Add attribute element.
source code
 
makeTestWin(self, res, name)
Method can be overrided by derived classes to create custom test view.
source code
 
getRect(self, obj)
Return bounding box coordinates for obj.
source code
 
copyAttributes(self, srcNode, dstNode)
Copy relevant attribute nodes from srcNode to dstNode.
source code

Inherited from object: __delattr__, __getattribute__, __hash__, __new__, __reduce__, __reduce_ex__, __setattr__, __str__

Class Variables [hide private]
  windowAttributes = ['fg', 'bg', 'font', 'tooltip', 'help', 'en...
Default window attributes for window-like components.
  genericStyles = ['wxSIMPLE_BORDER', 'wxSUNKEN_BORDER', 'wxDOUB...
Default generic styles.
  genericExStyles = ['wxWS_EX_VALIDATE_RECURSIVELY', 'wxWS_EX_BL...
Default generic extended styles.
  genericEvents = ['EVT_WINDOW_CREATE', 'EVT_WINDOW_DESTROY', 'E...
Default generic events.
  hasName = True
True if component has an XRC ID attribute.
  isTopLevel = False
True if component can be a top-level object in XML tree.
  renameDict = {}
Dictionary of old_name:new_name for renaming some attributes in the Attribute Panel.
Properties [hide private]

Inherited from object: __class__

Method Details [hide private]

__init__(self, klass, groups, attributes, **kargs)
(Constructor)

source code 
Construct a new Component object.
Parameters:
  • klass - Interface element class name (e.g. 'wxButton').
  • groups - List of group names to which this component belongs. First group is considered to be the primary group.
  • attributes - List of XRC attribute names.

    Supported keyword parameters:
  • defaults - Dictionary of default attribute values for creating new items.
  • specials - Dictionary of attribute_name:attribute_class pairs for specifying special attribute classes for some attributes, instead of using default Attribute class.
  • params - Dictionary of pairs attribute_name:param_class where param_class is a attribute interface class (one of classes in params.py or a custom class). If a param class is not specified, a default value defined by paramDict dictionary is used.
  • image, images - wx.Image object or a list of wx.Image objects for tree icons.
  • events - List of event names for code genration panel.
Overrides: object.__init__

setSpecial(self, attrName, attrClass)

source code 
Set special attribute class for processing XML.
Parameters:
  • attrName - Attribute name.
  • attrClass - Attribute class.

setParamClass(self, attrName, paramClass)

source code 
Set special attribute panel class for editing attribute value.
Parameters:
  • attrName - Attribute name.
  • paramClass - Param class.

__repr__(self)
(Representation operator)

source code 
repr(x)
Overrides: object.__repr__
(inherited documentation)

canHaveChild(self, component)

source code 

True if the current component can have child of given type.

This function is redefined by container classes.

canBeReplaced(self, component)

source code 

True if the current component can be replaced by component.

This function can be redefined by derived classes.

makeTestWin(self, res, name)

source code 
Method can be overrided by derived classes to create custom test view.
Parameters:
  • res - wx.xrc.XmlResource object with current test resource.
  • name - XRC ID of tested object.

Class Variable Details [hide private]

windowAttributes

Default window attributes for window-like components.
Value:
['fg', 'bg', 'font', 'tooltip', 'help', 'enabled', 'focused', 'hidden'\
]

genericStyles

Default generic styles.
Value:
['wxSIMPLE_BORDER', 'wxSUNKEN_BORDER', 'wxDOUBLE_BORDER', 'wxRAISED_BO\
RDER', 'wxSTATIC_BORDER', 'wxNO_BORDER', 'wxCLIP_CHILDREN', 'wxTRANSPA\
RENT_WINDOW', 'wxWANTS_CHARS', 'wxNO_FULL_REPAINT_ON_RESIZE', 'wxFULL_\
REPAINT_ON_RESIZE']

genericExStyles

Default generic extended styles.
Value:
['wxWS_EX_VALIDATE_RECURSIVELY', 'wxWS_EX_BLOCK_EVENTS', 'wxWS_EX_TRAN\
SIENT', 'wxFRAME_EX_CONTEXTHELP', 'wxWS_EX_PROCESS_IDLE', 'wxWS_EX_PRO\
CESS_UI_UPDATES']

genericEvents

Default generic events.
Value:
['EVT_WINDOW_CREATE', 'EVT_WINDOW_DESTROY', 'EVT_MOVE', 'EVT_SIZE', 'E\
VT_MOUSE_EVENTS', 'EVT_MOTION', 'EVT_LEFT_DOWN', 'EVT_LEFT_DCLICK', 'E\
VT_MIDDLE_DOWN', 'EVT_MIDDLE_DCLICK', 'EVT_RIGHT_DOWN', 'EVT_RIGHT_DCL\
ICK', 'EVT_MOUSEWHEEL', 'EVT_ENTER_WINDOW', 'EVT_LEAVE_WINDOW', 'EVT_K\
EY_DOWN', 'EVT_KEY_UP', 'EVT_CHAR', 'EVT_PAINT', 'EVT_ERASE_BACKGROUND\
', 'EVT_CONTEXT_MENU', 'EVT_HELP', 'EVT_SET_FOCUS', 'EVT_KILL_FOCUS', \
'EVT_CHILD_FOCUS', 'EVT_UPDATE_UI', 'EVT_IDLE',]