Added example API schema

This commit is contained in:
Joel Collins 2019-06-14 17:17:34 +01:00
parent 8e0cdf3b11
commit 7cb992adc4

View file

@ -7,13 +7,27 @@ 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': "<b>This is different form in a plugin!</b>"
}
]
}
]
}
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.