Switched to ActionView and PropertyView from decorators
This commit is contained in:
parent
677b08d509
commit
1819ca6a9c
18 changed files with 57 additions and 98 deletions
|
|
@ -1,5 +1,5 @@
|
|||
from openflexure_microscope.api.utilities import get_bool, JsonResponse
|
||||
from labthings.server.view import View
|
||||
from labthings.server.view import View, ActionView
|
||||
from labthings.server.find import find_component
|
||||
from labthings.server.decorators import (
|
||||
use_args,
|
||||
|
|
@ -20,8 +20,7 @@ import io
|
|||
from flask import request, abort, url_for, redirect, send_file
|
||||
|
||||
|
||||
@ThingAction
|
||||
class CaptureAPI(View):
|
||||
class CaptureAPI(ActionView):
|
||||
"""
|
||||
Create a new image capture.
|
||||
"""
|
||||
|
|
@ -75,8 +74,7 @@ class CaptureAPI(View):
|
|||
|
||||
|
||||
|
||||
@ThingAction
|
||||
class RAMCaptureAPI(View):
|
||||
class RAMCaptureAPI(ActionView):
|
||||
"""
|
||||
Take a non-persistant image capture.
|
||||
"""
|
||||
|
|
@ -124,8 +122,7 @@ class RAMCaptureAPI(View):
|
|||
return send_file(io.BytesIO(stream.getbuffer()), mimetype="image/jpeg")
|
||||
|
||||
|
||||
@ThingAction
|
||||
class GPUPreviewStartAPI(View):
|
||||
class GPUPreviewStartAPI(ActionView):
|
||||
"""
|
||||
Start the onboard GPU preview.
|
||||
Optional "window" parameter can be passed to control the position and size of the preview window,
|
||||
|
|
@ -157,8 +154,7 @@ class GPUPreviewStartAPI(View):
|
|||
return microscope.state
|
||||
|
||||
|
||||
@ThingAction
|
||||
class GPUPreviewStopAPI(View):
|
||||
class GPUPreviewStopAPI(ActionView):
|
||||
def post(self):
|
||||
"""
|
||||
Stop the onboard GPU preview.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
from openflexure_microscope.api.utilities import JsonResponse
|
||||
from labthings.server.view import View
|
||||
from labthings.server.view import View, ActionView
|
||||
from labthings.server.find import find_component
|
||||
from labthings.server.decorators import use_args, marshal_with, doc, ThingAction
|
||||
from labthings.server import fields
|
||||
|
|
@ -11,8 +11,7 @@ from flask import Blueprint, request
|
|||
import logging
|
||||
|
||||
|
||||
@ThingAction
|
||||
class MoveStageAPI(View):
|
||||
class MoveStageAPI(ActionView):
|
||||
@use_args(
|
||||
{
|
||||
"absolute": fields.Boolean(
|
||||
|
|
@ -56,8 +55,7 @@ class MoveStageAPI(View):
|
|||
return microscope.state["stage"]["position"]
|
||||
|
||||
|
||||
@ThingAction
|
||||
class ZeroStageAPI(View):
|
||||
class ZeroStageAPI(ActionView):
|
||||
def post(self):
|
||||
"""
|
||||
Zero the stage coordinates.
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
from labthings.server.view import View
|
||||
from labthings.server.view import View, ActionView
|
||||
import subprocess
|
||||
import os
|
||||
from sys import platform
|
||||
|
|
@ -14,8 +14,7 @@ def is_raspberrypi(raise_on_errors=False):
|
|||
return os.path.exists("/usr/bin/raspi-config")
|
||||
|
||||
|
||||
@ThingAction
|
||||
class ShutdownAPI(View):
|
||||
class ShutdownAPI(ActionView):
|
||||
"""
|
||||
Attempt to shutdown the device
|
||||
"""
|
||||
|
|
@ -35,8 +34,7 @@ class ShutdownAPI(View):
|
|||
return {"out": out, "err": err}, 201
|
||||
|
||||
|
||||
@ThingAction
|
||||
class RebootAPI(View):
|
||||
class RebootAPI(ActionView):
|
||||
"""
|
||||
Attempt to reboot the device
|
||||
"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue