Fixed passing non-integers into preview window params
This commit is contained in:
parent
951cfb6bb0
commit
6b3dca9f61
1 changed files with 6 additions and 3 deletions
|
|
@ -2,7 +2,7 @@ from openflexure_microscope.api.utilities import JsonPayload
|
||||||
from openflexure_microscope.api.v1.views import MicroscopeView
|
from openflexure_microscope.api.v1.views import MicroscopeView
|
||||||
|
|
||||||
from flask import jsonify, request
|
from flask import jsonify, request
|
||||||
|
import logging
|
||||||
|
|
||||||
class GPUPreviewAPI(MicroscopeView):
|
class GPUPreviewAPI(MicroscopeView):
|
||||||
|
|
||||||
|
|
@ -39,11 +39,14 @@ class GPUPreviewAPI(MicroscopeView):
|
||||||
payload = JsonPayload(request)
|
payload = JsonPayload(request)
|
||||||
|
|
||||||
window = payload.param('window', default=[])
|
window = payload.param('window', default=[])
|
||||||
fullscreen = False
|
logging.debug(window)
|
||||||
|
|
||||||
if len(window) != 4 or not all(isinstance(n, int) for n in window):
|
if len(window) != 4:
|
||||||
fullscreen = True
|
fullscreen = True
|
||||||
window = None
|
window = None
|
||||||
|
else:
|
||||||
|
fullscreen = False
|
||||||
|
window = [int(w) for w in window]
|
||||||
|
|
||||||
self.microscope.camera.start_preview(fullscreen=fullscreen, window=window)
|
self.microscope.camera.start_preview(fullscreen=fullscreen, window=window)
|
||||||
elif operation == "stop":
|
elif operation == "stop":
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue