From 7cb992adc4becdca01c650d274ce92bd2fb92aed Mon Sep 17 00:00:00 2001 From: Joel Collins Date: Fri, 14 Jun 2019 17:17:34 +0100 Subject: [PATCH] Added example API schema --- .../default/camera_calibration/plugin.py | 20 +++++++++++++++++-- 1 file changed, 18 insertions(+), 2 deletions(-) diff --git a/openflexure_microscope/plugins/default/camera_calibration/plugin.py b/openflexure_microscope/plugins/default/camera_calibration/plugin.py index 6b56c5fe..ccd0cd2c 100644 --- a/openflexure_microscope/plugins/default/camera_calibration/plugin.py +++ b/openflexure_microscope/plugins/default/camera_calibration/plugin.py @@ -7,12 +7,26 @@ import logging from .recalibrate_utils import recalibrate_camera, auto_expose_and_freeze_settings +API_SCHEMA = { + 'icon': 'lifesaver', + 'requireConnection': True, + 'forms': [ + { + 'route': '/recalibrate', + 'schema': [ + { + 'fieldType': "htmlBlock", + 'name': "heading", + 'content': "This is different form in a plugin!" + } + ] + } + ] +} class RecalibrateAPIView(MicroscopeViewPlugin): def post(self): payload = JsonPayload(request) - - # TODO: Figure out the range of z values to use logging.info("Starting microscope recalibration...") task = self.microscope.task.start(self.plugin.recalibrate) @@ -30,6 +44,8 @@ class Plugin(MicroscopePlugin): '/recalibrate': RecalibrateAPIView, } + api_schema = API_SCHEMA + def recalibrate(self): """Reset the camera's settings.