Import/Export GEDCOM with LDS ordinances
svn: r602
This commit is contained in:
parent
d5e62301b1
commit
de95ce3c9f
@ -206,7 +206,6 @@ personalConstantEvents = {
|
||||
"Adult Christening" : "CHRA",
|
||||
"Alternate Birth" : "BIRT",
|
||||
"Alternate Death" : "DEAT",
|
||||
"Baptism (LDS)" : "BAPL",
|
||||
"Baptism" : "BAPM",
|
||||
"Bar Mitzvah" : "BARM",
|
||||
"Bas Mitzvah" : "BASM",
|
||||
@ -242,7 +241,6 @@ _pe_e2l = {
|
||||
"Alternate Birth" : _("Alternate Birth"),
|
||||
"Alternate Death" : _("Alternate Death"),
|
||||
"Adult Christening" : _("Adult Christening"),
|
||||
"Baptism (LDS)" : _("Baptism (LDS)"),
|
||||
"Baptism" : _("Baptism"),
|
||||
"Bar Mitzvah" : _("Bar Mitzvah"),
|
||||
"Bas Mitzvah" : _("Bas Mitzvah"),
|
||||
|
@ -414,6 +414,10 @@ class GedcomParser:
|
||||
elif matches[1] == "WIFE":
|
||||
self.family.setMother(self.db.findPerson(matches[2],self.pmap))
|
||||
self.ignore_sub_junk(2)
|
||||
elif matches[1] == "SLGS":
|
||||
ord = LdsOrd()
|
||||
self.family.setLdsSeal(ord)
|
||||
self.parse_ord(ord,2)
|
||||
elif matches[1] == "ADDR":
|
||||
self.addr = Address()
|
||||
self.addr.setStreet(matches[2] + self.parse_continue_data())
|
||||
@ -535,6 +539,15 @@ class GedcomParser:
|
||||
self.person.setGender(Person.male)
|
||||
else:
|
||||
self.person.setGender(Person.female)
|
||||
elif matches[1] in [ "BAPL", "ENDL", "SLGC" ]:
|
||||
ord = LdsOrd()
|
||||
if matches[1] == "BAPL":
|
||||
self.person.setLdsBaptism(ord)
|
||||
elif matches[1] == "ENDL":
|
||||
self.person.setLdsEndowment(ord)
|
||||
else:
|
||||
self.person.setLdsSeal(ord)
|
||||
self.parse_ord(ord,2)
|
||||
elif matches[1] == "FAMS":
|
||||
family = self.db.findFamily(matches[2],self.fmap)
|
||||
self.person.addFamily(family)
|
||||
@ -855,6 +868,23 @@ class GedcomParser:
|
||||
else:
|
||||
self.barf(level+1)
|
||||
|
||||
def parse_ord(self,ord,level):
|
||||
while 1:
|
||||
matches = self.get_next()
|
||||
if int(matches[0]) < level:
|
||||
self.backup()
|
||||
break
|
||||
elif matches[1] == "TEMP":
|
||||
ord.setTemple(matches[2])
|
||||
elif matches[1] == "DATE":
|
||||
ord.setDateObj(self.extract_date(matches[2]))
|
||||
elif matches[1] == "FAMC":
|
||||
ord.setFamily(self.db.findFamily(matches[2],self.fmap))
|
||||
elif matches[1] == ["PLAC", "STAT", "SOUR", "NOTE" ]:
|
||||
self.ignore_sub_junk(level+1)
|
||||
else:
|
||||
self.barf(level+1)
|
||||
|
||||
def parse_person_event(self,event,level):
|
||||
note = ""
|
||||
while 1:
|
||||
|
@ -614,6 +614,8 @@ class GedcomWriter:
|
||||
father = family.getFather()
|
||||
mother = family.getMother()
|
||||
if not self.probably_alive(father) or not self.probably_alive(mother):
|
||||
self.write_ord("SLGS",family.getLdsSeal(),1)
|
||||
|
||||
for event in family.getEventList():
|
||||
if self.private and event.getPrivacy():
|
||||
continue
|
||||
@ -717,6 +719,11 @@ class GedcomWriter:
|
||||
self.g.write("1 _UID %s\n" % uid)
|
||||
|
||||
ad = 0
|
||||
|
||||
self.write_ord("BAPL",person.getLdsBaptism(),1)
|
||||
self.write_ord("ENDL",person.getLdsBaptism(),1)
|
||||
self.write_ord("SLGC",person.getLdsSeal(),1)
|
||||
|
||||
for event in person.getEventList():
|
||||
if self.private and event.getPrivacy():
|
||||
continue
|
||||
@ -928,6 +935,16 @@ class GedcomWriter:
|
||||
for srcref in event.getSourceRefList():
|
||||
self.write_source_ref(2,srcref)
|
||||
|
||||
def write_ord(self,name,ord,index):
|
||||
if ord == None:
|
||||
return
|
||||
self.g.write('%d %s\n' % (index,name))
|
||||
self.print_date("%d DATE" % (index + 1), ord.getDateObj())
|
||||
if ord.getTemple() != "":
|
||||
self.g.write('%d TEMP %s\n' % (index+1,ord.getTemple()))
|
||||
if ord.getFamily():
|
||||
self.g.write('%d FAMC @%s@\n' % (index+1,self.fid(ord.getFamily().getId())))
|
||||
|
||||
def print_date(self,prefix,date):
|
||||
start = date.get_start_date()
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user