Skip to content

Commit

Permalink
fix: af_per_position
Browse files Browse the repository at this point in the history
  • Loading branch information
fdrgsp committed Nov 7, 2024
1 parent 0e6697a commit 22dbba3
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions src/pymmcore_widgets/useq_widgets/_mda_sequence.py
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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,
Expand All @@ -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()

Expand All @@ -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()

Expand Down

0 comments on commit 22dbba3

Please sign in to comment.