Debian Codegraph @

envisage/i_plugin.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 plugin interface. """
11
12
13 # Enthought library imports.
14 from traits.api import Instance, Interface, Str
15
16 # Local imports.
17 from .i_plugin_activator import IPluginActivator
18
19
20 class IPlugin(Interface):
21 """The plugin interface."""
22
23 #: The activator used to start and stop the plugin.
24 activator = Instance(IPluginActivator)
25
26 #: The application that the plugin is part of.
27 application = Instance("envisage.api.IApplication")
28
29 #: The name of a directory (created for you) that the plugin can read and
30 #: write to at will.
31 home = Str
32
33 #: The plugin's unique identifier.
34 #:
35 #: Where 'unique' technically means 'unique within the plugin manager', but
36 #: since the chances are that you will want to include plugins from
37 #: external sources, this really means 'globally unique'! Using the Python
38 #: package path might be useful here. e.g. 'envisage'.
39 id = Str
40
41 #: The plugin's name (suitable for displaying to the user).
42 name = Str
43
44 def start(self):
45 """Start the plugin.
46
47 This method is called by the framework when the application is starting
48 up. If you want to start a plugin manually use::
49
50 application.start_plugin(plugin)
51
52 """
53
54 def stop(self):
55 """Stop the plugin.
56
57 This method is called by the framework when the application is
58 stopping. If you want to stop a plugin manually use::
59
60 application.stop_plugin(plugin)
61
62 """