Added example/test plugin
This commit is contained in:
parent
0f47d0dca7
commit
c0828cee1e
2 changed files with 32 additions and 0 deletions
1
openflexure_microscope/plugins/__init__.py
Normal file
1
openflexure_microscope/plugins/__init__.py
Normal file
|
|
@ -0,0 +1 @@
|
||||||
|
from .loader import search_plugin_dirs, find_plugins, load_plugin, PluginMount, MicroscopePlugin
|
||||||
|
|
@ -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.
|
||||||
Loading…
Add table
Add a link
Reference in a new issue