svn: r6870

This commit is contained in:
Don Allingham 2006-06-07 04:43:18 +00:00
parent 7461974e33
commit 6cf54161b2
3 changed files with 59 additions and 43 deletions

View File

@ -321,8 +321,11 @@ class DisplayState(GrampsDb.GrampsDBCallback):
self.status.push(self.status_id,"")
else:
person = self.dbstate.get_active_person()
pname = NameDisplay.displayer.display(person)
name = "[%s] %s" % (person.get_gramps_id(),pname)
if not person:
pname = NameDisplay.displayer.display(person)
name = "[%s] %s" % (person.get_gramps_id(),pname)
else:
name = _("No active person")
if Config.get(Config.STATUSBAR) > 1:
if person.handle != self.dbstate.db.get_default_handle():
msg = self.display_relationship()

View File

@ -862,7 +862,7 @@ class GedcomParser(UpdateCallback):
elif matches[1] == TOKEN_PUBL:
self.source.set_publication_info(matches[2])
elif matches[1] == TOKEN_NOTE:
note = self.parse_note(matches,self.source,level+1,note)
note = self.parse_note(matches,self.source,level+1,'')
self.source.set_note(note)
elif matches[1] == TOKEN_TEXT:
note = self.source.get_note()
@ -1239,7 +1239,6 @@ class GedcomParser(UpdateCallback):
note = ""
while True:
matches = self.get_next()
# print matches, level
if self.level_is_finished(matches, level):
break
elif matches[1] == TOKEN_FORM:
@ -1283,7 +1282,17 @@ class GedcomParser(UpdateCallback):
self.parse_event(event, self.generic_event_map, 2)
if int(event.get_type()) == RelLib.EventType.MARRIAGE:
self.family.type.set(RelLib.FamilyRelType.MARRIED)
descr = event.get_description()
if descr == "Civil Union":
self.family.type.set(RelLib.FamilyRelType.CIVIL_UNION)
event.set_description('')
elif descr == "Unmarried":
self.family.type.set(RelLib.FamilyRelType.UNMARRIED)
event.set_description('')
else:
self.family.type.set(RelLib.FamilyRelType.MARRIED)
if int(event.get_type()) != RelLib.EventType.CUSTOM:
if not event.get_description():
text = _event_family_str % {
@ -1472,7 +1481,7 @@ class GedcomParser(UpdateCallback):
elif matches[1] == TOKEN_PHON:
address.set_phone(matches[2])
elif matches[1] == TOKEN_NOTE:
note = self.parse_note(matches,address,level+1,note)
note = self.parse_note(matches,address,level+1,'')
elif matches[1] in (TOKEN__LOC, TOKEN__NAME):
pass # ignore unsupported extended location syntax
else:
@ -1507,7 +1516,7 @@ class GedcomParser(UpdateCallback):
lds_ord.add_source_reference(
self.handle_source(matches,level+1))
elif matches[1] == TOKEN_NOTE:
note = self.parse_note(matches,lds_ord,level+1,note)
note = self.parse_note(matches,lds_ord,level+1,'')
elif matches[1] == TOKEN_STAT:
lds_ord.set_status(
lds_status.get(matches[2],RelLib.LdsOrd.STATUS_NONE))
@ -1557,7 +1566,7 @@ class GedcomParser(UpdateCallback):
print "NOT FIXED YET"
def func_event_note(self, matches, event, level):
self.parse_note(matches,event,level+1,note)
self.parse_note(matches,event,level+1,'')
def func_event_date(self, matches, event, level):
event.set_date_object(self.extract_date(matches[2]))
@ -1650,7 +1659,7 @@ class GedcomParser(UpdateCallback):
self.ignore_sub_junk(level)
def func_person_attr_note(self, attr, matches, level):
info = self.parse_note(matches,attr,level+1,note)
info = self.parse_note(matches,attr,level+1,'')
attr.set_note(info)
def parse_source_reference(self,source,level):
@ -1685,7 +1694,7 @@ class GedcomParser(UpdateCallback):
else:
source.set_confidence_level(val)
elif matches[1] in (TOKEN_NOTE,TOKEN_TEXT):
note = self.parse_comment(matches,source,level+1,note)
note = self.parse_comment(matches,source,level+1,'')
else:
self.not_recognized(level+1)
@ -1776,7 +1785,7 @@ class GedcomParser(UpdateCallback):
date.date = matches[2]
self.def_src.set_data_item('Creation date',matches[2])
elif matches[1] == TOKEN_NOTE:
note = self.parse_note(matches,self.def_src,2,note)
note = self.parse_note(matches,self.def_src,2,'')
elif matches[1] == TOKEN_UNKNOWN:
self.ignore_sub_junk(2)
else:
@ -2273,7 +2282,7 @@ class GedcomParser(UpdateCallback):
addr.set_street("Unknown")
addr.set_phone(matches[2])
elif matches[1] == TOKEN_NOTE:
note = self.parse_note(matches, addr, state.level+1, note)
note = self.parse_note(matches, addr, state.level+1, '')
elif matches[1] in (TOKEN_IGNORE, TOKEN_CAUS, TOKEN_STAT,
TOKEN_TEMP, TOKEN_OBJE, TOKEN_TYPE):
self.ignore_sub_junk(state.level+1)
@ -2364,7 +2373,7 @@ class GedcomParser(UpdateCallback):
def func_person_even(self,matches,state):
"""
n DEAT [Y|<NULL>] {1:1}
n <<EVENT_TYPE>> {1:1}
+1 <<EVENT_DETAIL>> {0:1} p.*
"""
event = RelLib.Event()
@ -2373,6 +2382,7 @@ class GedcomParser(UpdateCallback):
event.set_description(matches[2])
self.parse_event(event, self.generic_event_map, 2)
the_type = event.get_type()
if int(the_type) == RelLib.EventType.CUSTOM \
and str(the_type) in self.attrs:
attr = RelLib.Attribute()

View File

@ -638,9 +638,12 @@ class GedcomWriter(UpdateCallback):
event = self.db.get_event_from_handle(event_handle)
if not event or self.private and event.get_privacy():
continue
val = event.get_type().xml_str()
if val == "":
val = self.target_ged.gramps2tag(name)
etype = int(event.get_type())
val = GedcomInfo.familyConstantEvents.get(etype)
if val == None:
val = self.target_ged.gramps2tag(etype)
if val:
if (not event.get_date_object().is_empty()) \
@ -648,37 +651,36 @@ class GedcomWriter(UpdateCallback):
self.writeln("1 %s" % self.cnvtxt(val))
else:
self.writeln("1 %s Y" % self.cnvtxt(val))
if event.get_description() != "":
if event.get_type() == RelLib.EventType.MARRIAGE:
ftype = family.get_relationship()
if ftype != RelLib.FamilyRelType.MARRIED:
self.writeln("2 TYPE %s" % str(ftype))
elif event.get_description() != "":
self.writeln("2 TYPE %s" % event.get_description())
else:
self.writeln("1 EVEN")
self.writeln("2 TYPE %s" % ' '.join(
[self.cnvtxt(val),
self.cnvtxt(event.get_description())]))
self.writeln("2 TYPE %s" % self.cnvtxt(str(etype)))
self.dump_event_stats(event)
for attr in family.get_attribute_list():
if self.private and attr.get_privacy():
continue
name = attr.get_type().xml_str()
t = int(attr.get_type())
name = GedcomInfo.familyConstantAttributes.get(t)
value = self.cnvtxt(attr.get_value()).replace('\r',' ')
if name in ["AFN", "RFN", "_UID"]:
if name:
self.writeln("1 %s %s" % (name,value))
continue
if attr.get_type().is_custom():
else:
self.writeln("1 EVEN")
if value:
self.writeln("2 TYPE %s %s" %(self.cnvtxt(name),value))
else:
self.writeln("2 TYPE %s" % self.cnvtxt(name))
else:
if value:
self.writeln("1 %s %s" % (name, value))
else:
self.writeln("1 %s" % name)
if attr.get_note():
self.write_long_text("NOTE",2,self.cnvtxt(attr.get_note()))
@ -913,9 +915,11 @@ class GedcomWriter(UpdateCallback):
if self.private and event.get_privacy():
continue
val = event.get_type().xml_str()
if val == "":
val = self.target_ged.gramps2tag(int(event.get_type()))
etype = int(event.get_type())
val = GedcomInfo.personalConstantEvents.get(etype)
if val == None:
val = self.target_ged.gramps2tag(etype)
if self.adopt == GedcomInfo.ADOPT_EVENT and val == "ADOP":
ad = 1
@ -1001,24 +1005,23 @@ class GedcomWriter(UpdateCallback):
for attr in person.get_attribute_list():
if self.private and attr.get_privacy():
continue
name = attr.get_type().xml_str()
t = int(attr.get_type())
name = GedcomInfo.personalConstantAttributes.get(t)
value = self.cnvtxt(attr.get_value()).replace('\r',' ')
if name in ["AFN", "RFN", "_UID"]:
# if name in ["AFN", "RFN", "_UID"]:
# self.writeln("1 %s %s" % (name,value))
# continue
if name:
self.writeln("1 %s %s" % (name,value))
continue
if attr.get_type().is_custom():
else:
self.writeln("1 EVEN")
if value:
self.writeln("2 TYPE %s %s" %(self.cnvtxt(name),value))
else:
self.writeln("2 TYPE %s" % self.cnvtxt(name))
else:
if value:
self.writeln("1 %s %s" % (name,value))
else:
self.writeln("1 %s" % name)
if attr.get_note():
self.write_long_text("NOTE",2,self.cnvtxt(attr.get_note()))