envisage.i_extension_registry module

The interface for extension registries.

class envisage.i_extension_registry.IExtensionRegistry[source]

Bases: traits.has_traits.Interface

The interface for extension registries.

add_extension_point(extension_point)[source]

Add an extension point.

If an extension point already exists with this Id then it is simply replaced.

add_extension_point_listener(listener, extension_point_id=None)[source]

Add a listener for extensions being added or removed.

A listener is any Python callable with the following signature:

def listener(extension_registry, extension_point_changed_event):

      ...

If an extension point is specified then the listener will only be called when extensions are added to or removed from that extension point (the extension point may or may not have been added to the registry at the time of this call).

If no extension point is specified then the listener will be called when extensions are added to or removed from any extension point.

When extensions are added or removed all specific listeners are called first (in arbitrary order), followed by all non-specific listeners (again, in arbitrary order).

get_extension_point(extension_point_id)[source]

Return the extension point with the specified Id.

Return None if no such extension point exists.

get_extension_points()[source]

Return all extension points that have been added to the registry.

get_extensions(extension_point_id)[source]

Return the extensions contributed to an extension point.

Return an empty list if the extension point does not exist.

remove_extension_point(extension_point_id)[source]

Remove an extension point.

Raise an ‘UnknownExtensionPoint’ exception if no extension point exists with the specified Id.

remove_extension_point_listener(listener, extension_point_id=None)[source]

Remove a listener for extensions being added or removed.

Raise a ‘ValueError’ if the listener does not exist.

set_extensions(extension_point_id, extensions)[source]

Set the extensions contributed to an extension point.