Added documentation for attaching plugins
This commit is contained in:
parent
034a45e400
commit
8e953e1064
2 changed files with 7 additions and 1 deletions
|
|
@ -25,7 +25,7 @@ class Microscope(object):
|
||||||
self.attach(camera, stage)
|
self.attach(camera, stage)
|
||||||
|
|
||||||
# Create plugin mountpoint
|
# Create plugin mountpoint
|
||||||
self.plugin = PluginMount(self)
|
self.plugin = PluginMount(self) #: :py:class:`openflexure_microscope.plugins.PluginMount`: Mounting point for all microscope plugins
|
||||||
|
|
||||||
def __enter__(self):
|
def __enter__(self):
|
||||||
"""Create microscope on context enter."""
|
"""Create microscope on context enter."""
|
||||||
|
|
|
||||||
|
|
@ -85,6 +85,12 @@ class PluginMount(object):
|
||||||
print("Creating plugin mount")
|
print("Creating plugin mount")
|
||||||
|
|
||||||
def attach(self, plugin_module):
|
def attach(self, plugin_module):
|
||||||
|
"""
|
||||||
|
Attach a MicroscopePlugin instance to the plugin mount.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
plugin_module: A loaded module to be attached. Module can be loaded using :py:meth:`openflexure_microscope.plugins.load_plugin`
|
||||||
|
"""
|
||||||
if not hasattr(plugin_module, 'PLUGINS') or not isinstance(plugin_module.PLUGINS, dict):
|
if not hasattr(plugin_module, 'PLUGINS') or not isinstance(plugin_module.PLUGINS, dict):
|
||||||
raise Exception("No falid PLUGINS dictionary found in {}".format(plugin_module))
|
raise Exception("No falid PLUGINS dictionary found in {}".format(plugin_module))
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue