Skip to content

Commit

Permalink
Merge pull request #877 from mantidproject/864_spinbox_skips_by_2
Browse files Browse the repository at this point in the history
864: Ops window, image selector in preview section skips by 2
  • Loading branch information
samtygier-stfc authored Mar 3, 2021
2 parents 95b70c3 + 95ee0bc commit aa0938f
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 0 deletions.
1 change: 1 addition & 0 deletions docs/release_notes/next.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
5 changes: 5 additions & 0 deletions mantidimaging/gui/windows/operations/presenter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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()
Expand Down
4 changes: 4 additions & 0 deletions mantidimaging/gui/windows/operations/test/test_presenter.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)])

0 comments on commit aa0938f

Please sign in to comment.