Loading openflexure_microscope/api/app.py +3 −0 Original line number Diff line number Diff line Loading @@ -129,6 +129,9 @@ labthing.add_view( ) labthing.add_root_link(views.ConfigurationProperty, "instrumentConfiguration") # Attach stage resources labthing.add_view(views.StageTypeProperty, "/properties/stage/type") # Attach streams resources labthing.add_view(views.MjpegStream, f"/streams/mjpeg") Loading openflexure_microscope/api/v2/views/__init__.py +1 −0 Original line number Diff line number Diff line Loading @@ -2,3 +2,4 @@ from .actions import enabled_root_actions from .captures import * from .instrument import * from .streams import * from .stage import * openflexure_microscope/api/v2/views/actions/__init__.py +0 −5 Original line number Diff line number Diff line Loading @@ -39,11 +39,6 @@ _actions = { "view_class": stage.ZeroStageAPI, "conditions": True, }, "setStage": { "rule" : "/stage/type/", "view_class": stage.StageTypeAPI, "conditions": True, }, "shutdown": { "rule": "/system/shutdown/", "view_class": system.ShutdownAPI, Loading openflexure_microscope/api/v2/views/actions/stage.py +0 −18 Original line number Diff line number Diff line Loading @@ -66,22 +66,4 @@ class ZeroStageAPI(ActionView): # TODO: Make schema for microscope state return microscope.state["stage"] class StageTypeAPI(ActionView): args = { "stage_type": fields.String(missing = None, example = "SangaStage", description = "The stage geometry [SangaStage, SangaDeltaStage]") } def post(self,args): """ Set the stage geometry. """ microscope = find_component("org.openflexure.microscope") microscope.set_stage(stage_type=args.get("stage_type")) return {"stage_type": microscope.configuration["stage"]["type"]} def get(self): """ Get the stage geometry. """ microscope = find_component("org.openflexure.microscope") return {"stage_type": microscope.configuration["stage"]["type"]} openflexure_microscope/api/v2/views/stage.py 0 → 100644 +26 −0 Original line number Diff line number Diff line from labthings import find_component, fields, schema from labthings.views import PropertyView import logging class StageTypeProperty(PropertyView): """The type of the stage""" def get(self): """ Get the stage geometry. """ microscope = find_component("org.openflexure.microscope") return microscope.configuration['stage']['type'] schema = fields.String(missing=None, example="SangaStage", description="The stage geometry [SangaStage, SangaDeltaStage]") def put(self,stage_type): """ Set the stage geometry. """ microscope = find_component("org.openflexure.microscope") microscope.set_stage(stage_type=stage_type) return microscope.configuration["stage"]["type"] Loading
openflexure_microscope/api/app.py +3 −0 Original line number Diff line number Diff line Loading @@ -129,6 +129,9 @@ labthing.add_view( ) labthing.add_root_link(views.ConfigurationProperty, "instrumentConfiguration") # Attach stage resources labthing.add_view(views.StageTypeProperty, "/properties/stage/type") # Attach streams resources labthing.add_view(views.MjpegStream, f"/streams/mjpeg") Loading
openflexure_microscope/api/v2/views/__init__.py +1 −0 Original line number Diff line number Diff line Loading @@ -2,3 +2,4 @@ from .actions import enabled_root_actions from .captures import * from .instrument import * from .streams import * from .stage import *
openflexure_microscope/api/v2/views/actions/__init__.py +0 −5 Original line number Diff line number Diff line Loading @@ -39,11 +39,6 @@ _actions = { "view_class": stage.ZeroStageAPI, "conditions": True, }, "setStage": { "rule" : "/stage/type/", "view_class": stage.StageTypeAPI, "conditions": True, }, "shutdown": { "rule": "/system/shutdown/", "view_class": system.ShutdownAPI, Loading
openflexure_microscope/api/v2/views/actions/stage.py +0 −18 Original line number Diff line number Diff line Loading @@ -66,22 +66,4 @@ class ZeroStageAPI(ActionView): # TODO: Make schema for microscope state return microscope.state["stage"] class StageTypeAPI(ActionView): args = { "stage_type": fields.String(missing = None, example = "SangaStage", description = "The stage geometry [SangaStage, SangaDeltaStage]") } def post(self,args): """ Set the stage geometry. """ microscope = find_component("org.openflexure.microscope") microscope.set_stage(stage_type=args.get("stage_type")) return {"stage_type": microscope.configuration["stage"]["type"]} def get(self): """ Get the stage geometry. """ microscope = find_component("org.openflexure.microscope") return {"stage_type": microscope.configuration["stage"]["type"]}
openflexure_microscope/api/v2/views/stage.py 0 → 100644 +26 −0 Original line number Diff line number Diff line from labthings import find_component, fields, schema from labthings.views import PropertyView import logging class StageTypeProperty(PropertyView): """The type of the stage""" def get(self): """ Get the stage geometry. """ microscope = find_component("org.openflexure.microscope") return microscope.configuration['stage']['type'] schema = fields.String(missing=None, example="SangaStage", description="The stage geometry [SangaStage, SangaDeltaStage]") def put(self,stage_type): """ Set the stage geometry. """ microscope = find_component("org.openflexure.microscope") microscope.set_stage(stage_type=stage_type) return microscope.configuration["stage"]["type"]