diff --git a/docs/release_notes/next.rst b/docs/release_notes/next.rst index d2d06166d24..fba73c37aea 100644 --- a/docs/release_notes/next.rst +++ b/docs/release_notes/next.rst @@ -17,3 +17,4 @@ Fixes - #846 : Fixing AstropyDeprecationWarning - #843 : Error loading stack - #856 : Move shared array allocation to `multiprocessing.Array` when on Python 3.8 +- #854 : Ops window, image selector in preview section skips by 2 diff --git a/mantidimaging/gui/windows/operations/presenter.py b/mantidimaging/gui/windows/operations/presenter.py index 371c62e26ed..3c4eab68fbd 100644 --- a/mantidimaging/gui/windows/operations/presenter.py +++ b/mantidimaging/gui/windows/operations/presenter.py @@ -220,6 +220,8 @@ def _do_apply_filter_sync(self, apply_to): def do_update_previews(self): self.view.clear_previews() + # Disable preview image index scrollbox to prevent double-increase + self.view.previewImageIndex.setEnabled(False) if self.stack is not None: stack_presenter = self.stack.presenter subset: Images = stack_presenter.get_image(self.model.preview_image_idx) @@ -253,6 +255,9 @@ def do_update_previews(self): # Ensure all of it is visible self.view.previews.auto_range() + # Enable preview image index box when preview has been created + self.view.previewImageIndex.setEnabled(True) + @staticmethod def _update_preview_image(image_data: Optional[np.ndarray], image: ImageItem): image.clear() diff --git a/mantidimaging/gui/windows/operations/test/test_presenter.py b/mantidimaging/gui/windows/operations/test/test_presenter.py index e9b4d320b2d..7a988ef569f 100644 --- a/mantidimaging/gui/windows/operations/test/test_presenter.py +++ b/mantidimaging/gui/windows/operations/test/test_presenter.py @@ -226,3 +226,7 @@ def test_original_stack_assigned_when_safe_apply_checked(self, _): stack.presenter.images.copy.assert_called_once() self.assertEqual(stack_data, self.presenter.original_images_stack) + + def test_preview_image_spin_box_disabled_while_updating_preview(self): + self.presenter.do_update_previews() + self.view.previewImageIndex.setEnabled.assert_has_calls([mock.call(False), mock.call(True)])