From 9b1c6f9f3d5b3c89038f2e0203c1c7ba8d64f1e6 Mon Sep 17 00:00:00 2001 From: fdrgsp Date: Mon, 4 Nov 2024 14:25:16 -0500 Subject: [PATCH] fix: fix pre-commit --- src/pymmcore_widgets/mda/_core_positions.py | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/src/pymmcore_widgets/mda/_core_positions.py b/src/pymmcore_widgets/mda/_core_positions.py index b0e35b281..9bf8de2c7 100644 --- a/src/pymmcore_widgets/mda/_core_positions.py +++ b/src/pymmcore_widgets/mda/_core_positions.py @@ -390,16 +390,16 @@ def _on_selection_change(self) -> None: # if 'af_per_position' is not checked and the autofocus was not locked # before moving, we do not use autofocus. if table_af_offset is not None or af_offset is not None: - self._mmc.setAutoFocusOffset( - table_af_offset if table_af_offset is not None else af_offset - ) - try: - self._mmc.enableContinuousFocus(False) - self._perform_autofocus() - self._mmc.enableContinuousFocus(af_engaged) - self._mmc.waitForSystem() - except RuntimeError as e: - logger.warning("Hardware autofocus failed. %s", e) + _af = table_af_offset if table_af_offset is not None else af_offset + if _af is not None: + self._mmc.setAutoFocusOffset(_af) + try: + self._mmc.enableContinuousFocus(False) + self._perform_autofocus() + self._mmc.enableContinuousFocus(af_engaged) + self._mmc.waitForSystem() + except RuntimeError as e: + logger.warning("Hardware autofocus failed. %s", e) self._mmc.waitForSystem()