From 22dbba3186c44c649c75fb9f1632deac95724960 Mon Sep 17 00:00:00 2001 From: fdrgsp Date: Wed, 6 Nov 2024 22:05:16 -0500 Subject: [PATCH] fix: af_per_position --- src/pymmcore_widgets/useq_widgets/_mda_sequence.py | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/src/pymmcore_widgets/useq_widgets/_mda_sequence.py b/src/pymmcore_widgets/useq_widgets/_mda_sequence.py index 026e28f3f..b92097dbe 100644 --- a/src/pymmcore_widgets/useq_widgets/_mda_sequence.py +++ b/src/pymmcore_widgets/useq_widgets/_mda_sequence.py @@ -25,7 +25,7 @@ from pymmcore_widgets.useq_widgets._channels import ChannelTable from pymmcore_widgets.useq_widgets._checkable_tabwidget_widget import CheckableTabWidget from pymmcore_widgets.useq_widgets._grid import GridPlanWidget -from pymmcore_widgets.useq_widgets._positions import PositionTable +from pymmcore_widgets.useq_widgets._positions import AF_DEFAULT_TOOLTIP, PositionTable from pymmcore_widgets.useq_widgets._time import TimePlanWidget from pymmcore_widgets.useq_widgets._z import Mode, ZPlanWidget @@ -506,11 +506,15 @@ def _validate_af_with_z_plan(self) -> None: If the Z Plan is set to TOP_BOTTOM, the autofocus plan cannot be used. """ if self.z_plan.mode() == Mode.TOP_BOTTOM: - self.af_axis.setEnabled(False) - self.af_axis.setToolTip( + tooltip = ( "The hardware autofocus cannot be used with absolute Z positions " "(TOP_BOTTOM mode)." ) + self.af_axis.setEnabled(False) + self.af_axis.setToolTip(tooltip) + self.stage_positions.af_per_position.setEnabled(False) + self.stage_positions.af_per_position.setChecked(False) + self.stage_positions.af_per_position.setToolTip(tooltip) if self.af_axis.use_af_p.isChecked(): QMessageBox.warning( self, @@ -525,6 +529,8 @@ def _validate_af_with_z_plan(self) -> None: else: self.af_axis.setEnabled(True) self.af_axis.setToolTip(AF_TOOLTIP) + self.stage_positions.af_per_position.setEnabled(True) + self.stage_positions.af_per_position.setToolTip(AF_DEFAULT_TOOLTIP) self.valueChanged.emit() @@ -536,6 +542,8 @@ def _on_tab_checked(self, tab_idx: int) -> None: else: self.af_axis.setEnabled(True) self.af_axis.setToolTip(AF_TOOLTIP) + self.stage_positions.af_per_position.setEnabled(True) + self.stage_positions.af_per_position.setToolTip(AF_DEFAULT_TOOLTIP) self._update_available_axis_orders()