* src/RelLib.py: switch to event/event_ids
* src/WriteXML.py: switch to event/event_ids * src/GrampsParser.py: switch to event/event_ids * src/FamilyView.py: switch to event/event_ids * src/EventEdit.py: switch to event/event_ids * src/Marriage.py: switch to event/event_ids svn: r2868
This commit is contained in:
parent
cc19349f63
commit
d5c70b519d
@ -150,7 +150,12 @@ class EventEditor:
|
|||||||
if (def_placename):
|
if (def_placename):
|
||||||
self.place_field.set_text(def_placename)
|
self.place_field.set_text(def_placename)
|
||||||
else:
|
else:
|
||||||
self.place_field.set_text(event.get_place_name())
|
place_id = event.get_place_id()
|
||||||
|
if place_id:
|
||||||
|
place_name = u""
|
||||||
|
else:
|
||||||
|
place_name = self.db.find_place_from_id(place_id).get_title()
|
||||||
|
self.place_field.set_text(place_name)
|
||||||
|
|
||||||
self.date_field.set_text(self.date.get_date())
|
self.date_field.set_text(self.date.get_date())
|
||||||
self.cause_field.set_text(event.get_cause())
|
self.cause_field.set_text(event.get_cause())
|
||||||
@ -266,8 +271,13 @@ class EventEditor:
|
|||||||
self.callback(self.event)
|
self.callback(self.event)
|
||||||
|
|
||||||
def update_event(self,name,date,place,desc,note,format,priv,cause):
|
def update_event(self,name,date,place,desc,note,format,priv,cause):
|
||||||
if self.event.get_place_id() != place:
|
if place:
|
||||||
self.event.set_place_id(place)
|
if self.event.get_place_id() != place.get_id():
|
||||||
|
self.event.set_place_id(place.get_id())
|
||||||
|
self.parent.lists_changed = 1
|
||||||
|
else:
|
||||||
|
if self.event.get_place_id():
|
||||||
|
self.event.set_place_id(None)
|
||||||
self.parent.lists_changed = 1
|
self.parent.lists_changed = 1
|
||||||
|
|
||||||
if self.event.get_name() != self.trans(name):
|
if self.event.get_name() != self.trans(name):
|
||||||
|
@ -809,8 +809,8 @@ class FamilyView:
|
|||||||
self.clear()
|
self.clear()
|
||||||
return
|
return
|
||||||
|
|
||||||
bd = self.person.get_birth().get_date()
|
bd = self.parent.db.find_event_from_id(self.person.get_birth_id()).get_date()
|
||||||
dd = self.person.get_death().get_date()
|
dd = self.parent.db.find_event_from_id(self.person.get_death_id()).get_date()
|
||||||
|
|
||||||
if bd and dd:
|
if bd and dd:
|
||||||
n = "%s\n\t%s %s\n\t%s %s " % (GrampsCfg.nameof(self.person),
|
n = "%s\n\t%s %s\n\t%s %s " % (GrampsCfg.nameof(self.person),
|
||||||
@ -855,8 +855,9 @@ class FamilyView:
|
|||||||
flist[f] = iter
|
flist[f] = iter
|
||||||
|
|
||||||
if sp:
|
if sp:
|
||||||
if fm.get_marriage():
|
event = self.find_marriage(fm)
|
||||||
mdate = " - %s" % fm.get_marriage().get_date()
|
if event:
|
||||||
|
mdate = " - %s" % event.get_date()
|
||||||
else:
|
else:
|
||||||
mdate = ""
|
mdate = ""
|
||||||
v = "%s\n\t%s%s" % (GrampsCfg.nameof(sp),
|
v = "%s\n\t%s%s" % (GrampsCfg.nameof(sp),
|
||||||
@ -881,6 +882,13 @@ class FamilyView:
|
|||||||
|
|
||||||
self.update_list(self.ap_parents_model,self.ap_parents,self.person)
|
self.update_list(self.ap_parents_model,self.ap_parents,self.person)
|
||||||
|
|
||||||
|
def find_marriage(self,family):
|
||||||
|
for event_id in family.get_event_list():
|
||||||
|
event = self.parent.db.find_event_from_id(event_id)
|
||||||
|
if event.get_name() == "Marriage":
|
||||||
|
return event
|
||||||
|
return None
|
||||||
|
|
||||||
def update_list(self,model,tree,person):
|
def update_list(self,model,tree,person):
|
||||||
model.clear()
|
model.clear()
|
||||||
sel = None
|
sel = None
|
||||||
|
@ -652,15 +652,16 @@ class GrampsParser:
|
|||||||
def stop_event(self,tag):
|
def stop_event(self,tag):
|
||||||
self.event.name = self.event_type
|
self.event.name = self.event_type
|
||||||
|
|
||||||
|
self.db.add_event(self.event)
|
||||||
if self.family:
|
if self.family:
|
||||||
self.family.add_event(self.event)
|
self.family.add_event_id(self.event.get_id())
|
||||||
else:
|
else:
|
||||||
if self.event_type == "Birth":
|
if self.event_type == "Birth":
|
||||||
self.person.set_birth(self.event)
|
self.person.set_birth_id(self.event.get_id())
|
||||||
elif self.event_type == "Death":
|
elif self.event_type == "Death":
|
||||||
self.person.set_death(self.event)
|
self.person.set_death_id(self.event.get_id())
|
||||||
else:
|
else:
|
||||||
self.person.add_event(self.event)
|
self.person.add_event_id(self.event.get_id())
|
||||||
self.event = None
|
self.event = None
|
||||||
|
|
||||||
def stop_name(self,tag):
|
def stop_name(self,tag):
|
||||||
|
@ -413,8 +413,10 @@ class Marriage:
|
|||||||
def redraw_event_list(self):
|
def redraw_event_list(self):
|
||||||
self.etree.clear()
|
self.etree.clear()
|
||||||
self.emap = {}
|
self.emap = {}
|
||||||
for data in self.elist:
|
for event_id in self.elist:
|
||||||
|
data = self.db.find_event_from_id(event_id)
|
||||||
place_id = data.get_place_id()
|
place_id = data.get_place_id()
|
||||||
|
|
||||||
if place_id:
|
if place_id:
|
||||||
place_name = self.db.find_place_from_id(place_id).get_title()
|
place_name = self.db.find_place_from_id(place_id).get_title()
|
||||||
else:
|
else:
|
||||||
|
214
src/RelLib.py
214
src/RelLib.py
@ -1103,8 +1103,8 @@ class Person(SourceNote):
|
|||||||
self.nickname = ""
|
self.nickname = ""
|
||||||
self.alternate_names = []
|
self.alternate_names = []
|
||||||
self.gender = 2
|
self.gender = 2
|
||||||
self.death = None
|
self.death_id = None
|
||||||
self.birth = None
|
self.birth_id = None
|
||||||
self.address_list = []
|
self.address_list = []
|
||||||
self.attribute_list = []
|
self.attribute_list = []
|
||||||
self.urls = []
|
self.urls = []
|
||||||
@ -1122,7 +1122,7 @@ class Person(SourceNote):
|
|||||||
def serialize(self):
|
def serialize(self):
|
||||||
return (self.id, self.gender,
|
return (self.id, self.gender,
|
||||||
self.primary_name, self.alternate_names, self.nickname,
|
self.primary_name, self.alternate_names, self.nickname,
|
||||||
self.death, self.birth, self.event_list,
|
self.death_id, self.birth_id, self.event_list,
|
||||||
self.family_list, self.parent_family_list,
|
self.family_list, self.parent_family_list,
|
||||||
self.photo_list,
|
self.photo_list,
|
||||||
self.address_list,
|
self.address_list,
|
||||||
@ -1144,12 +1144,17 @@ class Person(SourceNote):
|
|||||||
gender = const.female
|
gender = const.female
|
||||||
else:
|
else:
|
||||||
gender = const.unknown
|
gender = const.unknown
|
||||||
bday = self.get_birth().get_date_object()
|
bday = self.birth_id
|
||||||
dday = self.get_death().get_date_object()
|
dday = self.death_id
|
||||||
return [ GrampsCfg.display_name(self),self.id,gender,
|
return [ GrampsCfg.display_name(self),
|
||||||
bday.get_quote_date(), dday.get_quote_date(),
|
self.id,
|
||||||
|
gender,
|
||||||
|
bday,
|
||||||
|
dday,
|
||||||
self.get_primary_name().get_sort_name(),
|
self.get_primary_name().get_sort_name(),
|
||||||
sort.build_sort_date(bday),sort.build_sort_date(dday),
|
# sort.build_sort_date(bday),
|
||||||
|
# sort.build_sort_date(dday),
|
||||||
|
bday, dday,
|
||||||
GrampsCfg.display_surname(self.primary_name)]
|
GrampsCfg.display_surname(self.primary_name)]
|
||||||
|
|
||||||
def set_primary_name(self,name):
|
def set_primary_name(self,name):
|
||||||
@ -1225,47 +1230,41 @@ class Person(SourceNote):
|
|||||||
"""returns the gender of the Person"""
|
"""returns the gender of the Person"""
|
||||||
return self.gender
|
return self.gender
|
||||||
|
|
||||||
def set_birth(self,event) :
|
def set_birth_id(self,event_id) :
|
||||||
"""sets the birth event to the passed event"""
|
"""sets the birth event to the passed event"""
|
||||||
self.birth = event
|
self.birth_id = event_id
|
||||||
|
|
||||||
def set_death(self,event) :
|
def set_death_id(self,event_id) :
|
||||||
"""sets the death event to the passed event"""
|
"""sets the death event to the passed event"""
|
||||||
self.death = event
|
self.death_id = event_id
|
||||||
|
|
||||||
def get_birth(self) :
|
def get_birth_id(self) :
|
||||||
"""returns the birth event"""
|
"""returns the birth event"""
|
||||||
if self.birth == None:
|
return self.birth_id
|
||||||
self.birth = Event()
|
|
||||||
self.birth.name = "Birth"
|
|
||||||
return self.birth
|
|
||||||
|
|
||||||
def get_death(self) :
|
def get_death_id(self) :
|
||||||
"""returns the death event"""
|
"""returns the death event"""
|
||||||
if self.death == None:
|
return self.death_id
|
||||||
self.death = Event()
|
|
||||||
self.death.name = "Death"
|
|
||||||
return self.death
|
|
||||||
|
|
||||||
def get_valid_death(self):
|
# def get_valid_death(self):
|
||||||
e = self.death
|
# e = self.death
|
||||||
if e == None:
|
# if e == None:
|
||||||
return None
|
# return None
|
||||||
if e.place == None and (e.date == None or not e.date.getValid()) and \
|
# if e.place == None and (e.date == None or not e.date.getValid()) and \
|
||||||
e.description == "" and e.cause == "" and e.witness == None:
|
# e.description == "" and e.cause == "" and e.witness == None:
|
||||||
return None
|
# return None
|
||||||
else:
|
# else:
|
||||||
return e
|
# return e
|
||||||
|
|
||||||
def get_valid_birth(self):
|
# def get_valid_birth(self):
|
||||||
e = self.birth
|
# e = self.birth
|
||||||
if e == None:
|
# if e == None:
|
||||||
return None
|
# return None
|
||||||
if e.place == None and (e.date == None or not e.date.getValid()) and \
|
# if e.place == None and (e.date == None or not e.date.getValid()) and \
|
||||||
e.description == "" and e.cause == "" and e.witness == None:
|
# e.description == "" and e.cause == "" and e.witness == None:
|
||||||
return None
|
# return None
|
||||||
else:
|
# else:
|
||||||
return e
|
# return e
|
||||||
|
|
||||||
def add_photo(self,photo):
|
def add_photo(self,photo):
|
||||||
"""adds a Photo instance to the image list"""
|
"""adds a Photo instance to the image list"""
|
||||||
@ -1279,9 +1278,9 @@ class Person(SourceNote):
|
|||||||
"""Sets the list of Photo objects"""
|
"""Sets the list of Photo objects"""
|
||||||
self.photo_list = list
|
self.photo_list = list
|
||||||
|
|
||||||
def add_event(self,event):
|
def add_event_id(self,event_id):
|
||||||
"""adds an Event to the event list"""
|
"""adds an Event to the event list"""
|
||||||
self.event_list.append(event)
|
self.event_list.append(event_id)
|
||||||
|
|
||||||
def get_event_list(self):
|
def get_event_list(self):
|
||||||
"""returns the list of Event instances"""
|
"""returns the list of Event instances"""
|
||||||
@ -1561,6 +1560,7 @@ class Event(DataObj):
|
|||||||
self.description = source.description
|
self.description = source.description
|
||||||
self.name = source.name
|
self.name = source.name
|
||||||
self.cause = source.cause
|
self.cause = source.cause
|
||||||
|
self.id = source.id
|
||||||
try:
|
try:
|
||||||
if source.witness:
|
if source.witness:
|
||||||
self.witness = source.witness[:]
|
self.witness = source.witness[:]
|
||||||
@ -1575,6 +1575,30 @@ class Event(DataObj):
|
|||||||
self.name = ""
|
self.name = ""
|
||||||
self.cause = ""
|
self.cause = ""
|
||||||
self.witness = None
|
self.witness = None
|
||||||
|
self.id = None
|
||||||
|
|
||||||
|
def clone(self,source):
|
||||||
|
self.place = source.place
|
||||||
|
self.date = Date(source.date)
|
||||||
|
self.description = source.description
|
||||||
|
self.name = source.name
|
||||||
|
self.cause = source.cause
|
||||||
|
self.id = source.id
|
||||||
|
try:
|
||||||
|
if source.witness:
|
||||||
|
self.witness = source.witness[:]
|
||||||
|
else:
|
||||||
|
self.witness = None
|
||||||
|
except:
|
||||||
|
self.witness = None
|
||||||
|
|
||||||
|
def set_id(self,id):
|
||||||
|
"""Sets the gramps ID for the place object"""
|
||||||
|
self.id = id
|
||||||
|
|
||||||
|
def get_id(self):
|
||||||
|
"""Returns the gramps ID for the place object"""
|
||||||
|
return self.id
|
||||||
|
|
||||||
def get_witness_list(self):
|
def get_witness_list(self):
|
||||||
return self.witness
|
return self.witness
|
||||||
@ -1845,12 +1869,12 @@ class Family(SourceNote):
|
|||||||
"""sets the list of children"""
|
"""sets the list of children"""
|
||||||
self.child_list = list[:]
|
self.child_list = list[:]
|
||||||
|
|
||||||
def get_marriage(self):
|
# def get_marriage(self):
|
||||||
"""returns the marriage event of the Family. Obsolete"""
|
# """returns the marriage event of the Family. Obsolete"""
|
||||||
for e in self.event_list:
|
# for e in self.event_list:
|
||||||
if e.get_name() == "Marriage":
|
# if e.get_name() == "Marriage":
|
||||||
return e
|
# return e
|
||||||
return None
|
# return None
|
||||||
|
|
||||||
def get_divorce(self):
|
def get_divorce(self):
|
||||||
"""returns the divorce event of the Family. Obsolete"""
|
"""returns the divorce event of the Family. Obsolete"""
|
||||||
@ -1859,9 +1883,9 @@ class Family(SourceNote):
|
|||||||
return e
|
return e
|
||||||
return None
|
return None
|
||||||
|
|
||||||
def add_event(self,event):
|
def add_event_id(self,event_id):
|
||||||
"""adds an Event to the event list"""
|
"""adds an Event to the event list"""
|
||||||
self.event_list.append(event)
|
self.event_list.append(event_id)
|
||||||
|
|
||||||
def get_event_list(self) :
|
def get_event_list(self) :
|
||||||
"""returns the list of Event instances"""
|
"""returns the list of Event instances"""
|
||||||
@ -2159,12 +2183,14 @@ class GrampsDB:
|
|||||||
self.place_map = {}
|
self.place_map = {}
|
||||||
self.source_table = {}
|
self.source_table = {}
|
||||||
self.source_map = {}
|
self.source_map = {}
|
||||||
|
self.event_map = {}
|
||||||
self.family_map = {}
|
self.family_map = {}
|
||||||
self.iprefix = "I%d"
|
self.iprefix = "I%04d"
|
||||||
self.sprefix = "S%d"
|
self.sprefix = "S%04d"
|
||||||
self.oprefix = "O%d"
|
self.oprefix = "O%04d"
|
||||||
self.pprefix = "P%d"
|
self.pprefix = "P%04d"
|
||||||
self.fprefix = "F%d"
|
self.fprefix = "F%04d"
|
||||||
|
self.eprefix = "E%04d"
|
||||||
self.new()
|
self.new()
|
||||||
self.added_files = []
|
self.added_files = []
|
||||||
self.genderStats = GenderStats ()
|
self.genderStats = GenderStats ()
|
||||||
@ -2226,7 +2252,7 @@ class GrampsDB:
|
|||||||
else:
|
else:
|
||||||
self.iprefix = val + "%d"
|
self.iprefix = val + "%d"
|
||||||
else:
|
else:
|
||||||
self.iprefix = "I%d"
|
self.iprefix = "I%04d"
|
||||||
|
|
||||||
def set_sprefix(self,val):
|
def set_sprefix(self,val):
|
||||||
if val:
|
if val:
|
||||||
@ -2235,7 +2261,7 @@ class GrampsDB:
|
|||||||
else:
|
else:
|
||||||
self.sprefix = val + "%d"
|
self.sprefix = val + "%d"
|
||||||
else:
|
else:
|
||||||
self.sprefix = "S%d"
|
self.sprefix = "S%04d"
|
||||||
|
|
||||||
def set_oprefix(self,val):
|
def set_oprefix(self,val):
|
||||||
if val:
|
if val:
|
||||||
@ -2244,7 +2270,7 @@ class GrampsDB:
|
|||||||
else:
|
else:
|
||||||
self.oprefix = val + "%d"
|
self.oprefix = val + "%d"
|
||||||
else:
|
else:
|
||||||
self.oprefix = "O%d"
|
self.oprefix = "O%04d"
|
||||||
|
|
||||||
def set_pprefix(self,val):
|
def set_pprefix(self,val):
|
||||||
if val:
|
if val:
|
||||||
@ -2253,7 +2279,7 @@ class GrampsDB:
|
|||||||
else:
|
else:
|
||||||
self.pprefix = val + "%d"
|
self.pprefix = val + "%d"
|
||||||
else:
|
else:
|
||||||
self.pprefix = "P%d"
|
self.pprefix = "P%04d"
|
||||||
|
|
||||||
def set_fprefix(self,val):
|
def set_fprefix(self,val):
|
||||||
if val:
|
if val:
|
||||||
@ -2262,7 +2288,16 @@ class GrampsDB:
|
|||||||
else:
|
else:
|
||||||
self.fprefix = val + "%d"
|
self.fprefix = val + "%d"
|
||||||
else:
|
else:
|
||||||
self.fprefix = "F%d"
|
self.fprefix = "F%04d"
|
||||||
|
|
||||||
|
def set_eprefix(self,val):
|
||||||
|
if val:
|
||||||
|
if _id_reg.search(val):
|
||||||
|
self.eprefix = val
|
||||||
|
else:
|
||||||
|
self.eprefix = val + "%d"
|
||||||
|
else:
|
||||||
|
self.eprefix = "E%04d"
|
||||||
|
|
||||||
def new(self):
|
def new(self):
|
||||||
"""initializes the GrampsDB to empty values"""
|
"""initializes the GrampsDB to empty values"""
|
||||||
@ -2281,11 +2316,13 @@ class GrampsDB:
|
|||||||
self.surnames = []
|
self.surnames = []
|
||||||
self.person_map = {}
|
self.person_map = {}
|
||||||
self.source_map = {}
|
self.source_map = {}
|
||||||
|
self.event_map = {}
|
||||||
self.source_table = {}
|
self.source_table = {}
|
||||||
self.place_map = {}
|
self.place_map = {}
|
||||||
self.place_table = {}
|
self.place_table = {}
|
||||||
self.object_map = {}
|
self.object_map = {}
|
||||||
self.smap_index = 0
|
self.smap_index = 0
|
||||||
|
self.emap_index = 0
|
||||||
self.pmap_index = 0
|
self.pmap_index = 0
|
||||||
self.fmap_index = 0
|
self.fmap_index = 0
|
||||||
self.lmap_index = 0
|
self.lmap_index = 0
|
||||||
@ -2376,6 +2413,10 @@ class GrampsDB:
|
|||||||
"""returns a map of gramps's IDs to Source instances"""
|
"""returns a map of gramps's IDs to Source instances"""
|
||||||
return self.source_map
|
return self.source_map
|
||||||
|
|
||||||
|
def get_event_map(self):
|
||||||
|
"""returns a map of gramps's IDs to Source instances"""
|
||||||
|
return self.event_map
|
||||||
|
|
||||||
def get_object_map(self):
|
def get_object_map(self):
|
||||||
"""returns a map of gramps's IDs to Object instances"""
|
"""returns a map of gramps's IDs to Object instances"""
|
||||||
return self.object_map
|
return self.object_map
|
||||||
@ -2393,7 +2434,8 @@ class GrampsDB:
|
|||||||
instances in the database"""
|
instances in the database"""
|
||||||
map = {}
|
map = {}
|
||||||
for person in self.person_map.values():
|
for person in self.person_map.values():
|
||||||
for event in person.get_event_list():
|
for event_id in person.get_event_list():
|
||||||
|
event = self.event_map[event_id]
|
||||||
map[event.get_name()] = 1
|
map[event.get_name()] = 1
|
||||||
return map.keys()
|
return map.keys()
|
||||||
|
|
||||||
@ -2421,8 +2463,9 @@ class GrampsDB:
|
|||||||
instances in the database"""
|
instances in the database"""
|
||||||
map = {}
|
map = {}
|
||||||
for family in self.family_map.values():
|
for family in self.family_map.values():
|
||||||
for attr in family.get_event_list():
|
for event_id in family.get_event_list():
|
||||||
map[attr.get_name()] = 1
|
event = self.event_map[event_id]
|
||||||
|
map[event.get_name()] = 1
|
||||||
return map.keys()
|
return map.keys()
|
||||||
|
|
||||||
def get_place_ids(self):
|
def get_place_ids(self):
|
||||||
@ -2445,6 +2488,9 @@ class GrampsDB:
|
|||||||
del self.source_map[id]
|
del self.source_map[id]
|
||||||
del self.source_table[id]
|
del self.source_table[id]
|
||||||
|
|
||||||
|
def remove_event_id(self,id):
|
||||||
|
del self.event_map[id]
|
||||||
|
|
||||||
def add_person_as(self,person):
|
def add_person_as(self,person):
|
||||||
self.person_map[person.get_id()] = person
|
self.person_map[person.get_id()] = person
|
||||||
self.genderStats.count_person (person, self)
|
self.genderStats.count_person (person, self)
|
||||||
@ -2517,6 +2563,19 @@ class GrampsDB:
|
|||||||
self.smap_index = self.smap_index + 1
|
self.smap_index = self.smap_index + 1
|
||||||
return index
|
return index
|
||||||
|
|
||||||
|
def add_event(self,event):
|
||||||
|
"""adds a Event instance to the database, assigning it a gramps'
|
||||||
|
ID number"""
|
||||||
|
|
||||||
|
index = self.eprefix % self.emap_index
|
||||||
|
while self.event_map.has_key(index):
|
||||||
|
self.emap_index += 1
|
||||||
|
index = self.eprefix % self.emap_index
|
||||||
|
event.set_id(index)
|
||||||
|
self.event_map[index] = event
|
||||||
|
self.emap_index += 1
|
||||||
|
return index
|
||||||
|
|
||||||
def add_source_no_map(self,source,index):
|
def add_source_no_map(self,source,index):
|
||||||
"""adds a Source to the database if the gramps' ID is known"""
|
"""adds a Source to the database if the gramps' ID is known"""
|
||||||
source.set_id(index)
|
source.set_id(index)
|
||||||
@ -2525,6 +2584,13 @@ class GrampsDB:
|
|||||||
self.source_table[index] = source.get_display_info()
|
self.source_table[index] = source.get_display_info()
|
||||||
return index
|
return index
|
||||||
|
|
||||||
|
def add_event_no_map(self,event,index):
|
||||||
|
"""adds a Source to the database if the gramps' ID is known"""
|
||||||
|
event.set_id(index)
|
||||||
|
self.event_map[index] = event
|
||||||
|
self.emap_index += 1
|
||||||
|
return index
|
||||||
|
|
||||||
def find_source(self,idVal,map):
|
def find_source(self,idVal,map):
|
||||||
"""finds a Source in the database using the idVal and map
|
"""finds a Source in the database using the idVal and map
|
||||||
variables to translate between the external ID and gramps'
|
variables to translate between the external ID and gramps'
|
||||||
@ -2542,6 +2608,22 @@ class GrampsDB:
|
|||||||
self.source_table[map[idVal]] = source.get_display_info()
|
self.source_table[map[idVal]] = source.get_display_info()
|
||||||
return source
|
return source
|
||||||
|
|
||||||
|
def find_event(self,idVal,map):
|
||||||
|
"""finds a Event in the database using the idVal and map
|
||||||
|
variables to translate between the external ID and gramps'
|
||||||
|
internal ID. If no such Event exists, a new Event instance
|
||||||
|
is created.
|
||||||
|
|
||||||
|
idVal - external ID number
|
||||||
|
map - map build by find_source of external to gramp's IDs"""
|
||||||
|
|
||||||
|
if map.has_key(idVal):
|
||||||
|
event = self.event_map[map[idVal]]
|
||||||
|
else:
|
||||||
|
event = Event()
|
||||||
|
map[idVal] = self.add_event(event)
|
||||||
|
return event
|
||||||
|
|
||||||
def find_source_from_id(self,val):
|
def find_source_from_id(self,val):
|
||||||
"""finds a Source in the database from the passed gramps' ID.
|
"""finds a Source in the database from the passed gramps' ID.
|
||||||
If no such Source exists, a new Source is added to the database."""
|
If no such Source exists, a new Source is added to the database."""
|
||||||
@ -2554,6 +2636,12 @@ class GrampsDB:
|
|||||||
self.source_table[val] = source.get_display_info()
|
self.source_table[val] = source.get_display_info()
|
||||||
return source
|
return source
|
||||||
|
|
||||||
|
def find_event_from_id(self,val):
|
||||||
|
"""finds a Family in the database from the passed gramps' ID.
|
||||||
|
If no such Family exists, a new Family is added to the database."""
|
||||||
|
|
||||||
|
return self.event_map.get(val)
|
||||||
|
|
||||||
def add_object(self,object):
|
def add_object(self,object):
|
||||||
"""adds an Object instance to the database, assigning it a gramps'
|
"""adds an Object instance to the database, assigning it a gramps'
|
||||||
ID number"""
|
ID number"""
|
||||||
|
@ -256,9 +256,12 @@ class XmlWriter:
|
|||||||
self.dump_name("aka",name,3)
|
self.dump_name("aka",name,3)
|
||||||
|
|
||||||
self.write_line("nick",person.get_nick_name(),3)
|
self.write_line("nick",person.get_nick_name(),3)
|
||||||
self.dump_my_event("Birth",person.get_birth(),3)
|
birth = self.db.find_event_from_id(person.get_birth_id())
|
||||||
self.dump_my_event("Death",person.get_death(),3)
|
death = self.db.find_event_from_id(person.get_death_id())
|
||||||
for event in person.get_event_list():
|
self.dump_my_event("Birth",birth,3)
|
||||||
|
self.dump_my_event("Death",death,3)
|
||||||
|
for event_id in person.get_event_list():
|
||||||
|
event = self.db.find_event_from_id(event_id)
|
||||||
self.dump_event(event,3)
|
self.dump_event(event,3)
|
||||||
|
|
||||||
self.dump_ordinance("baptism",person.get_lds_baptism(),3)
|
self.dump_ordinance("baptism",person.get_lds_baptism(),3)
|
||||||
@ -321,7 +324,8 @@ class XmlWriter:
|
|||||||
self.write_family_id(family,2)
|
self.write_family_id(family,2)
|
||||||
self.write_ref("father",family.get_father_id(),3)
|
self.write_ref("father",family.get_father_id(),3)
|
||||||
self.write_ref("mother",family.get_mother_id(),3)
|
self.write_ref("mother",family.get_mother_id(),3)
|
||||||
for event in family.get_event_list():
|
for event_id in family.get_event_list():
|
||||||
|
event = self.db.find_event_from_id(event_id)
|
||||||
self.dump_event(event,3)
|
self.dump_event(event,3)
|
||||||
self.dump_ordinance("sealed_to_spouse",family.get_lds_sealing(),3)
|
self.dump_ordinance("sealed_to_spouse",family.get_lds_sealing(),3)
|
||||||
|
|
||||||
@ -538,8 +542,8 @@ class XmlWriter:
|
|||||||
self.g.write('>\n')
|
self.g.write('>\n')
|
||||||
|
|
||||||
def write_last(self,name,indent=1):
|
def write_last(self,name,indent=1):
|
||||||
p = name.Prefix
|
p = name.get_surname_prefix()
|
||||||
n = name.Surname
|
n = name.get_surname()
|
||||||
if p:
|
if p:
|
||||||
self.g.write('%s<last prefix="%s">%s</last>\n' % (' '*indent,p,self.fix(n)))
|
self.g.write('%s<last prefix="%s">%s</last>\n' % (' '*indent,p,self.fix(n)))
|
||||||
else:
|
else:
|
||||||
|
Loading…
Reference in New Issue
Block a user