Skip to content

Commit

Permalink
show calibration label on profile loaded
Browse files Browse the repository at this point in the history
  • Loading branch information
Alpaca233 committed Feb 26, 2025
1 parent f5adfaf commit 66b118a
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 6 deletions.
10 changes: 7 additions & 3 deletions software/control/core/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -3748,9 +3748,11 @@ def update_laser_af_settings(self, objective: str, updates: Dict[str, Any]) -> N
self.autofocus_configurations[objective] = config.model_copy(update=updates)


class ConfigurationManager:
class ConfigurationManager(QObject):
"""Main configuration manager that coordinates channel and autofocus configurations."""

signal_profile_loaded = Signal()

def __init__(
self,
channel_manager: ChannelConfigurationManager,
Expand Down Expand Up @@ -3800,6 +3802,8 @@ def load_profile(self, profile_name: str) -> None:
if self.laser_af_manager:
self.laser_af_manager.load_configurations(objective)

self.signal_profile_loaded.emit()

def create_new_profile(self, profile_name: str) -> None:
"""Create a new profile using current configurations."""
new_profile_path = self.base_config_path / profile_name
Expand Down Expand Up @@ -4992,8 +4996,8 @@ def set_reference(self) -> bool:

return True

def on_objective_changed(self) -> None:
"""Handle objective change event.
def on_settings_changed(self) -> None:
"""Handle objective change or profile load event.
This method is called when the objective changes. It resets the initialization
status and loads the cached configuration for the new objective.
Expand Down
12 changes: 9 additions & 3 deletions software/control/gui_hcs.py
Original file line number Diff line number Diff line change
Expand Up @@ -982,6 +982,11 @@ def makeConnections(self):
self.wellSelectionWidget.signal_wellSelected.connect(self.wellplateMultiPointWidget.update_well_coordinates)
self.objectivesWidget.signal_objective_changed.connect(self.wellplateMultiPointWidget.update_coordinates)

self.configurationManager.signal_profile_loaded.connect(
lambda: self.liveControlWidget.update_microscope_mode_by_name(
self.liveControlWidget.currentConfiguration.name
)
)
self.objectivesWidget.signal_objective_changed.connect(
lambda: self.liveControlWidget.update_microscope_mode_by_name(
self.liveControlWidget.currentConfiguration.name
Expand All @@ -990,12 +995,13 @@ def makeConnections(self):

if SUPPORT_LASER_AUTOFOCUS:

def connect_objective_changed_laser_af():
self.laserAutofocusController.on_objective_changed()
def connect_settings_changed_laser_af():
self.laserAutofocusController.on_settings_changed()
self.laserAutofocusControlWidget.update_init_state()
self.laserAutofocusSettingWidget.update_values()

self.objectivesWidget.signal_objective_changed.connect(connect_objective_changed_laser_af)
self.configurationManager.signal_profile_loaded.connect(connect_settings_changed_laser_af)
self.objectivesWidget.signal_objective_changed.connect(connect_settings_changed_laser_af)
self.laserAutofocusSettingWidget.signal_newExposureTime.connect(
self.cameraSettingWidget_focus_camera.set_exposure_time
)
Expand Down
5 changes: 5 additions & 0 deletions software/control/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,7 @@ def __init__(self, streamHandler, liveController, laserAutofocusController, stre

self.spinboxes = {}
self.init_ui()
self.update_calibration_label()

def init_ui(self):
layout = QVBoxLayout()
Expand Down Expand Up @@ -561,6 +562,8 @@ def update_values(self):
if index >= 0:
self.spot_mode_combo.setCurrentIndex(index)

self.update_calibration_label()

def apply_settings(self):
updates = {
"laser_af_averaging_n": int(self.spinboxes["laser_af_averaging_n"].value()),
Expand All @@ -582,7 +585,9 @@ def apply_settings(self):
self.laserAutofocusController.set_laser_af_properties(updates)
self.laserAutofocusController.initialize_auto()
self.signal_apply_settings.emit()
self.update_calibration_label()

def update_calibration_label(self):
# Show calibration result
# Clear previous calibration label if it exists
if hasattr(self, "calibration_label"):
Expand Down

0 comments on commit 66b118a

Please sign in to comment.