event description on xml import

svn: r6349
This commit is contained in:
Don Allingham 2006-04-16 04:37:02 +00:00
parent a2f8c9e040
commit 48f497e500
2 changed files with 22 additions and 0 deletions

View File

@ -1,3 +1,7 @@
2006-04-15 Don Allingham <don@gramps-project.org>
* src/GrampsDb/_ReadXML.py: provide an event description if one does
not exist.
2006-04-15 Alex Roitman <shura@gramps-project.org> 2006-04-15 Alex Roitman <shura@gramps-project.org>
* src/GrampsDb/_GrampsBSDDB.py (gramps_upgrade_9): Adapt to * src/GrampsDb/_GrampsBSDDB.py (gramps_upgrade_9): Adapt to
ChildRefType. ChildRefType.

View File

@ -86,6 +86,9 @@ crel_map = {
"Unknown" : RelLib.ChildRefType(RelLib.ChildRefType.UNKNOWN), "Unknown" : RelLib.ChildRefType(RelLib.ChildRefType.UNKNOWN),
} }
_event_family_str = _("%(event_name)s of %(family)s")
_event_person_str = _("%(event_name)s of %(person)s")
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
# Importing data into the currently open database. # Importing data into the currently open database.
@ -1374,6 +1377,21 @@ class GrampsParser:
self.person.death_ref = ref self.person.death_ref = ref
else: else:
self.person.add_event_ref(ref) self.person.add_event_ref(ref)
if self.event.get_description() == "" and \
self.event.get_type()[0] != RelLib.Event.CUSTOM:
if self.family:
text = _event_family_str % {
'event_name' : Utils.family_events[self.event.get_type()[0]],
'family' : Utils.family_name(self.family,self.db),
}
else:
text = _event_person_str % {
'event_name' : Utils.personal_events[self.event.get_type()[0]],
'person' : NameDisplay.displayer.display(self.person),
}
self.event.set_description(text)
self.db.commit_event(self.event,self.trans,self.change) self.db.commit_event(self.event,self.trans,self.change)
self.event = None self.event = None