Added example API schema
This commit is contained in:
parent
8e0cdf3b11
commit
7cb992adc4
1 changed files with 18 additions and 2 deletions
|
|
@ -7,12 +7,26 @@ import logging
|
||||||
|
|
||||||
from .recalibrate_utils import recalibrate_camera, auto_expose_and_freeze_settings
|
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):
|
class RecalibrateAPIView(MicroscopeViewPlugin):
|
||||||
def post(self):
|
def post(self):
|
||||||
payload = JsonPayload(request)
|
payload = JsonPayload(request)
|
||||||
|
|
||||||
# TODO: Figure out the range of z values to use
|
|
||||||
|
|
||||||
logging.info("Starting microscope recalibration...")
|
logging.info("Starting microscope recalibration...")
|
||||||
task = self.microscope.task.start(self.plugin.recalibrate)
|
task = self.microscope.task.start(self.plugin.recalibrate)
|
||||||
|
|
@ -30,6 +44,8 @@ class Plugin(MicroscopePlugin):
|
||||||
'/recalibrate': RecalibrateAPIView,
|
'/recalibrate': RecalibrateAPIView,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
api_schema = API_SCHEMA
|
||||||
|
|
||||||
def recalibrate(self):
|
def recalibrate(self):
|
||||||
"""Reset the camera's settings.
|
"""Reset the camera's settings.
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue