Renamed devices to components

This commit is contained in:
Joel Collins 2020-01-13 11:08:05 +00:00
parent 6b99873d53
commit 4003e4e65c
11 changed files with 60 additions and 50 deletions

View file

@ -1,6 +1,6 @@
from openflexure_microscope.api.utilities import get_bool, JsonResponse
from openflexure_microscope.common.flask_labthings.resource import Resource
from openflexure_microscope.common.flask_labthings.find import find_device
from openflexure_microscope.common.flask_labthings.find import find_component
from openflexure_microscope.common.flask_labthings.decorators import (
use_args,
marshal_with,
@ -48,7 +48,7 @@ class CaptureAPI(Resource):
"""
Create a new capture
"""
microscope = find_device("org.openflexure.microscope")
microscope = find_component("org.openflexure.microscope")
resize = args.get("resize", None)
if resize:
@ -100,7 +100,7 @@ class GPUPreviewStartAPI(Resource):
"""
Start the onboard GPU preview.
"""
microscope = find_device("org.openflexure.microscope")
microscope = find_component("org.openflexure.microscope")
window = args.get("window")
logging.debug(window)
@ -124,7 +124,7 @@ class GPUPreviewStopAPI(Resource):
"""
Stop the onboard GPU preview.
"""
microscope = find_device("org.openflexure.microscope")
microscope = find_component("org.openflexure.microscope")
microscope.camera.stop_preview()
# TODO: Make schema for microscope status
return jsonify(microscope.status)

View file

@ -1,6 +1,6 @@
from openflexure_microscope.api.utilities import JsonResponse
from openflexure_microscope.common.flask_labthings.resource import Resource
from openflexure_microscope.common.flask_labthings.find import find_device
from openflexure_microscope.common.flask_labthings.find import find_component
from openflexure_microscope.common.flask_labthings.decorators import (
use_args,
marshal_with,
@ -32,7 +32,7 @@ class MoveStageAPI(Resource):
"""
Move the microscope stage in x, y, z
"""
microscope = find_device("org.openflexure.microscope")
microscope = find_component("org.openflexure.microscope")
# Handle absolute positioning (calculate a relative move from current position and target)
if (args.get("absolute")) and (microscope.stage): # Only if stage exists
@ -68,7 +68,7 @@ class ZeroStageAPI(Resource):
Zero the stage coordinates.
Does not move the stage, but rather makes the current position read as [0, 0, 0]
"""
microscope = find_device("org.openflexure.microscope")
microscope = find_component("org.openflexure.microscope")
microscope.stage.zero_position()
# TODO: Make schema for microscope status

View file

@ -11,7 +11,7 @@ from openflexure_microscope.common.flask_labthings.utilities import (
)
from openflexure_microscope.common.flask_labthings.decorators import marshal_with
from openflexure_microscope.common.flask_labthings.find import find_device
from openflexure_microscope.common.flask_labthings.find import find_component
from marshmallow import pre_dump
@ -71,7 +71,7 @@ class CaptureList(Resource):
@marshal_with(CaptureSchema(many=True))
def get(self):
microscope = find_device("org.openflexure.microscope")
microscope = find_component("org.openflexure.microscope")
image_list = microscope.camera.images
return image_list
@ -83,7 +83,7 @@ class CaptureResource(Resource):
@marshal_with(CaptureSchema())
def get(self, id):
microscope = find_device("org.openflexure.microscope")
microscope = find_component("org.openflexure.microscope")
capture_obj = microscope.camera.image_from_id(id)
if not capture_obj:
@ -92,7 +92,7 @@ class CaptureResource(Resource):
return capture_obj
def delete(self, id):
microscope = find_device("org.openflexure.microscope")
microscope = find_component("org.openflexure.microscope")
capture_obj = microscope.camera.image_from_id(id)
if not capture_obj:
@ -110,7 +110,7 @@ class CaptureDownload(Resource):
def get(self, id, filename):
microscope = find_device("org.openflexure.microscope")
microscope = find_component("org.openflexure.microscope")
capture_obj = microscope.camera.image_from_id(id)
if not capture_obj:
@ -146,7 +146,7 @@ class CaptureTags(Resource):
def get(self, id):
microscope = find_device("org.openflexure.microscope")
microscope = find_component("org.openflexure.microscope")
capture_obj = microscope.camera.image_from_id(id)
if not capture_obj:
@ -156,7 +156,7 @@ class CaptureTags(Resource):
def put(self, id):
microscope = find_device("org.openflexure.microscope")
microscope = find_component("org.openflexure.microscope")
capture_obj = microscope.camera.image_from_id(id)
if not capture_obj:
@ -173,7 +173,7 @@ class CaptureTags(Resource):
def delete(self, capture_id):
microscope = find_device("org.openflexure.microscope")
microscope = find_component("org.openflexure.microscope")
capture_obj = microscope.camera.image_from_id(id)
if not capture_obj:
@ -196,7 +196,7 @@ class CaptureMetadata(Resource):
"""
def get(self, id):
microscope = find_device("org.openflexure.microscope")
microscope = find_component("org.openflexure.microscope")
capture_obj = microscope.camera.image_from_id(id)
if not capture_obj:
@ -205,7 +205,7 @@ class CaptureMetadata(Resource):
return jsonify(capture_obj.metadata)
def put(self, id):
microscope = find_device("org.openflexure.microscope")
microscope = find_component("org.openflexure.microscope")
capture_obj = microscope.camera.image_from_id(id)
if not capture_obj: