provide lower level access for cursors, but retain XML/GEDCOM compatiblity

svn: r6181
This commit is contained in:
Don Allingham 2006-03-20 05:17:52 +00:00
parent bf6ed063bb
commit 842372e040
2 changed files with 12 additions and 5 deletions

View File

@ -84,16 +84,24 @@ def find_primary_handle(key,data):
def find_referenced_handle(key,data):
return str((data)[1][1])
import cPickle as pickle
class GrampsBSDDBCursor(GrampsCursor):
def __init__(self,source,txn=None):
self.cursor = source.cursor(txn)
self.cursor = source.db.cursor(txn)
def first(self):
return self.cursor.first()
d = self.cursor.first()
if d:
return (d[0],pickle.loads(d[1]))
return None
def next(self):
return self.cursor.next()
d = self.cursor.next()
if d:
return (d[0],pickle.loads(d[1]))
return None
def close(self):
self.cursor.close()

View File

@ -149,12 +149,11 @@ class PeopleModel(gtk.GenericTreeModel):
self.sortnames = {}
cursor = self.db.person_map.db.cursor()
cursor = self.db.get_person_cursor()
node = cursor.first()
while node:
handle,d = node
d = pickle.loads(d)
if not (handle in skip or (dfilter and not dfilter.match(handle))):
name_data = d[_NAME_COL]
self.sortnames[handle] = nsn(name_data)