* src/GrampsInMemDB.py (get_person_from_gramps_id,

get_family_from_gramps_id,get_place_from_gramps_id,
get_source_from_gramps_id,get_object_from_gramps_id):
Unserialize tuple and return a proper GRAMPS object.


svn: r3885
This commit is contained in:
Alex Roitman 2005-01-08 21:42:40 +00:00
parent 5ec30eb388
commit 894aa1d810
2 changed files with 36 additions and 17 deletions

View File

@ -5,6 +5,11 @@
* src/plugins/FamilyGroup.py: Switch from handle to id for spouse. * src/plugins/FamilyGroup.py: Switch from handle to id for spouse.
* src/plugins/SimpleBookTitle.py: Cleanups. * src/plugins/SimpleBookTitle.py: Cleanups.
* src/GrampsInMemDB.py (get_person_from_gramps_id,
get_family_from_gramps_id,get_place_from_gramps_id,
get_source_from_gramps_id,get_object_from_gramps_id):
Unserialize tuple and return a proper GRAMPS object.
2005-01-07 Don Allingham <dallingham@users.sourceforge.net> 2005-01-07 Don Allingham <dallingham@users.sourceforge.net>
* src/gramps.glade: removal of more OptionMenus in favor * src/gramps.glade: removal of more OptionMenus in favor
of ComboBoxes of ComboBoxes

View File

@ -1,7 +1,7 @@
# #
# Gramps - a GTK+/GNOME based genealogy program # Gramps - a GTK+/GNOME based genealogy program
# #
# Copyright (C) 2000-2004 Donald N. Allingham # Copyright (C) 2000-2005 Donald N. Allingham
# #
# This program is free software; you can redistribute it and/or modify # 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 # it under the terms of the GNU General Public License as published by
@ -186,35 +186,49 @@ class GrampsInMemDB(GrampsDbBase):
def get_person_from_gramps_id(self,val): def get_person_from_gramps_id(self,val):
handle = self.id_trans.get(str(val)) handle = self.id_trans.get(str(val))
if handle: if handle:
return self.person_map[handle] data = self.person_map[handle]
else: if data:
return None person = Person()
person.unserialize(data)
return person
return None
def get_family_from_gramps_id(self,val): def get_family_from_gramps_id(self,val):
handle = self.fid_trans.get(str(val)) handle = self.fid_trans.get(str(val))
if handle: if handle:
return self.family_map[handle] data = self.family_map[handle]
else: if data:
return None family = Family()
family.unserialize(data)
return family
return None
def get_place_from_gramps_id(self,val): def get_place_from_gramps_id(self,val):
handle = self.pid_trans.get(str(val)) handle = self.pid_trans.get(str(val))
if handle: if handle:
return self.place_map[handle] data = self.place_map[handle]
else: if data:
return None place = Place()
place.unserialize(data)
return place
return None
def get_source_from_gramps_id(self,val): def get_source_from_gramps_id(self,val):
handle = self.sid_trans.get(str(val)) handle = self.sid_trans.get(str(val))
if handle: if handle:
return self.source_map[handle] data = self.source_map[handle]
else: if data:
return None source = Source()
source.unserialize(data)
return source
return None
def get_object_from_gramps_id(self,val): def get_object_from_gramps_id(self,val):
handle = self.oid_trans.get(str(val)) handle = self.oid_trans.get(str(val))
if handle: if handle:
return self.media_map[handle] data = self.media_map[handle]
else: if data:
return None obj = MediaObject()
obj.unserialize(data)
return obj
return None