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 50 51
|
#------------------------------------------------------------------------------
# Copyright (c) 2013-2025, Nucleic Development Team.
#
# Distributed under the terms of the Modified BSD License.
#
# The full license is in the file LICENSE, distributed with this software.
#------------------------------------------------------------------------------
from atom.api import Atom, Typed
from .plugin_manifest import PluginManifest
class Plugin(Atom):
""" A base class for defining workbench plugins.
"""
#: A reference to the plugin manifest instance which declared the
#: plugin. This is assigned by the framework and should never be
#: manipulated by user code.
manifest = Typed(PluginManifest)
@property
def workbench(self):
""" Get the workbench which is handling the plugin.
"""
return self.manifest.workbench
def start(self):
""" Start the life-cycle of the plugin.
This method will be called by the workbench after it creates
the plugin. The default implementation does nothing and can be
ignored by subclasses which do not need life-cycle behavior.
This method should never be called by user code.
"""
pass
def stop(self):
""" Stop the life-cycle of the plugin.
This method will be called by the workbench when the plugin is
removed. The default implementation does nothing and can be
ignored by subclasses which do not need life-cycle behavior.
This method should never be called by user code.
"""
pass
|