Component plugins
Each interface element available in XRCed is defined using a component
plugin. This permits easy extension to include new XRC format features
and classes and using custom application-specific components.
A component plugin is actually a (singleton) object of Component
class or one of derived classes, containing the data essential for
constructing the visual interface for editing element attributes and
defining its behaviour with respect to other components. Components
must be registered with the component manager Manager object.
Defining component plugins
Defining component plugins
There are two ways to define component plugins.
- Creating an object of one of component classes in a Python module
(optionally defining a new class if a specific behaviour which cannot
be provided by the standard classes) is needed. XRCed looks in standard
plugins directory (in XRCed installation directory)
and in each of the directories in XRCEDPATH environment variable.
It tries to import all Python files, except with names starting with
underscore ('_'). It then looks in sub-directories which contain
__init__.py and imports them using *-mode (so it's
possible to group plugins by directory without listing too many in
XRCEDPATH).
- Another option to define a plugin is to use an XML manifest
file. This can be used for simple plugins which do not require defining
new component classes or component groups. The structure of this CRX
file is very similar to a flat XRC file having only top-level nodes
defined using component tag instead of object (that's
why it is called CRX and uses .crx extention). This is done so that
CRX files can be edited using XRCed, if you don't want to edit XML
by hand. A special command-line options -m or --meta
should be used when starting XRCed to include support for so-called
meta-components. Attributes of meta-components correspond to
the constructor parameters of Component classes (class name must be
one of known component classes). It is possible to include normal
interface elements in the same CRX file, for easy testing of new plugins.
Please refer to the wxPyWiki documentation for further information
and examples about component plugins.