From 3cef23f3205a98a24222747c6d557bfc516b87b9 Mon Sep 17 00:00:00 2001 From: Martin Baeuml Date: Mon, 20 Feb 2012 12:54:21 +0100 Subject: [PATCH] minor fixes for FrameModelItems in annotation model --- sloth/annotations/model.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/sloth/annotations/model.py b/sloth/annotations/model.py index 240d9e2..69e4c0e 100644 --- a/sloth/annotations/model.py +++ b/sloth/annotations/model.py @@ -3,7 +3,7 @@ The annotationmodel module contains the classes for the AnnotationModel. """ from PyQt4.QtGui import QTreeView, QItemSelection, QItemSelectionModel, QSortFilterProxyModel, QBrush from PyQt4.QtCore import QModelIndex, QAbstractItemModel, Qt, pyqtSignal, QVariant -import os.path +import os.path, sys import copy from collections import MutableMapping import time @@ -254,6 +254,7 @@ class RootModelItem(ModelItem): def appendFileItem(self, fileinfo): item = FileModelItem.create(fileinfo) + LOG.debug("created FileModelItem of type %s" % item.__class__.__name__) self.appendChild(item) return item @@ -465,6 +466,7 @@ class VideoFileModelItem(FileModelItem): self.addChildSorted(FrameModelItem(frameinfo)) def getAnnotations(self): + self._ensureAllLoaded() fi = KeyValueModelItem.getAnnotations(self) fi['frames'] = [child.getAnnotations() for child in self.children()] return fi @@ -498,7 +500,8 @@ class FrameModelItem(ImageModelItem, KeyValueModelItem): def getAnnotations(self): fi = KeyValueModelItem.getAnnotations(self) - fi['annotations'] = [child.getAnnotations() for child in self.children()] + fi['annotations'] = [child.getAnnotations() for child in self.children() + if hasattr(child, 'getAnnotations')] return fi class AnnotationModelItem(KeyValueModelItem):