Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

864: Ops window, image selector in preview section skips by 2 #877

Merged
merged 4 commits into from
Mar 3, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)])