Remove gen.db.iterator.py - it is not used.
svn: r13979
This commit is contained in:
parent
8c115f26b7
commit
7aec8904ea
@ -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
|
||||
|
@ -13,7 +13,6 @@ pkgdata_PYTHON = \
|
||||
cursor.py \
|
||||
dbconst.py \
|
||||
exceptions.py \
|
||||
iterator.py \
|
||||
read.py \
|
||||
txn.py \
|
||||
undoredo.py \
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user