Skip to content

Commit

Permalink
bug fix scroll images when dataset is smaller than the number of prev…
Browse files Browse the repository at this point in the history
…iew images
  • Loading branch information
mattclifford1 committed Aug 6, 2024
1 parent d458e1e commit 0cbd2e0
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions IQM_Vis/UI/images.py
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,8 @@ def change_preview_images(self, ival):
# have roll around scrolling
if self.preview_num + ival < 0:
self.preview_num = self.max_data_ind - self.num_images_scroll_show + 1
if self.preview_num + ival < 0: # dataset is smaller than the number of images to show
self.preview_num = 0
elif self.preview_num + ival + self.num_images_scroll_show > self.max_data_ind + 1:
self.preview_num = 0
else:
Expand All @@ -88,12 +90,11 @@ def change_preview_images(self, ival):

def set_preview_images(self, preview_num):
for data_store in self.data_stores:
for i in range(self.num_images_scroll_show):
for i in range(min(self.num_images_scroll_show, self.max_data_ind+1)):
im_preview_ind = preview_num + i
if im_preview_ind <= self.max_data_ind:
# load image
im_preview_data = data_store.get_reference_image_by_index(
im_preview_ind)
im_preview_data = data_store.get_reference_image_by_index(im_preview_ind)
self.widget_im_num_hash[i] = im_preview_ind
# set image preview size
scale = self.num_images_scroll_show - 1
Expand Down

0 comments on commit 0cbd2e0

Please sign in to comment.