Updated to new Action tasks

This commit is contained in:
Joel Collins 2020-05-12 11:29:53 +01:00
parent 28e555ad9b
commit eaf4cf09f5
9 changed files with 27 additions and 65 deletions

View file

@ -9,7 +9,6 @@ from labthings.server.decorators import (
PropertySchema,
ThingAction,
doc_response,
marshal_task,
)
from labthings.server.schema import Schema
from labthings.server import fields
@ -74,8 +73,6 @@ class TimelapseAPI(View):
"""
Take a series of images in a timelapse, running as a background task
"""
@marshal_task # Shorthand for marshaling with a pre-made Task object schema
@use_args(
{
"n_images": fields.Integer(
@ -91,12 +88,10 @@ class TimelapseAPI(View):
microscope = find_component("org.openflexure.microscope")
# Create and start "timelapse", running in a background task
task = taskify(timelapse)(
return timelapse(
microscope, args.get("n_images"), args.get("t_between")
)
return task
## Extension GUI (OpenFlexure eV)
# Alternate form without any dynamic parts