From 2d4e401cb20e2cce3f1b8eade48de4ac80d2dc77 Mon Sep 17 00:00:00 2001 From: Mika Fischer Date: Thu, 16 Jun 2011 11:45:04 +0200 Subject: [PATCH] Fix going to next/previous frame/image --- sloth/annotations/model.py | 2 +- sloth/core/labeltool.py | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/sloth/annotations/model.py b/sloth/annotations/model.py index 90505a6..1d31506 100644 --- a/sloth/annotations/model.py +++ b/sloth/annotations/model.py @@ -53,7 +53,7 @@ class ModelItem: p = self.parent() if p is not None: row = p.getPosOfChild(self) - if row < len(p.children()) - 2: + if row < len(p.children()) - 1: return p.getChildAt(row+1) return None diff --git a/sloth/core/labeltool.py b/sloth/core/labeltool.py index e880c88..37797c8 100755 --- a/sloth/core/labeltool.py +++ b/sloth/core/labeltool.py @@ -250,16 +250,16 @@ class LabelTool(QObject): return self._model def gotoNext(self): - # TODO move this to the scene if self._model is not None and self._current_image is not None: next_image = self._current_image.getNextSibling() - self.setCurrentImage(next_image) + if next_image is not None: + self.setCurrentImage(next_image) def gotoPrevious(self): - # TODO move this to the scene if self._model is not None and self._current_image is not None: prev_image = self._current_image.getPreviousSibling() - self.setCurrentImage(prev_image) + if prev_image is not None: + self.setCurrentImage(prev_image) def updateModified(self): """update all GUI elements which depend on the state of the model,