From 9d4fac6315df972f4c8dd19a31930b44dc5b70b2 Mon Sep 17 00:00:00 2001 From: Martin Baeuml Date: Thu, 15 Sep 2011 13:53:28 +0200 Subject: [PATCH] add annotation accessor to labeltool object --- sloth/core/commands.py | 3 +-- sloth/core/labeltool.py | 5 +++++ 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/sloth/core/commands.py b/sloth/core/commands.py index b8d997c..d3e1e60 100644 --- a/sloth/core/commands.py +++ b/sloth/core/commands.py @@ -65,8 +65,7 @@ class DumpLabelsCommand(BaseCommand): raise CommandError("Expect exactly 1 argument.") self.labeltool.loadAnnotations(args[0]) - # TODO add better accessor the the labeltool - pprint(self.labeltool._container.annotations()) + pprint(self.labeltool.annotations()) class AppendFilesCommand(BaseCommand): diff --git a/sloth/core/labeltool.py b/sloth/core/labeltool.py index 8b16e70..e09bc06 100755 --- a/sloth/core/labeltool.py +++ b/sloth/core/labeltool.py @@ -235,6 +235,11 @@ class LabelTool(QObject): self.statusMessage.emit(msg) self.annotationsLoaded.emit() + def annotations(self): + if self._model is None: + return None + return self._model.root().getAnnotations() + def saveAnnotations(self, fname): success = False try: