From c0828cee1e9b74166712b6f05449d0328f76a700 Mon Sep 17 00:00:00 2001 From: Joel Collins Date: Fri, 23 Nov 2018 17:13:48 +0000 Subject: [PATCH] Added example/test plugin --- openflexure_microscope/plugins/__init__.py | 1 + .../plugins/default/test_plugin/__init__.py | 31 +++++++++++++++++++ 2 files changed, 32 insertions(+) create mode 100644 openflexure_microscope/plugins/__init__.py create mode 100644 openflexure_microscope/plugins/default/test_plugin/__init__.py diff --git a/openflexure_microscope/plugins/__init__.py b/openflexure_microscope/plugins/__init__.py new file mode 100644 index 00000000..7d1f1cfc --- /dev/null +++ b/openflexure_microscope/plugins/__init__.py @@ -0,0 +1 @@ +from .loader import search_plugin_dirs, find_plugins, load_plugin, PluginMount, MicroscopePlugin \ No newline at end of file diff --git a/openflexure_microscope/plugins/default/test_plugin/__init__.py b/openflexure_microscope/plugins/default/test_plugin/__init__.py new file mode 100644 index 00000000..7bd18bf3 --- /dev/null +++ b/openflexure_microscope/plugins/default/test_plugin/__init__.py @@ -0,0 +1,31 @@ +from openflexure_microscope.plugins import MicroscopePlugin + + +class FirstPlugin(MicroscopePlugin): + """ + An example Microscope plugin. + """ + def run(self): + """ + Demonstrate access to Microscope.camera, and Microscope.stage + """ + print("Parent camera:") + print(self.camera) + + print("Parent stage:") + print(self.stage) + + +class OtherPlugin(MicroscopePlugin): + """ + An example of a second Microscope plugin, loaded from the same plugin file. + """ + def run(self): + print("Stage plugin parent stage:") + print(self.stage) + + +PLUGINS = { + 'test1': FirstPlugin, + 'test2': OtherPlugin, +} #: dict: Dictionary describing the plugins. Keys are the names of the plugin's namescape, with a value corresponding to the class of that plugin. \ No newline at end of file