diff --git a/sloth/bin/sloth b/sloth/bin/sloth index 7af8cf6..fab991a 100755 --- a/sloth/bin/sloth +++ b/sloth/bin/sloth @@ -15,6 +15,7 @@ if __name__ == '__main__': labeltool.execute_from_commandline(sys.argv) wnd = MainWindow(labeltool) + labeltool._mainwindow = wnd wnd.show() sys.exit(app.exec_()) diff --git a/sloth/core/labeltool.py b/sloth/core/labeltool.py index 7a891d2..b29dd25 100755 --- a/sloth/core/labeltool.py +++ b/sloth/core/labeltool.py @@ -66,6 +66,7 @@ class LabelTool(QObject): self.container_ = AnnotationContainer() self._current_image = None self._model = AnnotationModel([]) + self._mainwindow = None def main_help_text(self): """ @@ -329,3 +330,18 @@ class LabelTool(QObject): i += 1 self._model._root.appendFileItem(fileitem) + + ### + ### Scene functions + ###___________________________________________________________________________________________ + def selectNextAnnotation(self): + if self._mainwindow is not None: + return self._mainwindow.scene.selectNextItem() + + def selectPreviousAnnotation(self): + if self._mainwindow is not None: + return self._mainwindow.scene.selectNextItem(reverse=True) + + def exitInsertMode(self): + if self._mainwindow is not None: + return self._mainwindow.buttonarea.exitInsertMode()