Renamed Resource to View, and allow custom root links
This commit is contained in:
parent
234ebc1cbb
commit
a329b9197b
18 changed files with 90 additions and 67 deletions
|
|
@ -1,5 +1,5 @@
|
|||
from openflexure_microscope.api.utilities import get_bool, JsonResponse
|
||||
from openflexure_microscope.common.flask_labthings.resource import Resource
|
||||
from openflexure_microscope.common.flask_labthings.view import View
|
||||
from openflexure_microscope.common.flask_labthings.find import find_component
|
||||
from openflexure_microscope.common.flask_labthings.decorators import (
|
||||
use_args,
|
||||
|
|
@ -20,7 +20,7 @@ from flask import jsonify, request, abort, url_for, redirect, send_file
|
|||
|
||||
|
||||
@ThingAction
|
||||
class CaptureAPI(Resource):
|
||||
class CaptureAPI(View):
|
||||
"""
|
||||
Create a new image capture.
|
||||
"""
|
||||
|
|
@ -86,7 +86,7 @@ class CaptureAPI(Resource):
|
|||
|
||||
|
||||
@ThingAction
|
||||
class GPUPreviewStartAPI(Resource):
|
||||
class GPUPreviewStartAPI(View):
|
||||
"""
|
||||
Start the onboard GPU preview.
|
||||
Optional "window" parameter can be passed to control the position and size of the preview window,
|
||||
|
|
@ -119,7 +119,7 @@ class GPUPreviewStartAPI(Resource):
|
|||
|
||||
|
||||
@ThingAction
|
||||
class GPUPreviewStopAPI(Resource):
|
||||
class GPUPreviewStopAPI(View):
|
||||
def post(self):
|
||||
"""
|
||||
Stop the onboard GPU preview.
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
from openflexure_microscope.api.utilities import JsonResponse
|
||||
from openflexure_microscope.common.flask_labthings.resource import Resource
|
||||
from openflexure_microscope.common.flask_labthings.view import View
|
||||
from openflexure_microscope.common.flask_labthings.find import find_component
|
||||
from openflexure_microscope.common.flask_labthings.decorators import (
|
||||
use_args,
|
||||
|
|
@ -17,7 +17,7 @@ import logging
|
|||
|
||||
|
||||
@ThingAction
|
||||
class MoveStageAPI(Resource):
|
||||
class MoveStageAPI(View):
|
||||
@use_args(
|
||||
{
|
||||
"absolute": fields.Boolean(
|
||||
|
|
@ -62,7 +62,7 @@ class MoveStageAPI(Resource):
|
|||
|
||||
|
||||
@ThingAction
|
||||
class ZeroStageAPI(Resource):
|
||||
class ZeroStageAPI(View):
|
||||
def post(self):
|
||||
"""
|
||||
Zero the stage coordinates.
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
from openflexure_microscope.common.flask_labthings.resource import Resource
|
||||
from openflexure_microscope.common.flask_labthings.view import View
|
||||
import subprocess
|
||||
import os
|
||||
from sys import platform
|
||||
|
|
@ -18,7 +18,7 @@ def is_raspberrypi(raise_on_errors=False):
|
|||
|
||||
|
||||
@ThingAction
|
||||
class ShutdownAPI(Resource):
|
||||
class ShutdownAPI(View):
|
||||
"""
|
||||
Attempt to shutdown the device
|
||||
"""
|
||||
|
|
@ -34,7 +34,7 @@ class ShutdownAPI(Resource):
|
|||
|
||||
|
||||
@ThingAction
|
||||
class RebootAPI(Resource):
|
||||
class RebootAPI(View):
|
||||
"""
|
||||
Attempt to reboot the device
|
||||
"""
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue