File: plugin_activator.py

package info (click to toggle)
python-envisagecore 3.1.2-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 1,096 kB
  • ctags: 1,063
  • sloc: python: 4,115; makefile: 7; sh: 5
file content (49 lines) | stat: -rw-r--r-- 1,358 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
""" The default plugin activator. """


# Enthought library imports.
from enthought.traits.api import HasTraits, implements

# Local imports.
from i_plugin_activator import IPluginActivator


class PluginActivator(HasTraits):
    """ The default plugin activator. """

    implements(IPluginActivator)
    
    ###########################################################################
    # 'IPluginActivator' interface.
    ###########################################################################

    def start_plugin(self, plugin):
        """ Start the specified plugin. """

        # Connect all of the plugin's extension point traits so that the plugin
        # will be notified if and when contributions are added or removed.
        plugin.connect_extension_point_traits()

        # Register all services.
        plugin.register_services()

        # Plugin specific start.
        plugin.start()
        
        return

    def stop_plugin(self, plugin):
        """ Stop the specified plugin. """

        # Plugin specific stop.
        plugin.stop()

        # Unregister all service.
        plugin.unregister_services()

        # Disconnect all of the plugin's extension point traits.
        plugin.disconnect_extension_point_traits()

        return

#### EOF ######################################################################