From aeef0e848c68aec97ab059f26d723b5728330d37 Mon Sep 17 00:00:00 2001 From: Mika Fischer Date: Thu, 30 Jun 2011 10:51:53 +0200 Subject: [PATCH] Add possibility to specify starting point for model iterator --- sloth/annotations/model.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/sloth/annotations/model.py b/sloth/annotations/model.py index 7e0913a..3a4fa29 100644 --- a/sloth/annotations/model.py +++ b/sloth/annotations/model.py @@ -496,12 +496,12 @@ class AnnotationModel(QAbstractItemModel): return index.internalPointer() return self._root - def iterator(self, _class=None, predicate=None): + def iterator(self, _class=None, predicate=None, start=None): return model_iterator(self, _class, predicate) -def model_iterator(model, _class=None, predicate=None): +def model_iterator(model, _class=None, predicate=None, start=None): # Visit all nodes - item = model.root() + item = start if start is not None else model.root() while item is not None: # Return item if _class is None or isinstance(item, _class):