From 71b5c685ca6a308f1efae62c5190cae9597f0f86 Mon Sep 17 00:00:00 2001 From: Joel Collins Date: Wed, 12 Dec 2018 15:01:57 +0000 Subject: [PATCH] Created new MicroscopeViewPlugin class to give shortcut to an associated MicroscopePlugin --- openflexure_microscope/api/v1/views.py | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/openflexure_microscope/api/v1/views.py b/openflexure_microscope/api/v1/views.py index 43d12982..f223e592 100644 --- a/openflexure_microscope/api/v1/views.py +++ b/openflexure_microscope/api/v1/views.py @@ -10,4 +10,17 @@ class MicroscopeView(MethodView): """ self.microscope = microscope - MethodView.__init__(self, **kwargs) \ No newline at end of file + MethodView.__init__(self, **kwargs) + + +class MicroscopeViewPlugin(MicroscopeView): + + def __init__(self, microscope, plugin=None, **kwargs): + """ + Create a generic MethodView with a globally available + microscope object passed as an argument, and a plugin + reference stored in 'self'. Initially None + """ + self.plugin = plugin + + MicroscopeView.__init__(self, microscope=microscope, **kwargs) \ No newline at end of file