envisage.plugin module

The default implementation of the ‘IPlugin’ interface.

class envisage.plugin.Plugin[source]

Bases: ExtensionProvider

The default implementation of the ‘IPlugin’ interface.

This class is intended to be subclassed for each plugin that you create.

activator = Instance(IPluginActivator, PluginActivator())

The activator used to start and stop the plugin.

By default the same activator instance is used for all plugins of this type.

application = Instance(IApplication)

The application that the plugin is part of.

connect_extension_point_traits()[source]

Connect all of the plugin’s extension points.

This means that the plugin will be notified if and when contributions are add or removed.

disconnect_extension_point_traits()[source]

Disconnect all of the plugin’s extension points.

extension_registry = Property(Instance(IExtensionRegistry))

The extension registry that the object’s extension points are stored in.

get_extension_points()[source]

Return the extension points offered by the provider.

get_extensions(extension_point_id)[source]

Return the provider’s extensions to an extension point.

home = Str

The name of a directory (created for you) that the plugin can read and write to at will.

id = Str

The plugin’s unique identifier.

If no identifier is specified then the module and class name of the plugin are used to create an Id with the form ‘module_name.class_name’.

name = Str

The plugin’s name (suitable for displaying to the user).

If no name is specified then the plugin’s class name is used with an attempt made to turn camel-case class names into words separated by spaces (e.g. if the class name is ‘MyPlugin’ then the name would be ‘My Plugin’). Of course, if you really care about the actual name, then just set it!

register_services()[source]

Register the services offered by the plugin.

service_registry = Property(Instance(IServiceRegistry))

The service registry that the object’s services are stored in.

start()[source]

Start the plugin.

This method will always be empty so that you never have to call ‘super().start()’ if you provide an implementation in a derived class.

The framework does what it needs to do when it starts a plugin by means of the plugin’s activator.

stop()[source]

Stop the plugin.

This method will always be empty so that you never have to call ‘super().stop()’ if you provide an implementation in a derived class.

The framework does what it needs to do when it stops a plugin by means of the plugin’s activator.

unregister_services()[source]

Unregister any service offered by the plugin.