From fae19e20b92e6595c7b66813bbee581537a7aad5 Mon Sep 17 00:00:00 2001 From: Markus Roth Date: Mon, 12 Mar 2012 13:42:17 -0700 Subject: [PATCH] Add functions to select all items (the typical Ctrl + a action). --- sloth/core/labeltool.py | 4 ++++ sloth/gui/annotationscene.py | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/sloth/core/labeltool.py b/sloth/core/labeltool.py index d1a0b9a..df758c8 100755 --- a/sloth/core/labeltool.py +++ b/sloth/core/labeltool.py @@ -429,6 +429,10 @@ class LabelTool(QObject): def selectPreviousAnnotation(self): if self._mainwindow is not None: return self._mainwindow.scene.selectNextItem(reverse=True) + + def selectAllAnnotations(self): + if self._mainwindow is not None: + return self._mainwindow.scene.selectAllItems() def deleteSelectedAnnotations(self): if self._mainwindow is not None: diff --git a/sloth/gui/annotationscene.py b/sloth/gui/annotationscene.py index e9a56bb..52981de 100644 --- a/sloth/gui/annotationscene.py +++ b/sloth/gui/annotationscene.py @@ -260,6 +260,10 @@ class AnnotationScene(QGraphicsScene): item.setSelected(True) break + def selectAllItems(self): + for item in self.items(): + item.setSelected(True) + def keyPressEvent(self, event): LOG.debug("keyPressEvent %s" % event)