From 08d78a3ec09fe877727e222ae5dac31fbdeb073b Mon Sep 17 00:00:00 2001 From: Martin Baeuml Date: Thu, 5 May 2011 17:47:57 +0200 Subject: [PATCH] allow inserter or items to be None --- sceneitems/annotationitem.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sceneitems/annotationitem.py b/sceneitems/annotationitem.py index 6ddf18c..2c7c156 100644 --- a/sceneitems/annotationitem.py +++ b/sceneitems/annotationitem.py @@ -345,14 +345,20 @@ class AnnotationGraphicsItemFactory: if _type not in self.items_: return None - return self.items_[_type](*args, **kwargs) + item = self.items_[_type] + if item is None: + return None + return item(*args, **kwargs) def createItemInserter(self, _type, *args, **kwargs): _type = _type.lower() if _type not in self.inserters_: return None - return self.inserters_[_type](*args, **kwargs) + inserter = self.inserters_[_type] + if inserter is None: + return None + return inserter(*args, **kwargs) # register common item types ItemFactory = AnnotationGraphicsItemFactory()