Updated to new Action tasks
This commit is contained in:
parent
28e555ad9b
commit
eaf4cf09f5
9 changed files with 27 additions and 65 deletions
|
|
@ -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
|
||||
|
|
@ -70,10 +69,8 @@ def timelapse(microscope, n_images, t_between):
|
|||
@ThingAction
|
||||
class TimelapseAPI(View):
|
||||
"""
|
||||
Take a series of images in a timelapse, running as a background task
|
||||
Take a series of images in a timelapse
|
||||
"""
|
||||
|
||||
@marshal_task # Shorthand for marshaling with a pre-made Task object schema
|
||||
@use_args(
|
||||
{
|
||||
"n_images": fields.Integer(
|
||||
|
|
@ -88,13 +85,11 @@ class TimelapseAPI(View):
|
|||
# Find our microscope component
|
||||
microscope = find_component("org.openflexure.microscope")
|
||||
|
||||
# Create and start "timelapse", running in a background task
|
||||
task = taskify(timelapse)(
|
||||
# Start "timelapse"
|
||||
return timelapse(
|
||||
microscope, args.get("n_images"), args.get("t_between")
|
||||
)
|
||||
|
||||
return task
|
||||
|
||||
|
||||
## Create extension
|
||||
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue