Merge branch 'skip-vs-next-in-cal' into 'v3'
Skip buttons on calibration wizard Closes #403 See merge request openflexure/openflexure-microscope-server!433
This commit is contained in:
commit
5fd16bd113
6 changed files with 84 additions and 21 deletions
|
|
@ -11,6 +11,7 @@
|
|||
:modal-progress="actionData.modal_progress"
|
||||
@response="actionResponse"
|
||||
@error="modalError"
|
||||
@finished="actionFinished"
|
||||
/>
|
||||
</template>
|
||||
|
||||
|
|
@ -33,11 +34,27 @@ export default {
|
|||
},
|
||||
|
||||
methods: {
|
||||
actionResponse: function () {
|
||||
/**
|
||||
* Runs when the ActionButton's action completes successfully.
|
||||
*
|
||||
* It is used to send success notifications. It also forwards the response to the
|
||||
* parent.
|
||||
*/
|
||||
actionResponse: function (response) {
|
||||
if (this.actionData.notify_on_success) {
|
||||
this.modalNotify(this.actionData.success_message);
|
||||
this.$emit("response", response);
|
||||
}
|
||||
},
|
||||
/**
|
||||
* Runs when the ActionButton's action finishes in any way (error, cancel,
|
||||
* completion).
|
||||
*
|
||||
* This forwards the event to the parent
|
||||
*/
|
||||
actionFinished: function () {
|
||||
this.$emit("finished");
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -27,6 +27,7 @@ gets very confusing.
|
|||
v-if="currentStep"
|
||||
:key="stepIndex"
|
||||
v-bind="currentStep.props"
|
||||
@awaiting-user="handleAwaitingUser"
|
||||
/>
|
||||
<p class="uk-text-right">
|
||||
<button
|
||||
|
|
@ -68,6 +69,7 @@ export default {
|
|||
data() {
|
||||
return {
|
||||
stepIndex: this.startOnLast ? this.steps.length - 1 : 0,
|
||||
stepAwaitingUser: false,
|
||||
};
|
||||
},
|
||||
|
||||
|
|
@ -79,7 +81,11 @@ export default {
|
|||
return !this.first || this.stepIndex > 0;
|
||||
},
|
||||
nextButtonText() {
|
||||
return this.final && this.stepIndex === this.steps.length - 1 ? "Finish" : "Next";
|
||||
const isLastStep = this.final && this.stepIndex === this.steps.length - 1;
|
||||
if (this.stepAwaitingUser) {
|
||||
return isLastStep ? "Skip and Finish" : "Skip";
|
||||
}
|
||||
return isLastStep ? "Finish" : "Next";
|
||||
},
|
||||
},
|
||||
|
||||
|
|
@ -88,6 +94,7 @@ export default {
|
|||
* Move to the previous step in this task, or the previous task if first step.
|
||||
*/
|
||||
previousStep: function () {
|
||||
this.stepAwaitingUser = false;
|
||||
if (this.stepIndex > 0) {
|
||||
this.stepIndex = this.stepIndex - 1;
|
||||
} else {
|
||||
|
|
@ -99,6 +106,7 @@ export default {
|
|||
* Move to the next step in this task, or the next task if final step.
|
||||
*/
|
||||
nextStep: function () {
|
||||
this.stepAwaitingUser = false;
|
||||
if (this.stepIndex < this.steps.length - 1) {
|
||||
this.stepIndex = this.stepIndex + 1;
|
||||
return true;
|
||||
|
|
@ -106,6 +114,9 @@ export default {
|
|||
this.$emit("next");
|
||||
}
|
||||
},
|
||||
handleAwaitingUser(isAwaiting) {
|
||||
this.stepAwaitingUser = isAwaiting;
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
|
|
|||
|
|
@ -6,7 +6,11 @@
|
|||
|
||||
<template #below-stream>
|
||||
<div class="action-button-container">
|
||||
<cameraCalibrationSettings :show-extra-settings="false" :camera-uri="cameraUri" />
|
||||
<cameraCalibrationSettings
|
||||
:show-extra-settings="false"
|
||||
:camera-uri="cameraUri"
|
||||
@actionFinished="checkCalibrationState"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
</stepTemplateWithStream>
|
||||
|
|
@ -29,6 +33,17 @@ export default {
|
|||
return `${this.$store.getters.baseUri}/camera/`;
|
||||
},
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.checkCalibrationState();
|
||||
},
|
||||
|
||||
methods: {
|
||||
async checkCalibrationState() {
|
||||
const needsCal = await this.readThingProperty("camera", "calibration_required");
|
||||
this.$emit("awaiting-user", needsCal);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
|
|
|
|||
|
|
@ -6,7 +6,10 @@
|
|||
<p>If it is not in focus, click back and re-focus.</p>
|
||||
<template #below-stream>
|
||||
<div class="action-button-container">
|
||||
<CSMCalibrationSettings :show-extra-settings="false" />
|
||||
<CSMCalibrationSettings
|
||||
:show-extra-settings="false"
|
||||
@recalibrateResponse="checkCalibrationState"
|
||||
/>
|
||||
</div>
|
||||
</template>
|
||||
</stepTemplateWithStream>
|
||||
|
|
@ -23,6 +26,17 @@ export default {
|
|||
stepTemplateWithStream,
|
||||
CSMCalibrationSettings,
|
||||
},
|
||||
|
||||
mounted() {
|
||||
this.checkCalibrationState();
|
||||
},
|
||||
|
||||
methods: {
|
||||
async checkCalibrationState() {
|
||||
const needsCal = await this.readThingProperty("camera_stage_mapping", "calibration_required");
|
||||
this.$emit("awaiting-user", needsCal);
|
||||
},
|
||||
},
|
||||
};
|
||||
</script>
|
||||
|
||||
|
|
|
|||
|
|
@ -104,24 +104,30 @@ export default {
|
|||
"camera_stage_mapping",
|
||||
"image_to_stage_displacement_matrix",
|
||||
);
|
||||
this.csmResolution = await this.readThingProperty("camera_stage_mapping", "image_resolution");
|
||||
let streamResolution = await this.readThingProperty("camera", "stream_resolution");
|
||||
csmMatrix[0][0] = Number(csmMatrix[0][0].toFixed(3));
|
||||
csmMatrix[0][1] = Number(csmMatrix[0][1].toFixed(3));
|
||||
csmMatrix[1][0] = Number(csmMatrix[1][0].toFixed(3));
|
||||
csmMatrix[1][1] = Number(csmMatrix[1][1].toFixed(3));
|
||||
this.csmMatrix = csmMatrix;
|
||||
this.csmRatio = Number((Math.abs(csmMatrix[1][0]) + Math.abs(csmMatrix[0][1])) / 2).toFixed(
|
||||
3,
|
||||
);
|
||||
this.csmFOV = [
|
||||
Number(((streamResolution[0] ** 2 * this.csmRatio) / this.csmResolution[1]).toFixed(0)),
|
||||
Number(((streamResolution[1] ** 2 * this.csmRatio) / this.csmResolution[0]).toFixed(0)),
|
||||
];
|
||||
if (csmMatrix) {
|
||||
this.csmResolution = await this.readThingProperty(
|
||||
"camera_stage_mapping",
|
||||
"image_resolution",
|
||||
);
|
||||
csmMatrix[0][0] = Number(csmMatrix[0][0].toFixed(3));
|
||||
csmMatrix[0][1] = Number(csmMatrix[0][1].toFixed(3));
|
||||
csmMatrix[1][0] = Number(csmMatrix[1][0].toFixed(3));
|
||||
csmMatrix[1][1] = Number(csmMatrix[1][1].toFixed(3));
|
||||
this.csmMatrix = csmMatrix;
|
||||
this.csmRatio = Number((Math.abs(csmMatrix[1][0]) + Math.abs(csmMatrix[0][1])) / 2).toFixed(
|
||||
3,
|
||||
);
|
||||
// Note [1] then [0] as CSM reports resolution as (y, x)
|
||||
this.csmFOV = [
|
||||
Number((this.csmResolution[1] * this.csmRatio).toFixed(0)),
|
||||
Number((this.csmResolution[0] * this.csmRatio).toFixed(0)),
|
||||
];
|
||||
}
|
||||
},
|
||||
onRecalibrateResponse: function () {
|
||||
onRecalibrateResponse: function (response) {
|
||||
this.modalNotify("Finished stage-to-camera calibration.");
|
||||
this.updateDisplayedCSM();
|
||||
this.$emit("recalibrateResponse", response);
|
||||
},
|
||||
},
|
||||
};
|
||||
|
|
|
|||
|
|
@ -6,7 +6,7 @@
|
|||
:key="'primary_cal' + index"
|
||||
class="uk-child-width-expand"
|
||||
>
|
||||
<server-specified-action-button :action-data="action" />
|
||||
<server-specified-action-button :action-data="action" @finished="$emit('actionFinished')" />
|
||||
</div>
|
||||
<div v-if="showExtraSettings">
|
||||
<div
|
||||
|
|
@ -14,7 +14,7 @@
|
|||
:key="'secondary_cal' + index"
|
||||
class="uk-child-width-expand"
|
||||
>
|
||||
<server-specified-action-button :action-data="action" />
|
||||
<server-specified-action-button :action-data="action" @finished="$emit('actionFinished')" />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue