envisage.extension_point_binding module

A binding between a trait on an object and an extension point.

class envisage.extension_point_binding.ExtensionPointBinding(**traits)[source]

Bases: HasTraits

A binding between a trait on an object and an extension point.

envisage.extension_point_binding.bind_extension_point(obj, trait_name, extension_point_id, extension_registry)[source]

Create a binding to an extension point.

The returned ExtensionPointBinding object is also stored in a (private) global dictionary, so that users aren’t required to keep a reference to it. That global dictionary entry can be removed with a matching call to unbind_extension_point.

Parameters:
  • obj (HasTraits) – The HasTraits object that we’re binding to

  • trait_name (str) – The name of the trait on obj to bind to.

  • extension_point_id (str) – The id of the extension point.

  • extension_registry (IExtensionRegistry) – The extension registry that the extension point is registered to.

Returns:

An object that manages the binding.

Return type:

ExtensionPointBinding

envisage.extension_point_binding.unbind_extension_point(obj, trait_name, extension_point_id, extension_registry)[source]

Remove an extension point binding.

Changes to extension point contributions will no longer affect the target trait. Also removes the matching ExtensionPointBinding object from the global dictionary.

Parameters:
  • obj (HasTraits) – The HasTraits object that we’re binding to

  • trait_name (str) – The name of the trait on obj to bind to.

  • extension_point_id (str) – The id of the extension point.

  • extension_registry (IExtensionRegistry) – The extension registry that the extension point is registered to.