Commit 4003e4e6 authored by Joel Collins's avatar Joel Collins
Browse files

Renamed devices to components

parent 6b99873d
Loading
Loading
Loading
Loading
+4 −4
Original line number Diff line number Diff line
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.extensions import BaseExtension
from openflexure_microscope.common.flask_labthings.resource import Resource
from openflexure_microscope.common.flask_labthings.decorators import (
@@ -294,7 +294,7 @@ def fast_up_down_up_autofocus(

class MeasureSharpnessAPI(Resource):
    def post(self):
        microscope = find_device("org.openflexure.microscope")
        microscope = find_component("org.openflexure.microscope")

        if not microscope:
            abort(503, "No microscope connected. Unable to measure sharpness.")
@@ -310,7 +310,7 @@ class AutofocusAPI(Resource):

    def post(self):
        payload = JsonResponse(request)
        microscope = find_device("org.openflexure.microscope")
        microscope = find_component("org.openflexure.microscope")

        if not microscope:
            abort(503, "No microscope connected. Unable to autofocus.")
@@ -337,7 +337,7 @@ class FastAutofocusAPI(Resource):

    def post(self):
        payload = JsonResponse(request)
        microscope = find_device("org.openflexure.microscope")
        microscope = find_component("org.openflexure.microscope")

        if not microscope:
            abort(503, "No microscope connected. Unable to autofocus.")
+2 −2
Original line number Diff line number Diff line
@@ -6,7 +6,7 @@ from functools import reduce

from openflexure_microscope.camera.base import generate_basename
from openflexure_microscope.common.flask_labthings.find import (
    find_device,
    find_component,
    find_extension,
)
from openflexure_microscope.common.flask_labthings.extensions import BaseExtension
@@ -360,7 +360,7 @@ class TileScanAPI(Resource):
    )
    @marshal_task
    def post(self, args):
        microscope = find_device("org.openflexure.microscope")
        microscope = find_component("org.openflexure.microscope")

        if not microscope:
            abort(503, "No microscope connected. Unable to autofocus.")
+2 −2
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@ import zipfile
import tempfile
import logging

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.resource import Resource
from openflexure_microscope.common.flask_labthings.extensions import BaseExtension
from openflexure_microscope.common.flask_labthings.decorators import (
@@ -100,7 +100,7 @@ class ZipBuilderAPIView(Resource):
    def post(self):

        ids = list(JsonResponse(request).json)
        microscope = find_device("org.openflexure.microscope")
        microscope = find_component("org.openflexure.microscope")

        task = taskify(default_zip_manager.build_zip_from_capture_ids)(microscope, ids)

+2 −2
Original line number Diff line number Diff line
@@ -93,7 +93,7 @@ class TestDoAPIView(Resource):


# Using the dynamic form
dynamic_test_extension_v2 = BaseExtension("dynamic_test_extension")
dynamic_test_extension_v2 = BaseExtension("org.openflexure.examples.dynamic-gui")
dynamic_test_extension_v2.add_view(
    TestAPIView, "/get", endpoint="dynamic_test_extension_get"
)
@@ -107,7 +107,7 @@ dynamic_test_extension_v2.add_meta(


# Using the static form
static_test_extension_v2 = BaseExtension("static_test_extension")
static_test_extension_v2 = BaseExtension("org.openflexure.examples.static-gui")
static_test_extension_v2.add_view(
    TestAPIView, "/get", endpoint="static_test_extension_get"
)
+4 −4
Original line number Diff line number Diff line
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)
Loading