Inherits from
- HasTraits: enthought.traits.has_traits.HasTraits
Attributes
- argv
The remaining command-line arguments after those required by Envisage itself have been removed.
argv = List(Str)
- extension_registry
The extension registry holds all extension points and extensions (which are normally defined in plugin definitions).
extension_registry = Instance(ExtensionRegistry, allow_none = False)
- gui
If the application requires a GUI, then this is the Pyface GUI that represents it. The type is declared as Any so that we don't have to import anything from Pyface if no GUI is required.
fixme: This should probably not be created here; but rather the application writer should create the GUI and then set this trait (and indeed, manage the starting of the event loop, etc.). In that case, the only reason to keep it as a trait on the application is to make it easy for parts of the application to get a reference to the GUI so they can get system metrics, etc. Of course we could then remove the 'requires_gui' and the 'splash_screen' traits.
gui = Any
- id
The application's globally unique identifier.
id = Str
- import_manager
The import manager handles importing symbols by name.
import_manager = Instance(ImportManager, (), allow_none = False)
- include
Plug-in definitions that other plugin definitions wish to import from, but that otherwise are not part of the application (that is, their extensions are not added to the extension registry, and they are never started).
Each item in this list is the absolute path to a plugin definition file.
include = List(Str)
- install_location
The name of the application's install location (i.e., the directory that contains this module).
install_location = Property(Str)
- plugin_activator
The plugin activator is responsible for starting and stopping plugin implementations.
plugin_activator = Instance(PluginActivator, allow_none = False)
- plugin_definition_loaded
Fired when a plugin definition has been loaded.
plugin_definition_loaded = Event(Instance(PluginDefinition))
- plugin_definition_loader
The plugin definition loader is responsible for the loading of plugin definitions. When definitions are loaded, they are automatically registered with the plugin definition registry.
plugin_definition_loader = Instance(PluginDefinitionLoader, allow_none = False)
- plugin_definition_registry
The plugin definition registry is the repository for all loaded plugin definitions.
plugin_definition_registry = Instance(PluginDefinitionRegistry, allow_none = False)
- plugin_definitions
The plugin definitions used in the application.
Each item in this list is the absolute path to a plugin definition file.
plugin_definitions = List(Str)
- plugin_started
Fired when a plugin has been started.
plugin_started = Event(Instance(Plugin))
- plugin_started
Fired when a plugin has been stopped.
plugin_started = Event(Instance(Plugin))
- plugin_starting
Fired when a plugin is about to be started.
plugin_starting = Event(Instance(Plugin))
- PLUGIN_STATE_DIR
A sub-directory of the application's state location, where we create a specific state location for each plugin (on demand).
PLUGIN_STATE_DIR = 'plugins'
- plugin_stopping
Fired when a plugin is about to be stopped.
plugin_stopping = Event(Instance(Plugin))
- requires_gui
Does this application require a GUI?
DEPRECATED: This will be removed in future releases; it is up to the application writer to create the GUI and start its event loop, etc.
requires_gui = Bool(True)
- service_registry
The service registry.
fixme: Currently, the service registry implementation is very simple; it should probably be expanded as a part of any OSGi-like effort.
service_registry = Instance(ServiceRegistry, (), allow_none = False)
- splash_screen
If the application requires a GUI, then this is the (optional) splash screen that is displayed while the application starts up. The type is Any so that nothing is imported from Pyface if a GUI is not required.
DEPRECATED: This will be removed in future releases; it is up to the application writer to create the GUI, show the splash screen, and start the event loop.
splash_screen = Any
- started
Fired when all plugins have been started, but before the GUI event loop is started, if there is a GUI.
started = Event(Instance('Application'))
- starting
Fired when the application is starting. This is the first thing that happens when the start() method is called.
starting = Event(Instance('Application'))
- state_location
The application's state location.
The state location is a directory on the local filesystem in which the application stores things such as configuration information, preferences, downloaded plugins, etc.
Plug-ins should not access this directory directly. Instead they should use the state location provided for them by the application. In a plugin, use self.state_location to get a directory that the plugin is free to read and write to.
state_location = Property(Str)
- stopped
Fired when all plugins have been stopped.
stopped = Event(Instance('Application'))
- stopping
Fired when the application is stopping. This is the first thing that happens when the stop() method is called.
stopping = VetoableEvent(Instance(VetoableApplicationEvent))
Inherited from base classes
Method summary
- __init__(self, **traits)
- get_class(self, class_path)
- get_extensions(self, extension_point_id, plugin_id = None)
- get_plugin_state_location(self, plugin)
- get_preferences(self, id)
- get_service(self, interface, query = None)
- get_service_ids(self)
- get_services(self, interface, query = None)
- import_symbol(self, symbol_path)
- load_extensions(self, extension_point_id, plugin_id = None)
- load_plugin_definition(self, filename)
- load_plugin_definitions(self, filenames)
- lookup_application_object(self, uol)
- publish_application_object(self, uol, obj, properties = None)
- register_service(self, interface, obj, properties = None)
- start(self)
- start_plugin(self, id)
- stop(self)
- stop_plugin(self, id)
- 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
- __init__(self, **traits)
Creates a new application.
There is exactly one Application object per application.
- 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 contributions made to an extension point.
- get_plugin_state_location(self, plugin)
Returns the name of a plugin's state location.
A 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.
- get_preferences(self, id)
Return preferences in a particular plugin given its ID Parameters: ----------- id: Str Returns: ------- preferences: Preferences
- get_service(self, interface, query = None)
Returns a service that implements the specified interface.
Raises a SystemError if no such service is found.
- get_service_ids(self)
Returns a list of the currrently registered service IDs.
fixme: This method name needs to be modified when we switch to using real interfaces for identifying services.
- 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 contributions made to an extension point.
The difference between this method and get_extensions() is that this method makes 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
- load_plugin_definition(self, filename)
Loads a plugin definition.
- load_plugin_definitions(self, filenames)
Loads a list of plugin definitions.
- 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 (Universal Object Locator).
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).
- start(self)
Starts the application.
- start_plugin(self, id)
Starts the plugin that has the specified ID.
Notes
- The plugin definition MUST have already been loaded.
- All plugins required by the plugin will also be started.
- If the plugin has already been started, then this does nothing.
- stop(self)
Stops the application.
- stop_plugin(self, id)
Stops the plugin that has the specified ID.
- unregister_service(self, service_id)
Unregisters a service.