Skip to content

Commit

Permalink
Merge pull request #220 from prabhuramachandran/fix-viewer-indexing-e…
Browse files Browse the repository at this point in the history
…rror

Fix silly count offset-by-one error. [ci skip]
  • Loading branch information
prabhuramachandran committed Jun 5, 2019
2 parents c77cd10 + e05fec5 commit 4c87d19
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions pysph/tools/mayavi_viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -1055,7 +1055,7 @@ def _file_count_changed(self, value):
if not self.files:
return
# Load the new file.
value = min(value, len(self.files))
value = min(value, len(self.files) - 1)
fname = self.files[value]
if not os.path.exists(fname):
print("File %s is missing, ignoring!" % fname)
Expand Down Expand Up @@ -1143,7 +1143,7 @@ def _update_files_fired(self):
sort_file_list(files)
self.files = files
if len(files) > 0:
fc = min(len(files), fc)
fc = min(len(files) - 1, fc)
self.file_count = fc
if self.play:
self._play_changed(self.play)
Expand All @@ -1168,7 +1168,7 @@ def _directory_changed(self, d):
self._clear()
sort_file_list(files)
self.files = files
self.file_count = min(self.file_count, len(files))
self.file_count = min(self.file_count, len(files) - 1)
else:
pass
config_file = os.path.join(d, 'mayavi_config.py')
Expand Down

0 comments on commit 4c87d19

Please sign in to comment.