From 8e953e106469507e13ffbcfcfda4af0bbee30d42 Mon Sep 17 00:00:00 2001 From: Joel Collins Date: Fri, 23 Nov 2018 17:40:36 +0000 Subject: [PATCH] Added documentation for attaching plugins --- openflexure_microscope/microscope.py | 2 +- openflexure_microscope/plugins/loader.py | 6 ++++++ 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/openflexure_microscope/microscope.py b/openflexure_microscope/microscope.py index a5e51930..8c016101 100644 --- a/openflexure_microscope/microscope.py +++ b/openflexure_microscope/microscope.py @@ -25,7 +25,7 @@ class Microscope(object): self.attach(camera, stage) # 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): """Create microscope on context enter.""" diff --git a/openflexure_microscope/plugins/loader.py b/openflexure_microscope/plugins/loader.py index 883f1f82..63b8fd8c 100644 --- a/openflexure_microscope/plugins/loader.py +++ b/openflexure_microscope/plugins/loader.py @@ -85,6 +85,12 @@ class PluginMount(object): print("Creating plugin mount") 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): raise Exception("No falid PLUGINS dictionary found in {}".format(plugin_module))