Capture list now persists through server restart

This commit is contained in:
Joel Collins 2019-01-22 11:23:15 +00:00
parent 334bf3822e
commit 4e985fe80d
5 changed files with 124 additions and 50 deletions

View file

@ -143,7 +143,7 @@ function getStagePositions() {
}
// Capture methods
function newCapture(filename, keep_on_disk, use_video_port, bayer, resizeWidth=null, resizeHeight=null) {
function newCapture(filename, temporary, use_video_port, bayer, resizeWidth=null, resizeHeight=null) {
// Make a position request
function newCaptureCallback(response, status) {
if (status != 200) {
@ -155,7 +155,7 @@ function newCapture(filename, keep_on_disk, use_video_port, bayer, resizeWidth=n
payload = {
"filename": filename,
"keep_on_disk": keep_on_disk,
"temporary": temporary,
"use_video_port": use_video_port,
"bayer": bayer
}
@ -173,7 +173,7 @@ function newCapture(filename, keep_on_disk, use_video_port, bayer, resizeWidth=n
function newCaptureFromInput() {
captureFilenameInput = document.getElementById('captureFilenameInput');
captureKeepOnDiskCheck = document.getElementById('captureKeepOnDiskCheck');
captureTemporaryCheck = document.getElementById('captureTemporaryCheck');
captureFullResolutionCheck = document.getElementById('captureFullResolutionCheck');
captureBayerCheck = document.getElementById('captureBayerCheck')
@ -200,7 +200,7 @@ function newCaptureFromInput() {
newCapture(
filename,
captureKeepOnDiskCheck.checked,
captureTemporaryCheck.checked,
!(captureFullResolutionCheck.checked),
captureBayerCheck.checked,
resizeWidth,

View file

@ -91,7 +91,7 @@
<h2>Capture</h2>
Filename: <br>
<input type="text" id="captureFilenameInput" placeholder="Leave blank for default"><br>
Store on Pi: <input type="checkbox" id="captureKeepOnDiskCheck"><br>
Temporary: <input type="checkbox" id="captureTemporaryCheck"><br>
Full resolution: <input type="checkbox" id="captureFullResolutionCheck"><br>
Keep raw data: <input type="checkbox" id="captureBayerCheck"><br>
Resize capture: <input type="checkbox" id="captureResizeCheck" onclick="newCaptureResizeToggle(this);"><br>

View file

@ -68,7 +68,7 @@ class ListAPI(MicroscopeView):
{
"filename": "myfirstcapture",
"keep_on_disk": true,
"temporary": false,
"use_video_port": true,
"bayer": true,
"size": {
@ -80,7 +80,7 @@ class ListAPI(MicroscopeView):
:>header Accept: application/json
:<json string filename: filename of stored capture
:<json boolean keep_on_disk: keep the capture file on microscope after closing
:<json boolean temporary: delete the capture file on microscope after closing
:<json boolean use_video_port: capture still image from the video port
:<json boolean bayer: keep raw capture data in the image file
:<json json size: - **x** *(int)*: x-axis resize
@ -89,7 +89,7 @@ class ListAPI(MicroscopeView):
:>json boolean available: availability of capture data
:>json string filename: filename of capture
:>json string id: unique id of the capture object
:>json boolean keep_on_disk: keep the capture file on microscope after closing
:>json boolean temporary: delete the capture file on microscope after closing
:>json boolean locked: file locked for modifications (mostly used for video recording)
:>json string path: path on pi storage to the capture file, if available
:>json boolean stream: capture stored in-memory as a BytesIO stream
@ -102,7 +102,7 @@ class ListAPI(MicroscopeView):
payload = JsonPayload(request)
filename = payload.param('filename')
keep_on_disk = payload.param('keep_on_disk', default=True, convert=bool)
temporary = payload.param('temporary', default=True, convert=bool)
use_video_port = payload.param('use_video_port', default=False, convert=bool)
bayer = payload.param('bayer', default=True, convert=bool)
@ -115,7 +115,7 @@ class ListAPI(MicroscopeView):
output = self.microscope.camera.new_image(
write_to_file=True,
keep_on_disk=keep_on_disk,
temporary=temporary,
filename=filename)
self.microscope.camera.capture(