Table Of Contents

Previous topic

BoxSizer

Next topic

Container

This Page

phoenix_title Component

Base class for component plugins.


class_hierarchy Inheritance Diagram

Inheritance diagram for class Component

Inheritance diagram of Component


method_summary Methods Summary

__init__ Construct a new Component object.
addAttribute Add attribute element.
addEquivStyles Add more style equivalencies
addEvents Add more events.
addExStyles Add more extra styles.
addStyles Add more styles.
canBeReplaced True if the current component can be replaced by component.
canHaveChild True if the current component can have child of given type.
copyAttributes Copy relevant attribute nodes from srcNode to dstNode.
copyImplicitAttributes Copy relevant implicit attribute nodes from srcNode to dstNode.
getAttribute  
getRect Return bounding box coordinates for obj.
getTreeImageId  
getTreeText  
isContainer True if component is a container (can have child nodes).
makeTestWin Method can be overrided by derived classes to create custom test view.
setParamClass Set special attribute panel class for editing attribute value.
setSpecial Set special attribute class for processing XML.

api Class API



class Component(object)

Base class for component plugins.


Methods



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

Construct a new Component object.

Parameters:
  • klass – Interface element class name (e.g. 'Button').
  • groups – List of group names to which this component belongs.

First group is considered to be the I{primary group}. :param attributes: List of XRC attribute names.

B{Supported keyword parameters:}

Parameters:defaults – Dictionary of default attribute values for creating

new items. :keyword specials: Dictionary of attribute_name pairs

for specifying special attribute classes for some attributes, instead of using default Attribute class.
Parameters:
  • params
    Dictionary of pairs attribute_name 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,imagesImage object or a list of Image objects for tree icons.
  • events – List of event names for code generation panel.


addAttribute(self, node, attribute, value)

Add attribute element.



addEquivStyles(self, equiv)

Add more style equivalencies



addEvents(self, *events)

Add more events.



addExStyles(self, *styles)

Add more extra styles.



addStyles(self, *styles)

Add more styles.



canBeReplaced(self, component)

True if the current component can be replaced by component.

This function can be redefined by derived classes.



canHaveChild(self, component)

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

This function is redefined by container classes.



copyAttributes(self, srcNode, dstNode)

Copy relevant attribute nodes from srcNode to dstNode.



copyImplicitAttributes(self, srcNode, dstNode, dstComp)

Copy relevant implicit attribute nodes from srcNode to dstNode.



getAttribute(self, node, attribute)


getRect(self, obj)

Return bounding box coordinates for obj.



getTreeImageId(self, node)


getTreeText(self, node)


isContainer(self)

True if component is a container (can have child nodes).



makeTestWin(self, res, name)

Method can be overrided by derived classes to create custom test view.

Parameters:
  • resxrc.XmlResource object with current test resource.
  • name – XRC ID of tested object.


setParamClass(self, attrName, paramClass)

Set special attribute panel class for editing attribute value.

Parameters:
  • attrName – Attribute name.
  • paramClass – Param class.


setSpecial(self, attrName, attrClass)

Set special attribute class for processing XML.

Parameters:
  • attrName – Attribute name.
  • attrClass – Attribute class.