Commit 7cb992ad authored by Joel Collins's avatar Joel Collins
Browse files

Added example API schema

parent 8e0cdf3b
Loading
Loading
Loading
Loading
+18 −2
Original line number Diff line number Diff line
@@ -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.