diff --git a/po/POTFILES.in b/po/POTFILES.in index d090f8e2d..e81722306 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -75,7 +75,6 @@ src/gen/db/cursor.py src/gen/db/exceptions.py src/gen/db/dbconst.py src/gen/db/__init__.py -src/gen/db/iterator.py src/gen/db/undoredo.py # gen lib API diff --git a/src/gen/db/Makefile.am b/src/gen/db/Makefile.am index 5ac91fee9..e204e4a11 100644 --- a/src/gen/db/Makefile.am +++ b/src/gen/db/Makefile.am @@ -13,7 +13,6 @@ pkgdata_PYTHON = \ cursor.py \ dbconst.py \ exceptions.py \ - iterator.py \ read.py \ txn.py \ undoredo.py \ diff --git a/src/gen/db/iterator.py b/src/gen/db/iterator.py deleted file mode 100644 index 362e2fff6..000000000 --- a/src/gen/db/iterator.py +++ /dev/null @@ -1,65 +0,0 @@ -# -# Gramps - a GTK+/GNOME based genealogy program -# -# Copyright (C) 2007 Richard Taylor -# -# This program is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 2 of the License, or -# (at your option) any later version. -# -# This program is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the Free Software -# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -# - -# $Id:iterator.py 9912 2008-01-22 09:17:46Z acraphae $ - -from gen.utils import LongOpStatus - -class CursorIterator(object): - - def __init__(self, db, cursor, msg=""): - self._db = db - self._cursor = cursor - self._status = LongOpStatus(total_steps=cursor.get_length(), - interval=10) - #self._status = LongOpStatus(msg=msg) - - def __iter__(self): - try: - # Emit start signal - self._db.emit('long-op-start', (self._status,)) - - first = self._cursor.first() - if first: - yield first - - next = self._cursor.next() - while next: - yield next - - # check for cancel - #if self._status.should_cancel(): - # raise DbUserCancel - - # emit heartbeat - self._status.heartbeat() - next = self._cursor.next() - - # emit stop signal - self._status.end() - self._cursor.close() - raise StopIteration - except: - # Not allowed to use 'finally' because we - # yeild inside the try clause. - self._cursor.close() - self._status.end() - raise - diff --git a/src/plugins/lib/libgrdb.py b/src/plugins/lib/libgrdb.py index 52cd34214..848b673a5 100644 --- a/src/plugins/lib/libgrdb.py +++ b/src/plugins/lib/libgrdb.py @@ -50,7 +50,6 @@ LOG = logging.getLogger(".Db") from gen.lib import (MediaObject, Person, Family, Source, Event, Place, Repository, Note, GenderStats, Researcher) from gen.utils.callback import Callback -from gen.db.iterator import CursorIterator #------------------------------------------------------------------------- # @@ -323,51 +322,27 @@ class DbGrdb(Callback): def get_person_cursor(self): raise NotImplementedError - def get_person_cursor_iter(self, msg=_("Processing Person records")): - return CursorIterator(self, self.get_person_cursor(), msg) - def get_family_cursor(self): raise NotImplementedError - def get_family_cursor_iter(self, msg=_("Processing Family records")): - return CursorIterator(self, self.get_family_cursor(), msg) - def get_event_cursor(self): raise NotImplementedError - def get_event_cursor_iter(self, msg=_("Processing Event records")): - return CursorIterator(self, self.get_event_cursor(), msg) - def get_place_cursor(self): raise NotImplementedError - def get_place_cursor_iter(self, msg=_("Processing Place records")): - return CursorIterator(self, self.get_place_cursor(), msg) - def get_source_cursor(self): raise NotImplementedError - def get_source_cursor_iter(self, msg=_("Processing Source records")): - return CursorIterator(self, self.get_source_cursor(), msg) - def get_media_cursor(self): raise NotImplementedError - def get_media_cursor_iter(self, msg=_("Processing Media records")): - return CursorIterator(self, self.get_media_cursor(), msg) - def get_repository_cursor(self): raise NotImplementedError - def get_repository_cursor_iter(self, msg=_("Processing Repository records")): - return CursorIterator(self, self.get_repository_cursor(), msg) - def get_note_cursor(self): raise NotImplementedError - def get_note_cursor_iter(self, msg=_("Processing Note records")): - return CursorIterator(self, self.get_note_cursor(), msg) - def open_undodb(self): if not self.readonly: self.undolog = "%s.undo" % self.full_name