diff --git a/src/openflexure_microscope_server/things/camera/simulation.py b/src/openflexure_microscope_server/things/camera/simulation.py index 7c32aa08..b93b9c78 100644 --- a/src/openflexure_microscope_server/things/camera/simulation.py +++ b/src/openflexure_microscope_server/things/camera/simulation.py @@ -86,6 +86,11 @@ class SimulatedCamera(BaseCamera): self.generate_blobs() self.generate_canvas() + @lt.thing_property + def calibration_required(self) -> bool: + """Whether the camera needs calibrating.""" + return not self.background_detector_status.ready + def validate_inputs(self) -> None: """Validate the inputs passed to the simulation, and raises an error if invalid. @@ -367,6 +372,22 @@ class SimulatedCamera(BaseCamera): LOGGER.warning(f"Simulation camera camera doesn't respect {stream_name=}") return Image.fromarray(self.generate_frame()) + @lt.thing_action + def full_auto_calibrate(self, portal: lt.deps.BlockingPortal) -> None: + """Perform a full auto-calibration. + + For the simulation microscope the process is: + + * ``remove_sample`` + * ``set_background`` + * ``load_sample`` + """ + self.remove_sample() + time.sleep(0.2) + self.set_background(portal) + time.sleep(0.2) + self.load_sample() + @lt.thing_action def remove_sample(self) -> None: """Show the simulated background with no sample.""" @@ -381,6 +402,15 @@ class SimulatedCamera(BaseCamera): raise RuntimeError("Sample is already in place.") self._show_sample = True + @lt.thing_property + def primary_calibration_actions(self) -> list[ActionButton]: + """The calibration actions for both calibration wizard and settings panel.""" + return [ + action_button_for( + self.full_auto_calibrate, submit_label="Full Auto Calibrate" + ), + ] + @lt.thing_property def secondary_calibration_actions(self) -> list[ActionButton]: """The calibration actions that appear only in settings panel.""" diff --git a/webapp/src/components/modalComponents/calibrationWizard.vue b/webapp/src/components/modalComponents/calibrationWizard.vue index 92f121f8..446e3b03 100644 --- a/webapp/src/components/modalComponents/calibrationWizard.vue +++ b/webapp/src/components/modalComponents/calibrationWizard.vue @@ -22,6 +22,8 @@ diff --git a/webapp/src/components/modalComponents/calibrationWizardComponents/cameraCalibrationSteps/cameraMainCalibrationStep.vue b/webapp/src/components/modalComponents/calibrationWizardComponents/cameraCalibrationSteps/cameraMainCalibrationStep.vue new file mode 100644 index 00000000..7089adeb --- /dev/null +++ b/webapp/src/components/modalComponents/calibrationWizardComponents/cameraCalibrationSteps/cameraMainCalibrationStep.vue @@ -0,0 +1,34 @@ + + + diff --git a/webapp/src/components/modalComponents/calibrationWizardComponents/cameraCalibrationTask.vue b/webapp/src/components/modalComponents/calibrationWizardComponents/cameraCalibrationTask.vue new file mode 100644 index 00000000..be5d4e83 --- /dev/null +++ b/webapp/src/components/modalComponents/calibrationWizardComponents/cameraCalibrationTask.vue @@ -0,0 +1,41 @@ + + + diff --git a/webapp/src/components/modalComponents/calibrationWizardComponents/finalStep.vue b/webapp/src/components/modalComponents/calibrationWizardComponents/finalStep.vue new file mode 100644 index 00000000..edf59bc4 --- /dev/null +++ b/webapp/src/components/modalComponents/calibrationWizardComponents/finalStep.vue @@ -0,0 +1,17 @@ + + + diff --git a/webapp/src/components/modalComponents/calibrationWizardComponents/singleStepTask.vue b/webapp/src/components/modalComponents/calibrationWizardComponents/singleStepTask.vue index 908772c7..c7da2345 100644 --- a/webapp/src/components/modalComponents/calibrationWizardComponents/singleStepTask.vue +++ b/webapp/src/components/modalComponents/calibrationWizardComponents/singleStepTask.vue @@ -1,5 +1,6 @@