Debian Codegraph @

envisage/plugin_activator.py

raw
1 # (C) Copyright 2007-2025 Enthought, Inc., Austin, TX
2 # All rights reserved.
3 #
4 # This software is provided without warranty under the terms of the BSD
5 # license included in LICENSE.txt and may be redistributed only under
6 # the conditions described in the aforementioned license. The license
7 # is also available online at http://www.enthought.com/licenses/BSD.txt
8 #
9 # Thanks for using Enthought open source!
10 """ The default plugin activator. """
11
12
13 # Enthought library imports.
14 from traits.api import HasTraits, provides
15
16 # Local imports.
17 from .i_plugin_activator import IPluginActivator
18
19
20 @provides(IPluginActivator)
21 class PluginActivator(HasTraits):
22 """The default plugin activator."""
23
24 ###########################################################################
25 # 'IPluginActivator' interface.
26 ###########################################################################
27
28 def start_plugin(self, plugin):
29 """Start the specified plugin."""
30
31 # Connect all of the plugin's extension point traits so that the plugin
32 # will be notified if and when contributions are added or removed.
33 plugin.connect_extension_point_traits()
34
35 # Register all services.
36 plugin.register_services()
37
38 # Plugin specific start.
39 plugin.start()
40
41 def stop_plugin(self, plugin):
42 """Stop the specified plugin."""
43
44 # Plugin specific stop.
45 plugin.stop()
46
47 # Unregister all service.
48 plugin.unregister_services()
49
50 # Disconnect all of the plugin's extension point traits.
51 plugin.disconnect_extension_point_traits()