export video/image

This commit is contained in:
2026-05-15 16:14:26 +02:00
parent 4fb7fa8fd3
commit 7760d7ae7c
13 changed files with 183 additions and 149 deletions
@@ -0,0 +1,6 @@
{% for ss in experiments %}
<div>
<input class="" type="radio" name="_expid" value="{{ ss.id }}" {% if ss.id == current_experiment.id %}checked{% endif %} onchange="this.form.submit()" >
<label>{{ ss }}</label>
</div>
{% endfor %}
@@ -16,18 +16,15 @@
{% endfor %}
</select>
<div class="w3-margin-left w3-margin-bottom">
{% for ss in experiments %}
<input class="" type="radio" name="_expid" value="{{ ss.id }}" {% if ss.id == current_experiment.id %}checked{% endif %} onchange="this.form.submit()" >
<label>{{ ss.multiwell }}</label>
{% endfor %}
{% include "scanner/experiment-inc.html" %}
</div>
{% if current_session.id and current_experiment %}
{% multiwell_cards current_session.id current_experiment %}
{% endif %}
</form>
{% if current_session.id %}
<a href="#" class="w3-bar-item w3-btn w3-hover-opacity" onclick="download_all_images()">
<i class="fa-solid fa-file-export w3-text-red w3-xlarge"></i> {% trans "Exporter l'ensemble des images" %}<br>
<a href="#" class="w3-bar-item w3-btn w3-hover-opacity" onclick="download_all_images({{ current_session.id }})">
<i class="fa-solid fa-file-export w3-text-red w3-xlarge"></i> {% trans "Exporter l'ensemble des images de la session" %}<br>
<span class="w3-margin-left">{{ export_destination }}
</a>
{% endif %}
@@ -65,7 +62,8 @@
const duration = parseInt("{{ duration }}");
const uuid_btn = sId("btn-" + "{{ uuid }}");
const image_endpoint = "{% url 'scanner:export_api' %}";
const sid = parseInt("{{ cursid }}");
const export_msg = "{% trans "Confirmer l'export des images." %}";
const export_msg_long = "{% trans "ATTENTION le processus peut être long!" %}";
function setGridColumns(col) { container.style.setProperty("--grid-columns", col); updateActiveButton(col); }
function handleMultiwell(b) { b.classList.add('w3-green'); }
@@ -78,7 +76,7 @@
}
function image_save(name, img) {
const ok = confirm(`Télécharger le fichier ?\n\n${name}`);
const ok = confirm(export_msg);
if (!ok) return false;
fetch(img)
.then(res => res.blob())
@@ -94,7 +92,9 @@
});
}
function download_all_images() {
function download_all_images(sid) {
const ok = confirm(export_msg +' '+ export_msg_long);
if (!ok) return false;
fetch(image_endpoint, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
@@ -109,7 +109,8 @@
})
.catch(error => {
console.error('Erreur:', error);
});
});
}
setGridColumns(columns);
if (uuid_btn)
@@ -17,10 +17,7 @@
{% endfor %}
</select>
<div class="w3-margin-left w3-margin-bottom">
{% for ss in experiments %}
<input class="" type="radio" name="_expid" value="{{ ss.id }}" {% if ss.id == current_experiment.id %}checked{% endif %} onchange="this.form.submit()" >
<label>{{ ss.multiwell }}</label>
{% endfor %}
{% include "scanner/experiment-inc.html" %}
</div>
{% if current_session.id and current_experiment %}
@@ -28,7 +25,7 @@
{% endif %}
</form>
{% if current_session.id %}
<a href="#" class="w3-bar-item w3-btn w3-hover-opacity" onclick="download_all_videos()">
<a href="#" class="w3-bar-item w3-btn w3-hover-opacity" onclick="download_all_videos({{ current_session.id }})">
<i class="fa-solid fa-file-export w3-text-red w3-xlarge"></i> {% trans "Exporter l'ensemble des vidéos" %}<br>
<span class="w3-margin-left">{{ export_destination }}</span>
</a>
@@ -78,9 +75,12 @@
const ws_route = "{{ ws_route }}";
const uuid_btn = sId("btn-" + "{{ uuid }}");
const image_endpoint = "{% url 'scanner:export_api' %}";
const sid = parseInt("{{ cursid }}");
const export_msg = "{% trans "Confirmer l'export des vidéos. ATTENTION le processus peut être long!" %}";
function download_all_videos() {
function download_all_videos(sid) {
const ok = confirm(export_msg);
if (!ok) return false;
fetch(image_endpoint, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
@@ -51,7 +51,8 @@
</div>
{% endif %}
<div class="w3-col">
<div id="_well_btn" class="w3-margin-top"></div>
<div id="_well_state" class="w3-margin-top w3-small w3-text-amber w3-justify"></div>
<div id="_well_btn"></div>
</div>
<div class="w3-col">
<button id="_halt" class="w3-button w3-red w3-round-large w3-margin-top w3-block">
@@ -63,8 +64,8 @@
<div class="w3-margin-top w3-padding-small w3-small">
<span id="_ts"></span>
</div>
<div class="w3-margin-top w3-small w3-center w3-justify">
<span id="_scan_state" class="w3-text-amber w3-padding"></span>
<div class="w3-margin-top w3-small">
<span id="_scan_state" class="w3-text-amber w3-padding w3-justify"></span>
</div>
</div>
</div>
@@ -100,7 +101,9 @@
frame_count : sId("_count"),
scan_state : sId("_scan_state"),
simulate : sId("_simulate"),
well_btn : sId("_well_btn")
well_btn : sId("_well_btn"),
well_state : sId("_well_state")
};
</script>
<script src="/static/scanner/js/scanning.js"></script>