GEDCOM improvements, enhanced LDS
svn: r631
This commit is contained in:
parent
dd0a85bf9f
commit
31375160e8
File diff suppressed because it is too large
Load Diff
@ -81,6 +81,7 @@ class EditPerson:
|
||||
self.callback = callback
|
||||
self.path = db.getSavePath()
|
||||
self.not_loaded = 1
|
||||
self.lds_not_loaded = 1
|
||||
self.lists_changed = 0
|
||||
self.update_birth = 0
|
||||
self.update_death = 0
|
||||
@ -124,6 +125,12 @@ class EditPerson:
|
||||
"on_name_button_press" : self.aka_double_click,
|
||||
"on_name_list_select_row" : self.on_name_list_select_row,
|
||||
"on_name_note_clicked" : self.on_name_note_clicked,
|
||||
"on_ldsbap_note_clicked" : self.on_ldsbap_note_clicked,
|
||||
"on_ldsendow_note_clicked" : self.on_ldsendow_note_clicked,
|
||||
"on_ldsseal_note_clicked" : self.on_ldsseal_note_clicked,
|
||||
"on_ldsbap_src_clicked" : self.on_ldsbap_source_clicked,
|
||||
"on_ldsendow_src_clicked" : self.on_ldsendow_source_clicked,
|
||||
"on_ldsseal_src_clicked" : self.on_ldsseal_source_clicked,
|
||||
"on_name_source_clicked" : self.on_primary_name_source_clicked,
|
||||
"on_photolist_button_press_event" : self.gallery.on_photolist_button_press_event,
|
||||
"on_photolist_select_icon" : self.gallery.on_photo_select_icon,
|
||||
@ -195,6 +202,12 @@ class EditPerson:
|
||||
self.ldsseal_date = self.get_widget("sealdate")
|
||||
self.ldsseal_temple = self.get_widget("sealtemple")
|
||||
self.ldsseal_fam = self.get_widget("sealparents")
|
||||
self.ldsbapstat = self.get_widget("ldsbapstat")
|
||||
self.ldssealstat = self.get_widget("sealstat")
|
||||
self.ldsendowstat = self.get_widget("endowstat")
|
||||
self.ldsbapplace = self.get_widget("ldsbapplace")
|
||||
self.ldssealplace = self.get_widget("sealplace")
|
||||
self.ldsendowplace = self.get_widget("endowplace")
|
||||
|
||||
self.elist = person.getEventList()[:]
|
||||
self.nlist = person.getAlternateNames()[:]
|
||||
@ -273,6 +286,7 @@ class EditPerson:
|
||||
ord = person.getLdsBaptism()
|
||||
self.ldsbap_temple.set_popdown_strings(_temple_names)
|
||||
if ord:
|
||||
self.bap_stat = ord.getStatus()
|
||||
self.ldsbap_date.set_text(ord.getDate())
|
||||
if ord.getTemple() != "":
|
||||
name = const.lds_temple_to_abrev[ord.getTemple()]
|
||||
@ -280,11 +294,13 @@ class EditPerson:
|
||||
name = ""
|
||||
self.ldsbap_temple.entry.set_text(name)
|
||||
else:
|
||||
self.bap_stat = 0
|
||||
self.ldsbap_temple.entry.set_text("")
|
||||
|
||||
ord = person.getLdsEndowment()
|
||||
self.ldsend_temple.set_popdown_strings(_temple_names)
|
||||
if ord:
|
||||
self.end_stat = ord.getStatus()
|
||||
self.ldsend_date.set_text(ord.getDate())
|
||||
if ord.getTemple() != "":
|
||||
name = const.lds_temple_to_abrev[ord.getTemple()]
|
||||
@ -292,11 +308,13 @@ class EditPerson:
|
||||
name = ""
|
||||
self.ldsend_temple.entry.set_text(name)
|
||||
else:
|
||||
self.end_stat = 0
|
||||
self.ldsend_temple.entry.set_text("")
|
||||
|
||||
ord = person.getLdsSeal()
|
||||
self.ldsseal_temple.set_popdown_strings(_temple_names)
|
||||
if ord:
|
||||
self.seal_stat = ord.getStatus()
|
||||
self.ldsseal_date.set_text(ord.getDate())
|
||||
self.ldsfam = ord.getFamily()
|
||||
if ord.getTemple() != "":
|
||||
@ -305,6 +323,7 @@ class EditPerson:
|
||||
name = ""
|
||||
self.ldsseal_temple.entry.set_text(name)
|
||||
else:
|
||||
self.seal_stat = 0
|
||||
self.ldsseal_temple.entry.set_text("")
|
||||
self.ldsfam = None
|
||||
|
||||
@ -364,6 +383,10 @@ class EditPerson:
|
||||
self.addr_list.connect('drag_data_get', self.ad_drag_data_get)
|
||||
self.addr_list.connect('drag_data_received', self.ad_drag_data_received)
|
||||
|
||||
self.build_bap_menu()
|
||||
self.build_seal_menu()
|
||||
self.build_endow_menu()
|
||||
|
||||
# draw lists
|
||||
self.redraw_event_list()
|
||||
self.redraw_attr_list()
|
||||
@ -372,6 +395,55 @@ class EditPerson:
|
||||
self.redraw_url_list()
|
||||
self.window.show()
|
||||
|
||||
|
||||
def build_bap_menu(self):
|
||||
menu = gtk.GtkMenu()
|
||||
index = 0
|
||||
for val in const.lds_baptism_index:
|
||||
menuitem = gtk.GtkMenuItem(val)
|
||||
menuitem.set_data("val",index)
|
||||
menuitem.connect('activate',self.set_lds_bap)
|
||||
menuitem.show()
|
||||
menu.append(menuitem)
|
||||
index = index + 1
|
||||
self.ldsbapstat.set_menu(menu)
|
||||
self.ldsbapstat.set_history(self.bap_stat)
|
||||
|
||||
def build_endow_menu(self):
|
||||
menu = gtk.GtkMenu()
|
||||
index = 0
|
||||
for val in const.lds_baptism_index:
|
||||
menuitem = gtk.GtkMenuItem(val)
|
||||
menuitem.set_data("val",index)
|
||||
menuitem.connect('activate',self.set_lds_endow)
|
||||
menuitem.show()
|
||||
menu.append(menuitem)
|
||||
index = index + 1
|
||||
self.ldsendowstat.set_menu(menu)
|
||||
self.ldsendowstat.set_history(self.end_stat)
|
||||
|
||||
def build_seal_menu(self):
|
||||
menu = gtk.GtkMenu()
|
||||
index = 0
|
||||
for val in const.lds_csealing_index:
|
||||
menuitem = gtk.GtkMenuItem(val)
|
||||
menuitem.set_data("val",index)
|
||||
menuitem.connect('activate',self.set_lds_seal)
|
||||
menuitem.show()
|
||||
menu.append(menuitem)
|
||||
index = index + 1
|
||||
self.ldssealstat.set_menu(menu)
|
||||
self.ldssealstat.set_history(self.seal_stat)
|
||||
|
||||
def set_lds_bap(self,obj):
|
||||
self.bap_stat = obj.get_data("val")
|
||||
|
||||
def set_lds_endow(self,obj):
|
||||
self.end_stat = obj.get_data("val")
|
||||
|
||||
def set_lds_seal(self,obj):
|
||||
self.seal_stat = obj.get_data("val")
|
||||
|
||||
def ev_drag_data_received(self,widget,context,x,y,selection_data,info,time):
|
||||
if selection_data and selection_data.data:
|
||||
exec 'data = %s' % selection_data.data
|
||||
@ -706,6 +778,8 @@ class EditPerson:
|
||||
d.set(date)
|
||||
if compare_dates(d,ord.getDateObj()) != 0:
|
||||
changed = 1
|
||||
elif ord.getStatus() != self.bap_stat:
|
||||
changed = 1
|
||||
elif ord.getTemple() != temple:
|
||||
changed = 1
|
||||
|
||||
@ -724,6 +798,8 @@ class EditPerson:
|
||||
d.set(date)
|
||||
if compare_dates(d,ord.getDateObj()) != 0:
|
||||
changed = 1
|
||||
elif ord.getStatus() != self.end_stat:
|
||||
changed = 1
|
||||
elif ord.getTemple() != temple:
|
||||
changed = 1
|
||||
|
||||
@ -745,6 +821,8 @@ class EditPerson:
|
||||
changed = 1
|
||||
elif ord.getTemple() != temple:
|
||||
changed = 1
|
||||
elif ord.getStatus() != self.seal_stat:
|
||||
changed = 1
|
||||
elif ord.getFamily() != self.ldsfam:
|
||||
changed = 1
|
||||
|
||||
@ -1070,7 +1148,7 @@ class EditPerson:
|
||||
else:
|
||||
temple = ""
|
||||
ord = self.person.getLdsBaptism()
|
||||
update_ord(self.person.setLdsBaptism,ord,date,temple)
|
||||
update_ord(self.person.setLdsBaptism,ord,date,temple,self.bap_stat)
|
||||
|
||||
date = self.ldsend_date.get_text()
|
||||
temple = self.ldsend_temple.entry.get_text()
|
||||
@ -1079,7 +1157,7 @@ class EditPerson:
|
||||
else:
|
||||
temple = ""
|
||||
ord = self.person.getLdsEndowment()
|
||||
update_ord(self.person.setLdsEndowment,ord,date,temple)
|
||||
update_ord(self.person.setLdsEndowment,ord,date,temple,self.end_stat)
|
||||
|
||||
date = self.ldsseal_date.get_text()
|
||||
temple = self.ldsseal_temple.entry.get_text()
|
||||
@ -1105,6 +1183,9 @@ class EditPerson:
|
||||
if ord.getTemple() != temple:
|
||||
ord.setTemple(temple)
|
||||
utils.modified()
|
||||
if ord.getStatus() != self.seal_stat:
|
||||
ord.setStatus(self.seal_stat)
|
||||
utils.modified()
|
||||
if ord.getFamily() != self.ldsfam:
|
||||
ord.setFamily(self.ldsfam)
|
||||
utils.modified()
|
||||
@ -1122,6 +1203,54 @@ class EditPerson:
|
||||
import NoteEdit
|
||||
NoteEdit.NoteEditor(self.pname)
|
||||
|
||||
def on_ldsbap_source_clicked(self,obj):
|
||||
import Sources
|
||||
ord = self.person.getLdsBaptism()
|
||||
if ord == None:
|
||||
ord = LdsOrd()
|
||||
self.person.setLdsBaptism(ord)
|
||||
Sources.SourceSelector(self.pname.getSourceRefList(),self,src_changed)
|
||||
|
||||
def on_ldsbap_note_clicked(self,obj):
|
||||
import NoteEdit
|
||||
ord = self.person.getLdsBaptism()
|
||||
if ord == None:
|
||||
ord = LdsOrd()
|
||||
self.person.setLdsBaptism(ord)
|
||||
NoteEdit.NoteEditor(ord)
|
||||
|
||||
def on_ldsendow_source_clicked(self,obj):
|
||||
import Sources
|
||||
ord = self.person.getLdsEndowment()
|
||||
if ord == None:
|
||||
ord = LdsOrd()
|
||||
self.person.setLdsEndowment(ord)
|
||||
Sources.SourceSelector(self.pname.getSourceRefList(),self,src_changed)
|
||||
|
||||
def on_ldsendow_note_clicked(self,obj):
|
||||
import NoteEdit
|
||||
ord = self.person.getLdsEndowment()
|
||||
if ord == None:
|
||||
ord = LdsOrd()
|
||||
self.person.setLdsEndowment(ord)
|
||||
NoteEdit.NoteEditor(ord)
|
||||
|
||||
def on_ldsseal_source_clicked(self,obj):
|
||||
import Sources
|
||||
ord = self.person.getLdsSeal()
|
||||
if ord == None:
|
||||
ord = LdsOrd()
|
||||
self.person.setLdsSeal(ord)
|
||||
Sources.SourceSelector(self.pname.getSourceRefList(),self,src_changed)
|
||||
|
||||
def on_ldsseal_note_clicked(self,obj):
|
||||
import NoteEdit
|
||||
ord = self.person.getLdsSeal()
|
||||
if ord == None:
|
||||
ord = LdsOrd()
|
||||
self.person.setLdsSeal(ord)
|
||||
NoteEdit.NoteEditor(ord)
|
||||
|
||||
def load_person_image(self):
|
||||
photo_list = self.person.getPhotoList()
|
||||
if len(photo_list) != 0:
|
||||
@ -1141,9 +1270,29 @@ class EditPerson:
|
||||
elif page == 6 and self.not_loaded:
|
||||
self.not_loaded = 0
|
||||
self.gallery.load_images()
|
||||
elif page == 8 and self.lds_not_loaded:
|
||||
self.lds_not_loaded = 0
|
||||
plist = self.db.getPlaceMap().values()
|
||||
ord = self.person.getLdsBaptism()
|
||||
if ord :
|
||||
place = ord.getPlace()
|
||||
else:
|
||||
place = None
|
||||
utils.attach_places(plist,self.ldsbapplace,place)
|
||||
ord = self.person.getLdsSeal()
|
||||
if ord :
|
||||
place = ord.getPlace()
|
||||
else:
|
||||
place = None
|
||||
utils.attach_places(plist,self.ldssealplace,place)
|
||||
ord = self.person.getLdsEndowment()
|
||||
if ord :
|
||||
place = ord.getPlace()
|
||||
else:
|
||||
place = None
|
||||
utils.attach_places(plist,self.ldsendowplace,place)
|
||||
|
||||
|
||||
def update_ord(func,ord,date,temple):
|
||||
def update_ord(func,ord,date,temple,stat):
|
||||
if not ord:
|
||||
if (date or temple):
|
||||
ord = LdsOrd()
|
||||
@ -1160,6 +1309,9 @@ def update_ord(func,ord,date,temple):
|
||||
elif ord.getTemple() != temple:
|
||||
ord.setTemple(temple)
|
||||
utils.modified()
|
||||
elif ord.getStatus() != stat:
|
||||
ord.setStatus(stat)
|
||||
utils.modified()
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
|
@ -136,6 +136,9 @@ class GrampsParser:
|
||||
def start_temple(self,attrs):
|
||||
self.ord.setTemple(u2l(attrs['val']))
|
||||
|
||||
def start_status(self,attrs):
|
||||
self.ord.setStatus(int(u2l(attrs['val'])))
|
||||
|
||||
def start_sealed_to(self,attrs):
|
||||
id = u2l(attrs['ref'])
|
||||
self.ord.setFamily(self.db.findFamilyNoMap(id))
|
||||
@ -318,6 +321,8 @@ class GrampsParser:
|
||||
self.source_ref.setBase(source)
|
||||
if self.photo:
|
||||
self.photo.addSourceRef(self.source_ref)
|
||||
elif self.ord:
|
||||
self.ord.addSourceRef(self.source_ref)
|
||||
elif self.object:
|
||||
self.object.addSourceRef(self.source_ref)
|
||||
elif self.event:
|
||||
@ -628,6 +633,8 @@ class GrampsParser:
|
||||
|
||||
if self.address:
|
||||
self.address.setNote(note)
|
||||
elif self.ord:
|
||||
self.ord.setNote(note)
|
||||
elif self.attribute:
|
||||
self.attribute.setNote(note)
|
||||
elif self.object:
|
||||
@ -738,6 +745,7 @@ class GrampsParser:
|
||||
"location" : (start_location,None),
|
||||
"lds_ord" : (start_lds_ord, stop_lds_ord),
|
||||
"temple" : (start_temple, None),
|
||||
"status" : (start_status, None),
|
||||
"sealed_to" : (start_sealed_to, None),
|
||||
"coord" : (start_coord,None),
|
||||
"pos" : (start_pos, None),
|
||||
|
@ -87,17 +87,30 @@ class SourceNote:
|
||||
"""Return in note instance, not just the text"""
|
||||
return self.note
|
||||
|
||||
class LdsOrd:
|
||||
class LdsOrd(SourceNote):
|
||||
"""LDS Ordinance support"""
|
||||
def __init__(self,source=None):
|
||||
SourceNote.__init__(self,source)
|
||||
if source:
|
||||
self.famc = source.famc
|
||||
self.date = Date(source.date)
|
||||
self.temple = source.temple
|
||||
self.status = source.status
|
||||
self.place = source.place
|
||||
else:
|
||||
self.famc = None
|
||||
self.date = None
|
||||
self.temple = ""
|
||||
self.status = 0
|
||||
self.place = None
|
||||
|
||||
def setPlace(self,place):
|
||||
"""sets the Place instance of the Event"""
|
||||
self.place = place
|
||||
|
||||
def getPlace(self):
|
||||
"""returns the Place instance of the Event"""
|
||||
return self.place
|
||||
|
||||
def setFamily(self,family):
|
||||
self.famc = family
|
||||
@ -105,6 +118,12 @@ class LdsOrd:
|
||||
def getFamily(self):
|
||||
return self.famc
|
||||
|
||||
def setStatus(self,val):
|
||||
self.status = val
|
||||
|
||||
def getStatus(self):
|
||||
return self.status
|
||||
|
||||
def setDate(self, date) :
|
||||
"""attempts to sets the date of the LdsOrd instance"""
|
||||
if not self.date:
|
||||
|
@ -145,8 +145,14 @@ def dump_ordinance(g,name,ord,index=1):
|
||||
write_date(g,dateobj,index+1)
|
||||
if ord.getTemple():
|
||||
g.write('%s<temple val="%s"/>\n' % (sp2,fix(ord.getTemple())))
|
||||
if ord.getStatus() != 0:
|
||||
g.write('%s<status val="%d"/>\n' % (sp2,ord.getStatus()))
|
||||
if ord.getFamily():
|
||||
g.write('%s<sealed_to ref="%s"/>\n' % (sp2,fix(ord.getFamily().getId())))
|
||||
if ord.getNote() != "":
|
||||
write_note(g,"note",ord.getNote(),index+1)
|
||||
for s in ord.getSourceRefList():
|
||||
dump_source_ref(g,s,index+1)
|
||||
g.write('%s</lds_ord>\n' % sp)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
|
@ -213,7 +213,7 @@ personalConstantEvents = {
|
||||
"Blessing" : "BLES",
|
||||
"Burial" : "BURI",
|
||||
"Cause Of Death" : "CAUS",
|
||||
"Ordination" : "ORID",
|
||||
"Ordination" : "ORDI",
|
||||
"Census" : "CENS",
|
||||
"Christening" : "CHR" ,
|
||||
"Confirmation" : "CONF",
|
||||
@ -697,3 +697,43 @@ lds_temple_to_abrev = {
|
||||
"WASHI": "Washington, D.C.",
|
||||
"WA" : "Washington, D.C.",
|
||||
}
|
||||
|
||||
lds_baptism_status = {
|
||||
"<No Status>" : 0,
|
||||
"Child" : 1,
|
||||
"Cleared" : 2,
|
||||
"Completed" : 3,
|
||||
"Infant" : 4,
|
||||
"Pre-1970" : 5,
|
||||
"Qualified" : 6,
|
||||
"Stillborn" : 7,
|
||||
"Submitted" : 8,
|
||||
"Uncleared" : 9,
|
||||
}
|
||||
|
||||
lds_baptism_index = [
|
||||
"<No Status>",
|
||||
"Child",
|
||||
"Cleared",
|
||||
"Completed",
|
||||
"Infant",
|
||||
"Pre-1970",
|
||||
"Qualified",
|
||||
"Stillborn",
|
||||
"Submitted",
|
||||
"Uncleared",
|
||||
]
|
||||
|
||||
lds_csealing_index = [
|
||||
"<No Status>",
|
||||
"BIC",
|
||||
"Cleared",
|
||||
"Completed",
|
||||
"DNS",
|
||||
"Pre-1970",
|
||||
"Qualified",
|
||||
"Stillborn",
|
||||
"Submitted",
|
||||
"Uncleared",
|
||||
]
|
||||
|
||||
|
@ -69,7 +69,8 @@ for val in const.familyConstantEvents.keys():
|
||||
|
||||
lineRE = re.compile(r"\s*(\d+)\s+(\S+)\s*(.*)$")
|
||||
headRE = re.compile(r"\s*(\d+)\s+HEAD")
|
||||
nameRegexp = re.compile(r"([\S\s]*\S)?\s*/([^/]+)?/\s*,?\s*([\S]+)?")
|
||||
nameRegexp= re.compile(r"/?([^/]*)(/([^/]*)(/([^/]*))?)?")
|
||||
#nameRegexp = re.compile(r"([\S\s]*\S)?\s*/([^/]+)?/\s*,?\s*([\S]+)?")
|
||||
calRegexp = re.compile(r"\s*@#D([^@]+)@\s*(.*)$")
|
||||
fromtoRegexp = re.compile(r"\s*FROM\s+@#D([^@]+)@\s*(.*)\s+TO\s+@#D([^@]+)@\s*(.*)$")
|
||||
|
||||
@ -298,18 +299,18 @@ class GedcomParser:
|
||||
elif matches[1] == "DATA" or matches[1] == "TEXT":
|
||||
self.ignore_sub_junk(2)
|
||||
elif matches[1] == "TITL":
|
||||
title = matches[2] + self.parse_continue_data()
|
||||
title = matches[2] + self.parse_continue_data(level+1)
|
||||
title = string.replace(title,'\n',' ')
|
||||
self.source.setTitle(title)
|
||||
elif matches[1] == "AUTH":
|
||||
self.source.setAuthor(matches[2] + self.parse_continue_data())
|
||||
self.source.setAuthor(matches[2] + self.parse_continue_data(level+1))
|
||||
elif matches[1] == "PUBL":
|
||||
self.source.setPubInfo(matches[2] + self.parse_continue_data())
|
||||
self.source.setPubInfo(matches[2] + self.parse_continue_data(level+1))
|
||||
elif matches[1] == "OBJE":
|
||||
self.ignore_sub_junk(2)
|
||||
elif matches[1] == "NOTE":
|
||||
if matches[2] and matches[2][0] != "@":
|
||||
note = matches[1] + self.parse_continue_data()
|
||||
note = matches[2] + self.parse_continue_data(level+1)
|
||||
self.source.setNote(note)
|
||||
self.ignore_sub_junk(2)
|
||||
else:
|
||||
@ -352,7 +353,7 @@ class GedcomParser:
|
||||
self.parse_source(matches[1],1)
|
||||
elif matches[2] == "REPO":
|
||||
self.ignore_sub_junk(1)
|
||||
elif matches[2][0:4] == "NOTE":
|
||||
elif matches[2] == "NOTE":
|
||||
if self.nmap.has_key(matches[1]):
|
||||
noteobj = self.nmap[matches[1]]
|
||||
else:
|
||||
@ -360,9 +361,9 @@ class GedcomParser:
|
||||
self.nmap[matches[1]] = noteobj
|
||||
text = matches[2][4:]
|
||||
if text == "":
|
||||
noteobj.set(self.parse_continue_data())
|
||||
noteobj.set(self.parse_continue_data(1))
|
||||
else:
|
||||
noteobj.set(text + self.parse_continue_data())
|
||||
noteobj.set(text + self.parse_continue_data(1))
|
||||
self.parse_note_data(1)
|
||||
elif matches[2] == "OBJE":
|
||||
self.ignore_sub_junk(1)
|
||||
@ -386,7 +387,7 @@ class GedcomParser:
|
||||
s = self.db.findSource(ref,self.smap)
|
||||
source_ref.setBase(s)
|
||||
s.setTitle('Imported Source #%d' % self.localref)
|
||||
s.setNote(matches[2] + self.parse_continue_data())
|
||||
s.setNote(matches[2] + self.parse_continue_data(level+1))
|
||||
self.ignore_sub_junk(2)
|
||||
else:
|
||||
source_ref.setBase(self.db.findSource(matches[2],self.smap))
|
||||
@ -458,7 +459,7 @@ class GedcomParser:
|
||||
self.parse_ord(ord,2)
|
||||
elif matches[1] == "ADDR":
|
||||
self.addr = Address()
|
||||
self.addr.setStreet(matches[2] + self.parse_continue_data())
|
||||
self.addr.setStreet(matches[2] + self.parse_continue_data(1))
|
||||
self.parse_address(self.addr,2)
|
||||
elif matches[1] == "CHIL":
|
||||
mrel,frel = self.parse_ftw_relations(2)
|
||||
@ -487,9 +488,13 @@ class GedcomParser:
|
||||
self.barf(2)
|
||||
else:
|
||||
self.parse_family_object(2)
|
||||
elif matches[1] == "_COMM":
|
||||
note = string.strip(matches[2]) + self.parse_continue_data(1)
|
||||
self.family.setNote(note)
|
||||
self.ignore_sub_junk(2)
|
||||
elif matches[1] == "NOTE":
|
||||
if matches[2] and matches[2][0] != "@":
|
||||
note = matches[1] + self.parse_continue_data()
|
||||
note = matches[2] + self.parse_continue_data(1)
|
||||
self.family.setNote(note)
|
||||
self.ignore_sub_junk(2)
|
||||
else:
|
||||
@ -524,13 +529,13 @@ class GedcomParser:
|
||||
try:
|
||||
names = nameRegexp.match(matches[2]).groups()
|
||||
except:
|
||||
names = (matches[2],"","")
|
||||
names = (matches[2],"","","","")
|
||||
if names[0]:
|
||||
name.setFirstName(names[0])
|
||||
if names[1]:
|
||||
name.setSurname(names[1])
|
||||
if names[2]:
|
||||
name.setSuffix(names[2])
|
||||
name.setSurname(names[2])
|
||||
if names[4]:
|
||||
name.setSuffix(names[4])
|
||||
if name_cnt == 0:
|
||||
self.person.setPrimaryName(name)
|
||||
else:
|
||||
@ -539,32 +544,31 @@ class GedcomParser:
|
||||
self.parse_name(name,2)
|
||||
elif matches[1] == "_UID":
|
||||
self.person.setPafUid(matches[2])
|
||||
elif matches[1] == "ALIA":
|
||||
elif matches[1] in ["ALIA","_ALIA"]:
|
||||
aka = Name()
|
||||
match = nameRegexp.match(matches[2])
|
||||
if match:
|
||||
names = match.groups()
|
||||
if names[0]:
|
||||
aka.setFirstName(names[0])
|
||||
if names[1]:
|
||||
aka.setSurname(names[1])
|
||||
if names[2]:
|
||||
aka.setSuffix(names[2])
|
||||
else:
|
||||
aka.setFirstName(matches[2])
|
||||
try:
|
||||
names = nameRegexp.match(matches[2]).groups()
|
||||
except:
|
||||
names = (matches[2],"","","","")
|
||||
if names[0]:
|
||||
aka.setFirstName(names[0])
|
||||
if names[2]:
|
||||
aka.setSurname(names[2])
|
||||
if names[4]:
|
||||
aka.setSuffix(names[4])
|
||||
self.person.addAlternateName(aka)
|
||||
elif matches[1] == "OBJE":
|
||||
if matches[2] and matches[2][0] == '@':
|
||||
self.barf(2)
|
||||
else:
|
||||
self.parse_person_object(2)
|
||||
elif matches[1] == "NOTE":
|
||||
elif matches[1] in ["NOTE","_COMM"]:
|
||||
if not string.strip(matches[2]) or matches[2] and matches[2][0] != "@":
|
||||
note = self.person.getNote()
|
||||
if note == "":
|
||||
note = matches[2] + self.parse_continue_data()
|
||||
note = matches[2] + self.parse_continue_data(1)
|
||||
else:
|
||||
note = "%s\n\n%s%s" % (note,matches[2],self.parse_continue_data())
|
||||
note = "%s\n\n%s%s" % (note,matches[2],self.parse_continue_data(1))
|
||||
self.person.setNote(note)
|
||||
self.ignore_sub_junk(2)
|
||||
else:
|
||||
@ -620,7 +624,7 @@ class GedcomParser:
|
||||
self.parse_residence(addr,2)
|
||||
elif matches[1] == "ADDR":
|
||||
addr = Address()
|
||||
addr.setStreet(matches[2] + self.parse_continue_data())
|
||||
addr.setStreet(matches[2] + self.parse_continue_data(1))
|
||||
self.parse_address(addr,2)
|
||||
self.person.addAddress(addr)
|
||||
elif matches[1] == "BIRT":
|
||||
@ -697,7 +701,7 @@ class GedcomParser:
|
||||
return note
|
||||
elif matches[1] == "NOTE":
|
||||
if not string.strip(matches[2]) or matches[2] and matches[2][0] != "@":
|
||||
note = matches[2] + self.parse_continue_data()
|
||||
note = matches[2] + self.parse_continue_data(level+1)
|
||||
self.parse_note_data(level+1)
|
||||
else:
|
||||
self.ignore_sub_junk(level+1)
|
||||
@ -719,7 +723,7 @@ class GedcomParser:
|
||||
type = matches[1]
|
||||
elif matches[1] == "NOTE":
|
||||
if not string.strip(matches[2]) or matches[2] and matches[2][0] != "@":
|
||||
note = matches[2] + self.parse_continue_data()
|
||||
note = matches[2] + self.parse_continue_data(level+1)
|
||||
self.parse_note_data(level+1)
|
||||
else:
|
||||
self.ignore_sub_junk(level+1)
|
||||
@ -740,7 +744,7 @@ class GedcomParser:
|
||||
elif matches[1] == "FILE":
|
||||
file = matches[2]
|
||||
elif matches[1] == "NOTE":
|
||||
note = matches[2] + self.parse_continue_data()
|
||||
note = matches[2] + self.parse_continue_data(level+1)
|
||||
elif matches[1][0] == "_":
|
||||
self.ignore_sub_junk(level+1)
|
||||
elif int(matches[0]) < level:
|
||||
@ -782,7 +786,7 @@ class GedcomParser:
|
||||
elif matches[1] == "FILE":
|
||||
file = matches[2]
|
||||
elif matches[1] == "NOTE":
|
||||
note = matches[2] + self.parse_continue_data()
|
||||
note = matches[2] + self.parse_continue_data(level+1)
|
||||
elif int(matches[0]) < level:
|
||||
self.backup()
|
||||
break
|
||||
@ -817,7 +821,7 @@ class GedcomParser:
|
||||
elif matches[1] == "FILE":
|
||||
file = matches[2]
|
||||
elif matches[1] == "NOTE":
|
||||
note = matches[2] + self.parse_continue_data()
|
||||
note = matches[2] + self.parse_continue_data(level+1)
|
||||
elif int(matches[0]) < level:
|
||||
self.backup()
|
||||
break
|
||||
@ -848,7 +852,7 @@ class GedcomParser:
|
||||
elif matches[1] == "DATE":
|
||||
address.setDateObj(self.extract_date(matches[2]))
|
||||
elif matches[1] == "ADDR":
|
||||
address.setStreet(matches[2] + self.parse_continue_data())
|
||||
address.setStreet(matches[2] + self.parse_continue_data(level+1))
|
||||
self.parse_address(address,level+1)
|
||||
elif matches[1] in ["AGE","AGNC","CAUS","STAT","TEMP","OBJE","TYPE"]:
|
||||
self.ignore_sub_junk(level+1)
|
||||
@ -864,7 +868,7 @@ class GedcomParser:
|
||||
pass
|
||||
elif matches[1] == "NOTE":
|
||||
if not string.strip(matches[2]) or matches[2] and matches[2][0] != "@":
|
||||
note = matches[1] + self.parse_continue_data()
|
||||
note = matches[2] + self.parse_continue_data(level+1)
|
||||
address.setNote(note)
|
||||
self.ignore_sub_junk(2)
|
||||
else:
|
||||
@ -886,7 +890,7 @@ class GedcomParser:
|
||||
return
|
||||
elif matches[1] in [ "ADDR", "ADR1", "ADR2" ]:
|
||||
val = address.getStreet()
|
||||
data = self.parse_continue_data()
|
||||
data = self.parse_continue_data(level+1)
|
||||
if first == 0:
|
||||
val = "%s %s" % (matches[2],data)
|
||||
first = 1
|
||||
@ -953,7 +957,7 @@ class GedcomParser:
|
||||
s = self.db.findSource(ref,self.smap)
|
||||
source_ref.setBase(s)
|
||||
s.setTitle('Imported Source #%d' % self.localref)
|
||||
s.setNote(matches[2] + self.parse_continue_data())
|
||||
s.setNote(matches[2] + self.parse_continue_data(level+1))
|
||||
self.ignore_sub_junk(2)
|
||||
else:
|
||||
source_ref.setBase(self.db.findSource(matches[2],self.smap))
|
||||
@ -976,11 +980,11 @@ class GedcomParser:
|
||||
event.setPlace(place)
|
||||
self.ignore_sub_junk(level+1)
|
||||
elif matches[1] == "CAUS":
|
||||
info = matches[2] + self.parse_continue_data()
|
||||
info = matches[2] + self.parse_continue_data(level+1)
|
||||
event.setCause(info)
|
||||
self.parse_cause(event,level+1)
|
||||
elif matches[1] == "NOTE":
|
||||
info = matches[2] + self.parse_continue_data()
|
||||
info = matches[2] + self.parse_continue_data(level+1)
|
||||
if note == "":
|
||||
note = info
|
||||
else:
|
||||
@ -993,6 +997,8 @@ class GedcomParser:
|
||||
event.setDescription("%s%s" % (d, matches[2]))
|
||||
elif matches[1] == "CONT":
|
||||
event.setDescription("%s\n%s" % (event.getDescription(),matches[2]))
|
||||
elif matches[1] == "RELI":
|
||||
self.ignore_sub_junk(level+1)
|
||||
else:
|
||||
self.barf(level+1)
|
||||
|
||||
@ -1017,7 +1023,7 @@ class GedcomParser:
|
||||
s = self.db.findSource(ref,self.smap)
|
||||
source_ref.setBase(s)
|
||||
s.setTitle('Imported Source #%d' % self.localref)
|
||||
s.setNote(matches[2] + self.parse_continue_data())
|
||||
s.setNote(matches[2] + self.parse_continue_data(1))
|
||||
self.ignore_sub_junk(2)
|
||||
else:
|
||||
source_ref.setBase(self.db.findSource(matches[2],self.smap))
|
||||
@ -1049,11 +1055,11 @@ class GedcomParser:
|
||||
# eventually do something intelligent here
|
||||
pass
|
||||
elif matches[1] == "CAUS":
|
||||
info = matches[2] + self.parse_continue_data()
|
||||
info = matches[2] + self.parse_continue_data(level+1)
|
||||
event.setCause(info)
|
||||
self.parse_cause(event,level+1)
|
||||
elif matches[1] == "NOTE":
|
||||
info = matches[2] + self.parse_continue_data()
|
||||
info = matches[2] + self.parse_continue_data(level+1)
|
||||
if note == "":
|
||||
note = info
|
||||
else:
|
||||
@ -1114,7 +1120,7 @@ class GedcomParser:
|
||||
s = self.db.findSource(ref,self.smap)
|
||||
source_ref.setBase(s)
|
||||
s.setTitle('Imported Source #%d' % self.localref)
|
||||
s.setNote(matches[2] + self.parse_continue_data())
|
||||
s.setNote(matches[2] + self.parse_continue_data(level+1))
|
||||
self.ignore_sub_junk(2)
|
||||
else:
|
||||
source_ref.setBase(self.db.findSource(matches[2],self.smap))
|
||||
@ -1128,7 +1134,7 @@ class GedcomParser:
|
||||
elif matches[1] == "DATE":
|
||||
note = "%s\n\n" % ("Date : %s" % matches[2])
|
||||
elif matches[1] == "NOTE":
|
||||
info = matches[2] + self.parse_continue_data()
|
||||
info = matches[2] + self.parse_continue_data(level+1)
|
||||
if note == "":
|
||||
note = info
|
||||
else:
|
||||
@ -1160,10 +1166,10 @@ class GedcomParser:
|
||||
elif matches[1] == "DATE":
|
||||
event.setDateObj(self.extract_date(matches[2]))
|
||||
elif matches[1] == "CAUS":
|
||||
info = matches[2] + self.parse_continue_data()
|
||||
info = matches[2] + self.parse_continue_data(level+1)
|
||||
event.setCause(info)
|
||||
self.parse_cause(event,level+1)
|
||||
elif matches[1] in ["TIME","AGE","AGNC","ADDR","STAT","TEMP","HUSB","WIFE","OBJE"]:
|
||||
elif matches[1] in ["TIME","AGE","AGNC","ADDR","STAT","TEMP","HUSB","WIFE","OBJE","_CHUR"]:
|
||||
self.ignore_sub_junk(level+1)
|
||||
elif matches[1] == "SOUR":
|
||||
source_ref = SourceRef()
|
||||
@ -1172,7 +1178,7 @@ class GedcomParser:
|
||||
ref = "gsr%d" % self.localref
|
||||
s = self.db.findSource(ref,self.smap)
|
||||
source_ref.setBase(s)
|
||||
note = matches[2] + self.parse_continue_data()
|
||||
note = matches[2] + self.parse_continue_data(level+1)
|
||||
s.setTitle('Imported Source #%d' % self.localref)
|
||||
s.setNote(note)
|
||||
self.ignore_sub_junk(2)
|
||||
@ -1193,7 +1199,7 @@ class GedcomParser:
|
||||
self.ignore_sub_junk(level+1)
|
||||
elif matches[1] == "NOTE":
|
||||
if not string.strip(matches[2]) or matches[2] and matches[2][0] != "@":
|
||||
note = matches[1] + self.parse_continue_data()
|
||||
note = matches[2] + self.parse_continue_data(level+1)
|
||||
event.setNote(note)
|
||||
self.ignore_sub_junk(2)
|
||||
else:
|
||||
@ -1215,14 +1221,14 @@ class GedcomParser:
|
||||
self.backup()
|
||||
return
|
||||
elif matches[1] == "PAGE":
|
||||
source.setPage(matches[2] + self.parse_continue_data())
|
||||
source.setPage(matches[2] + self.parse_continue_data(level+1))
|
||||
elif matches[1] == "DATA":
|
||||
date,text = self.parse_source_data(level+1)
|
||||
d = Date.Date()
|
||||
d.set(date)
|
||||
source.setDate(d)
|
||||
source.setText(text)
|
||||
elif matches[1] == "OBJE":
|
||||
elif matches[1] in ["OBJE","REFN","TEXT"]:
|
||||
self.ignore_sub_junk(level+1)
|
||||
elif matches[1] == "QUAY":
|
||||
val = int(matches[2])
|
||||
@ -1232,7 +1238,7 @@ class GedcomParser:
|
||||
source.setConfidence(val)
|
||||
elif matches[1] == "NOTE":
|
||||
if not string.strip(matches[2]) or matches[2] and matches[2][0] != "@":
|
||||
note = matches[1] + self.parse_continue_data()
|
||||
note = matches[2] + self.parse_continue_data(level+1)
|
||||
source.setComments(note)
|
||||
self.ignore_sub_junk(2)
|
||||
else:
|
||||
@ -1259,7 +1265,7 @@ class GedcomParser:
|
||||
date = matches[2]
|
||||
|
||||
elif matches[1] == "TEXT":
|
||||
note = matches[2] + self.parse_continue_data()
|
||||
note = matches[2] + self.parse_continue_data(level+1)
|
||||
else:
|
||||
self.barf(level+1)
|
||||
|
||||
@ -1271,15 +1277,18 @@ class GedcomParser:
|
||||
if int(matches[0]) < level:
|
||||
self.backup()
|
||||
return
|
||||
elif matches[1] == "ALIA":
|
||||
elif matches[1] in ["ALIA","_ALIA"]:
|
||||
aka = Name()
|
||||
names = nameRegexp.match(matches[2]).groups()
|
||||
try:
|
||||
names = nameRegexp.match(matches[2]).groups()
|
||||
except:
|
||||
names = (matches[2],"","","","")
|
||||
if names[0]:
|
||||
aka.setFirstName(names[0])
|
||||
if names[1]:
|
||||
aka.setSurname(names[1])
|
||||
if names[2]:
|
||||
aka.setSuffix(names[2])
|
||||
aka.setSurname(names[2])
|
||||
if names[4]:
|
||||
aka.setSuffix(names[4])
|
||||
self.person.addAlternateName(aka)
|
||||
elif matches[1] == "NPFX":
|
||||
name.setTitle(matches[2])
|
||||
@ -1313,7 +1322,7 @@ class GedcomParser:
|
||||
self.parse_source_reference(source_ref,level+1)
|
||||
elif matches[1][0:4] == "NOTE":
|
||||
if matches[2] and matches[2][0] != "@":
|
||||
note = matches[2] + self.parse_continue_data()
|
||||
note = matches[2] + self.parse_continue_data(level+1)
|
||||
name.setNote(note)
|
||||
self.ignore_sub_junk(2)
|
||||
else:
|
||||
@ -1380,7 +1389,7 @@ class GedcomParser:
|
||||
date = self.parse_date(2)
|
||||
date.date = matches[2]
|
||||
elif matches[1] == "NOTE":
|
||||
note = matches[2] + self.parse_continue_data()
|
||||
note = matches[2] + self.parse_continue_data(2)
|
||||
elif matches[1][0] == "_":
|
||||
self.ignore_sub_junk(2)
|
||||
else:
|
||||
@ -1460,12 +1469,15 @@ class GedcomParser:
|
||||
elif matches[1] != "FORM":
|
||||
self.barf(level+1)
|
||||
|
||||
def parse_continue_data(self):
|
||||
def parse_continue_data(self,level):
|
||||
data = ""
|
||||
while 1:
|
||||
matches = self.get_next()
|
||||
|
||||
if matches[1] == "CONC":
|
||||
if int(matches[0]) < level:
|
||||
self.backup()
|
||||
return data
|
||||
elif matches[1] == "CONC":
|
||||
if self.broken_conc:
|
||||
data = "%s %s" % (data,matches[2])
|
||||
else:
|
||||
|
@ -222,6 +222,9 @@ def runTool(database,person,callback):
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class RelCalc:
|
||||
"""
|
||||
Relationship calculator class.
|
||||
"""
|
||||
|
||||
def __init__(self,database,person):
|
||||
self.person = person
|
||||
|
Loading…
Reference in New Issue
Block a user