Added route for camera zoom
This commit is contained in:
parent
f70da25c1c
commit
0c5af96890
2 changed files with 57 additions and 3 deletions
|
|
@ -1,55 +0,0 @@
|
|||
from openflexure_microscope.api.v1.views import MicroscopeView
|
||||
from openflexure_microscope.api.utilities import JsonPayload
|
||||
|
||||
from flask import Response, Blueprint, jsonify, request, abort, url_for, redirect, send_file
|
||||
|
||||
class OverlayAPI(MicroscopeView):
|
||||
|
||||
def get(self):
|
||||
"""
|
||||
Get overlay text
|
||||
|
||||
.. :quickref: Overlay; Get camera overlay text
|
||||
|
||||
:>header Accept: application/json
|
||||
|
||||
:<header Content-Type: application/json
|
||||
:status 200: preview started/stopped
|
||||
"""
|
||||
text = self.microscope.camera.camera.annotate_text
|
||||
size = self.microscope.camera.camera.annotate_text_size
|
||||
|
||||
return jsonify({'text': text, 'size': size})
|
||||
|
||||
def post(self):
|
||||
"""
|
||||
Set overlay text
|
||||
|
||||
.. :quickref: Overlay; Set camera overlay text
|
||||
|
||||
**Example requests**:
|
||||
|
||||
.. sourcecode:: http
|
||||
|
||||
POST /camera/overlay HTTP/1.1
|
||||
Accept: application/json
|
||||
|
||||
{
|
||||
"text": "2019/01/15 14:48",
|
||||
"size": 50
|
||||
}
|
||||
|
||||
:>header Accept: application/json
|
||||
|
||||
:<header Content-Type: application/json
|
||||
:status 200: preview started/stopped
|
||||
"""
|
||||
|
||||
payload = JsonPayload(request)
|
||||
text = payload.param('text', default="", convert=str)
|
||||
size = payload.param('size', default=50, convert=int)
|
||||
|
||||
self.microscope.camera.camera.annotate_text = text
|
||||
self.microscope.camera.camera.annotate_text_size = size
|
||||
|
||||
return jsonify({'text': text, 'size': size})
|
||||
Loading…
Add table
Add a link
Reference in a new issue