Import/Export GEDCOM with LDS ordinances

svn: r602
This commit is contained in:
Don Allingham 2001-12-01 06:08:41 +00:00
parent 2206b96e64
commit a5b6ad9b44
3 changed files with 47 additions and 2 deletions

View File

@ -206,7 +206,6 @@ personalConstantEvents = {
"Adult Christening" : "CHRA", "Adult Christening" : "CHRA",
"Alternate Birth" : "BIRT", "Alternate Birth" : "BIRT",
"Alternate Death" : "DEAT", "Alternate Death" : "DEAT",
"Baptism (LDS)" : "BAPL",
"Baptism" : "BAPM", "Baptism" : "BAPM",
"Bar Mitzvah" : "BARM", "Bar Mitzvah" : "BARM",
"Bas Mitzvah" : "BASM", "Bas Mitzvah" : "BASM",
@ -242,7 +241,6 @@ _pe_e2l = {
"Alternate Birth" : _("Alternate Birth"), "Alternate Birth" : _("Alternate Birth"),
"Alternate Death" : _("Alternate Death"), "Alternate Death" : _("Alternate Death"),
"Adult Christening" : _("Adult Christening"), "Adult Christening" : _("Adult Christening"),
"Baptism (LDS)" : _("Baptism (LDS)"),
"Baptism" : _("Baptism"), "Baptism" : _("Baptism"),
"Bar Mitzvah" : _("Bar Mitzvah"), "Bar Mitzvah" : _("Bar Mitzvah"),
"Bas Mitzvah" : _("Bas Mitzvah"), "Bas Mitzvah" : _("Bas Mitzvah"),

View File

@ -414,6 +414,10 @@ class GedcomParser:
elif matches[1] == "WIFE": elif matches[1] == "WIFE":
self.family.setMother(self.db.findPerson(matches[2],self.pmap)) self.family.setMother(self.db.findPerson(matches[2],self.pmap))
self.ignore_sub_junk(2) self.ignore_sub_junk(2)
elif matches[1] == "SLGS":
ord = LdsOrd()
self.family.setLdsSeal(ord)
self.parse_ord(ord,2)
elif matches[1] == "ADDR": elif matches[1] == "ADDR":
self.addr = Address() self.addr = Address()
self.addr.setStreet(matches[2] + self.parse_continue_data()) self.addr.setStreet(matches[2] + self.parse_continue_data())
@ -535,6 +539,15 @@ class GedcomParser:
self.person.setGender(Person.male) self.person.setGender(Person.male)
else: else:
self.person.setGender(Person.female) 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": elif matches[1] == "FAMS":
family = self.db.findFamily(matches[2],self.fmap) family = self.db.findFamily(matches[2],self.fmap)
self.person.addFamily(family) self.person.addFamily(family)
@ -855,6 +868,23 @@ class GedcomParser:
else: else:
self.barf(level+1) 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): def parse_person_event(self,event,level):
note = "" note = ""
while 1: while 1:

View File

@ -614,6 +614,8 @@ class GedcomWriter:
father = family.getFather() father = family.getFather()
mother = family.getMother() mother = family.getMother()
if not self.probably_alive(father) or not self.probably_alive(mother): if not self.probably_alive(father) or not self.probably_alive(mother):
self.write_ord("SLGS",family.getLdsSeal(),1)
for event in family.getEventList(): for event in family.getEventList():
if self.private and event.getPrivacy(): if self.private and event.getPrivacy():
continue continue
@ -717,6 +719,11 @@ class GedcomWriter:
self.g.write("1 _UID %s\n" % uid) self.g.write("1 _UID %s\n" % uid)
ad = 0 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(): for event in person.getEventList():
if self.private and event.getPrivacy(): if self.private and event.getPrivacy():
continue continue
@ -928,6 +935,16 @@ class GedcomWriter:
for srcref in event.getSourceRefList(): for srcref in event.getSourceRefList():
self.write_source_ref(2,srcref) 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): def print_date(self,prefix,date):
start = date.get_start_date() start = date.get_start_date()