gedcom import/export with new lds scheme
svn: r6275
This commit is contained in:
parent
824e61b9d6
commit
b2b8c284a9
@ -1,4 +1,6 @@
|
||||
2006-04-05 Don Allingham <don@gramps-project.org>
|
||||
* src/GrampsDb/_ReadGedcom.py: support new lds stuff
|
||||
* src/GrampsDb/_WriteGedcom.py: support new lds stuff
|
||||
* src/Editors/_EditLdsOrd.py: save place information
|
||||
* src/GrampsWidgets.py: select default value in menu
|
||||
* src/BaseDoc.py: pylint
|
||||
|
@ -140,6 +140,23 @@ pedi_type = {
|
||||
'foster' : (RelLib.Person.CHILD_FOSTER,''),
|
||||
}
|
||||
|
||||
lds_status = {
|
||||
"BIC" : RelLib.LdsOrd.STATUS_BIC,
|
||||
"CANCELED" : RelLib.LdsOrd.STATUS_CANCELED,
|
||||
"CHILD" : RelLib.LdsOrd.STATUS_CHILD,
|
||||
"CLEARED" : RelLib.LdsOrd.STATUS_CLEARED,
|
||||
"COMPLETED": RelLib.LdsOrd.STATUS_COMPLETED,
|
||||
"DNS" : RelLib.LdsOrd.STATUS_DNS,
|
||||
"INFANT" : RelLib.LdsOrd.STATUS_INFANT,
|
||||
"PRE-1970" : RelLib.LdsOrd.STATUS_PRE_1970,
|
||||
"QUALIFIED": RelLib.LdsOrd.STATUS_QUALIFIED,
|
||||
"DNS/CAN" : RelLib.LdsOrd.STATUS_DNS_CAN,
|
||||
"STILLBORN": RelLib.LdsOrd.STATUS_STILLBORN,
|
||||
"SUBMITTED": RelLib.LdsOrd.STATUS_SUBMITTED,
|
||||
"UNCLEARED": RelLib.LdsOrd.STATUS_UNCLEARED,
|
||||
}
|
||||
|
||||
|
||||
_event_family_str = _("%(event_name)s of %(family)s")
|
||||
_event_person_str = _("%(event_name)s of %(person)s")
|
||||
|
||||
@ -1076,7 +1093,8 @@ class GedcomParser:
|
||||
self.ignore_sub_junk(2)
|
||||
elif matches[1] == TOKEN_SLGS:
|
||||
lds_ord = RelLib.LdsOrd()
|
||||
self.family.set_lds_sealing(lds_ord)
|
||||
lds_org.set_type(RelLib.LdsOrd.SEAL_TO_SPOUSE)
|
||||
self.family.lds_ord_list.append(lds_ord)
|
||||
self.parse_ord(lds_ord,2)
|
||||
elif matches[1] == TOKEN_ADDR:
|
||||
self.addr = RelLib.Address()
|
||||
@ -1431,8 +1449,7 @@ class GedcomParser:
|
||||
elif matches[1] == TOKEN_NOTE:
|
||||
note = self.parse_note(matches,lds_ord,level+1,note)
|
||||
elif matches[1] == TOKEN_STAT:
|
||||
if lds.status.has_key(matches[2]):
|
||||
lds_ord.set_status(lds.status[matches[2]])
|
||||
lds_ord.set_status(lds_status.get(matches[2],RelLib.LdsOrd.STATUS_NONE))
|
||||
else:
|
||||
self.barf(level+1)
|
||||
|
||||
@ -2055,17 +2072,20 @@ class GedcomParser:
|
||||
|
||||
def func_person_bapl(self,matches,state):
|
||||
lds_ord = RelLib.LdsOrd()
|
||||
state.person.set_lds_baptism(lds_ord)
|
||||
lds_ord.set_type(RelLib.LdsOrd.BAPTISM)
|
||||
state.person.lds_ord_list.append(lds_ord)
|
||||
self.parse_ord(lds_ord,2)
|
||||
|
||||
def func_person_endl(self,matches,state):
|
||||
lds_ord = RelLib.LdsOrd()
|
||||
state.person.set_lds_endowment(lds_ord)
|
||||
lds_ord.set_type(RelLib.LdsOrd.ENDOWMENT)
|
||||
state.person.lds_ord_list.append(lds_ord)
|
||||
self.parse_ord(lds_ord,2)
|
||||
|
||||
def func_person_slgc(self,matches,state):
|
||||
lds_ord = RelLib.LdsOrd()
|
||||
state.person.set_lds_sealing(lds_ord)
|
||||
lds_ord.set_type(RelLib.LdsOrd.SEAL_TO_PARENTS)
|
||||
state.person.lds_ord_list.append(lds_ord)
|
||||
self.parse_ord(lds_ord,2)
|
||||
|
||||
def func_person_fams(self,matches,state):
|
||||
@ -2403,7 +2423,9 @@ def load_place_values(place,text):
|
||||
def extract_temple(matches):
|
||||
try:
|
||||
if lds.temple_to_abrev.has_key(matches[2]):
|
||||
return lds.temple_to_abrev[matches[2]]
|
||||
return matches[2]
|
||||
elif lds.temple_codes.has_key(matches[2]):
|
||||
return lds.temple_codes[2]
|
||||
else:
|
||||
values = matches[2].split()
|
||||
return lds.temple_to_abrev[values[0]]
|
||||
|
@ -116,6 +116,30 @@ _caldef = {
|
||||
RelLib.Date.MOD_AFTER : "AFT",
|
||||
}
|
||||
|
||||
|
||||
lds_ord_name = {
|
||||
RelLib.LdsOrd.BAPTISM : 'BAPL',
|
||||
RelLib.LdsOrd.ENDOWMENT : 'ENDL',
|
||||
RelLib.LdsOrd.SEAL_TO_PARENTS : 'SLGC',
|
||||
RelLib.LdsOrd.SEAL_TO_SPOUSE : 'SGLS',
|
||||
}
|
||||
|
||||
lds_status = {
|
||||
RelLib.LdsOrd.STATUS_BIC : "BIC",
|
||||
RelLib.LdsOrd.STATUS_CANCELED : "CANCELED",
|
||||
RelLib.LdsOrd.STATUS_CHILD : "CHILD",
|
||||
RelLib.LdsOrd.STATUS_CLEARED : "CLEARED",
|
||||
RelLib.LdsOrd.STATUS_COMPLETED : "COMPLETED",
|
||||
RelLib.LdsOrd.STATUS_DNS : "DNS",
|
||||
RelLib.LdsOrd.STATUS_INFANT : "INFANT",
|
||||
RelLib.LdsOrd.STATUS_PRE_1970 : "PRE-1970",
|
||||
RelLib.LdsOrd.STATUS_QUALIFIED : "QUALIFIED",
|
||||
RelLib.LdsOrd.STATUS_DNS_CAN : "DNS/CAN",
|
||||
RelLib.LdsOrd.STATUS_STILLBORN : "STILLBORN",
|
||||
RelLib.LdsOrd.STATUS_SUBMITTED : "SUBMITTED" ,
|
||||
RelLib.LdsOrd.STATUS_UNCLEARED : "UNCLEARED",
|
||||
}
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
#
|
||||
@ -728,7 +752,8 @@ class GedcomWriter:
|
||||
mother_alive = Utils.probably_alive(person,self.db)
|
||||
|
||||
if not self.restrict or ( not father_alive and not mother_alive ):
|
||||
self.write_ord("SLGS",family.get_lds_sealing(),1,lds.ssealing)
|
||||
for lds in family.get_lds_ord_list():
|
||||
self.write_ord(lds,1)
|
||||
|
||||
for event_ref in family.get_event_ref_list():
|
||||
event_handle = event_ref.ref
|
||||
@ -886,9 +911,8 @@ class GedcomWriter:
|
||||
|
||||
ad = 0
|
||||
|
||||
self.write_ord("BAPL",person.get_lds_baptism(),1,lds.baptism)
|
||||
self.write_ord("ENDL",person.get_lds_endowment(),1,lds.baptism)
|
||||
self.write_ord("SLGC",person.get_lds_sealing(),1,lds.csealing)
|
||||
for lds_ord in person.get_lds_ord_list():
|
||||
self.write_ord(lds_ord,1)
|
||||
|
||||
for event_ref in person.get_event_ref_list():
|
||||
event = self.db.get_event_from_handle(event_ref.ref)
|
||||
@ -1165,10 +1189,8 @@ class GedcomWriter:
|
||||
continue
|
||||
self.write_photo(photo,2)
|
||||
|
||||
def write_ord(self,name,ord,index,statlist):
|
||||
if ord == None:
|
||||
return
|
||||
self.writeln('%d %s' % (index,name))
|
||||
def write_ord(self, ord, index):
|
||||
self.writeln('%d %s' % (index, lds_ord_name[ord.get_type()]))
|
||||
self.print_date("%d DATE" % (index + 1), ord.get_date_object())
|
||||
if ord.get_family_handle():
|
||||
family_id = ord.get_family_handle()
|
||||
@ -1179,8 +1201,8 @@ class GedcomWriter:
|
||||
self.writeln('%d TEMP %s' % (index+1,ord.get_temple()))
|
||||
if ord.get_place_handle():
|
||||
self.write_place(self.db.get_place_from_handle(ord.get_place_handle()),2)
|
||||
if ord.get_status() != 0:
|
||||
self.writeln("2 STAT %s" % self.cnvtxt(statlist[ord.get_status()]))
|
||||
if ord.get_status() != RelLib.LdsOrd.STATUS_NONE:
|
||||
self.writeln("2 STAT %s" % self.cnvtxt(lds_status[ord.get_status()]))
|
||||
if ord.get_note():
|
||||
self.write_long_text("NOTE",index+1,self.cnvtxt(ord.get_note()))
|
||||
for srcref in ord.get_source_references():
|
||||
|
@ -67,7 +67,7 @@ class LdsOrd(SourceNote,DateBase,PlaceBase,PrivacyBase):
|
||||
STATUS_STILLBORN = 11
|
||||
STATUS_SUBMITTED = 12
|
||||
STATUS_UNCLEARED = 13
|
||||
|
||||
|
||||
def __init__(self,source=None):
|
||||
"""Creates a LDS Ordinance instance"""
|
||||
SourceNote.__init__(self,source)
|
||||
|
@ -208,29 +208,3 @@ ord_status = [
|
||||
_("Uncleared"),
|
||||
]
|
||||
|
||||
status = {
|
||||
"BIC" : 1, "CANCELED" : 1, "CHILD" : 1,
|
||||
"CLEARED" : 2, "COMPLETED" : 3, "DNS" : 4,
|
||||
"INFANT" : 4, "PRE-1970" : 5, "QUALIFIED" : 6,
|
||||
"DNS/CAN" : 7, "STILLBORN" : 7, "SUBMITTED" : 8,
|
||||
"UNCLEARED" : 9,
|
||||
}
|
||||
|
||||
baptism = [
|
||||
_("<No Status>"), _("Child"), _("Cleared"), _("Completed"),
|
||||
_("Infant"), _("Pre-1970"), _("Qualified"), _("Stillborn"),
|
||||
_("Submitted"), _("Uncleared"),
|
||||
]
|
||||
|
||||
csealing = [
|
||||
_("<No Status>"), _("BIC"), _("Cleared"), _("Completed"),
|
||||
_("DNS"), _("Pre-1970"), _("Qualified"), _("Stillborn"),
|
||||
_("Submitted"), _("Uncleared"),
|
||||
]
|
||||
|
||||
ssealing = [
|
||||
_("<No Status>"), _("Canceled"), _("Cleared"), _("Completed"),
|
||||
_("DNS"), _("Pre-1970"), _("Qualified"), _("DNS/CAN"),
|
||||
_("Submitted"), _("Uncleared"),
|
||||
]
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user