Inherits from
- HasTraits: enthought.traits.has_traits.HasTraits
Attributes
- application
The application that the plugin is part of.
application = Instance('enthought.envisage.core.application.Application')
- id
The plugin's globally unique identifier.
id = Str
- preferences
The plugin's user preferences.
preferences = Property(Instance(Preferences))
- PREFERENCES_FILE
The name of the plugin's user preferences file.
PREFERENCES_FILE = 'preferences'
- state_location
The plugin's state location is a directory on the local filesystem that the plugin can read and write to at will. By default, the plugin's preferences are stored in here.
state_location = Property(Str)
Inherited from base classes
Method summary
- bind_preference(self, obj, trait_name, preference_name = None, preferences = None, default = None)
- extension_added(self, extension)
- get_class(self, class_path)
- get_extensions(self, extension_point_id, plugin_id = None)
- get_service(self, interface, query = None)
- get_services(self, interface, query = None)
- import_symbol(self, symbol_path)
- load_extensions(self, extension_point_id, plugin_id = None)
- lookup_application_object(self, uol)
- publish_application_object(self, uol, obj, properties = None)
- register_service(self, interface, obj, properties = None)
- save_preferences(self)
- start(self, application)
- stop(self, application)
- unregister_all_services(self)
- unregister_service(self, service_id)
Inherited from base classes
- __deepcopy__(self, memo)
- __getstate__(self)
- __prefix_trait__(self, name)
- __reduce_ex__(self, protocol)
- __setstate__(self, state)
- add_class_trait(cls, name, *trait)
- add_trait(self, name, *trait)
- add_trait_category(cls, category)
- add_trait_listener(self, object, prefix = '')
- all_trait_names(self)
- base_trait(self, name)
- class_default_traits_view(cls)
- class_editable_traits(cls)
- class_trait_names(cls, **metadata)
- class_trait_view(cls, name = None, view_element = None)
- class_trait_view_elements(cls)
- class_traits(cls, **metadata)
- clone_traits(self, traits = None, memo = None, copy = None, **metadata)
- configure_traits(self, filename = None, view = None, kind = None, edit = True, context = None, handler = None, id = '', scrollable = None, **args)
- copy_traits(self, other, traits = None, memo = None, copy = None, **metadata)
- copyable_trait_names(self, **metadata)
- default_traits_view(self)
- edit_traits(self, view = None, parent = None, kind = None, context = None, handler = None, id = '', scrollable = None, **args)
- editable_traits(self)
- get(self, *names, **metadata)
- on_trait_change(self, handler, name = None, remove = False, dispatch = 'same')
- print_traits(self, show_help = False, **metadata)
- remove_trait(self, name)
- remove_trait_listener(self, object, prefix = '')
- reset_traits(self, traits = None, **metadata)
- set(self, trait_change_notify = True, **traits)
- set_trait_dispatch_handler(cls, name, klass, override = False)
- sync_trait(self, trait_name, object, alias = None, mutual = True, remove = False)
- trait(self, name, force = False, copy = False)
- trait_context(self)
- trait_monitor(cls, handler, remove = False)
- trait_names(self, **metadata)
- trait_subclasses(cls, all = False)
- trait_view(self, name = None, view_element = None)
- trait_view_elements(self)
- trait_views(self, klass = None)
- traits(self, **metadata)
- validate_trait(self, name, value)
Methods
- bind_preference(self, obj, trait_name, preference_name = None, preferences = None, default = None)
Sets up a preference binding.
A preference binding synchronizes a preference value with a trait on an object.
If the preference name is None, the trait name is used.
If the preferences instance is None the plugin's preferences are used.
- extension_added(self, extension)
Responds to new extensions added in the extension registry.
- get_class(self, class_path)
Returns the class defined by class_path.
Returns None if the class has not yet been loaded.
- get_extensions(self, extension_point_id, plugin_id = None)
Returns a list of all extensions made to an extension point.
- get_service(self, interface, query = None)
Returns at most one service that matches the specified query.
Returns None if no such service is found.
NOTE: Don't try to guess which one it will return -- the algorithm used by this method is subject to change without notice!
- get_services(self, interface, query = None)
Returns all services that match the specified query.
If no services match the query, then an empty list is returned.
- import_symbol(self, symbol_path)
Imports the symbol defined by symbol_path.
Parameters
- symbol_path : a string in the form 'foo.bar.baz'
- The module path to a symbol to import.
The symbol_path value is turned into an import statement 'from foo.bar import baz' (i.e., the last component of the name is the symbol name, the rest is the module path to load it from).
- load_extensions(self, extension_point_id, plugin_id = None)
Returns a list of all extensions made to an extension point.
The difference between this and get_extensions() is that this method will make sure that the plugin that contributed each extension has been started.
Parameters
- extension_point_id : a class that is derived from ExtensionPoint
- The extension point whose extensions are retrieved.
- plugin_id : a plugin ID
- If specified, only this plugin's extensions to the extension point are returned
- lookup_application_object(self, uol)
Resolve a UOL (Universal Object Locator) to produce an actual object.
For 'lookup' the UOL can be:
- 'service://a_service_identifier'
- 'name://a/path/through/the/naming/service'
- 'factory://package.module.callable'
- 'import://package.module.symbol'
- 'file://the/pathname/of/a/file/containing/a/UOL'
- 'http://a/URL/pointing/to/a/text/document/containing/a/UOL'
fixme: This mechanism needs to be extensible with new UOL protocols.
- publish_application_object(self, uol, obj, properties = None)
Publish an object via a UOL.
For 'publishing' the UOL can be:
- 'service://a_service_identifier'
- 'name://a/path/through/the/naming/service'
fixme: This mechanism needs to be extensible with new UOL protocols.
- register_service(self, interface, obj, properties = None)
Registers a service that implements the specified interface.
Returns a service ID (a unique ID for the service within the application).
- save_preferences(self)
Saves the plugin's user preferences.
This method actually saves only preferences that the user has changed from the plugin defaults.
- start(self, application)
Starts the plugin.
Can be called manually, but is usually called exactly once when the plugin is first required.
- stop(self, application)
Stops the plugin.
Can be called manually, but is usually called exactly once when the application exits.
Notes
- Envisage takes care of unregistering any services that were offered by the plugin, so you don't have to do anything here for that.
- The default implementation calls save_preferences().
- unregister_all_services(self)
Unregisters all services offered by the plugin.
- unregister_service(self, service_id)
Unregisters a service.