From 48f497e500b00a9d919b99b47d6cc650ecc92331 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Sun, 16 Apr 2006 04:37:02 +0000 Subject: [PATCH] event description on xml import svn: r6349 --- gramps2/ChangeLog | 4 ++++ gramps2/src/GrampsDb/_ReadXML.py | 18 ++++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 006670bba..097076e56 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,7 @@ +2006-04-15 Don Allingham + * src/GrampsDb/_ReadXML.py: provide an event description if one does + not exist. + 2006-04-15 Alex Roitman * src/GrampsDb/_GrampsBSDDB.py (gramps_upgrade_9): Adapt to ChildRefType. diff --git a/gramps2/src/GrampsDb/_ReadXML.py b/gramps2/src/GrampsDb/_ReadXML.py index 48ef5b1a9..7cb3d7e9c 100644 --- a/gramps2/src/GrampsDb/_ReadXML.py +++ b/gramps2/src/GrampsDb/_ReadXML.py @@ -86,6 +86,9 @@ crel_map = { "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. @@ -1374,6 +1377,21 @@ class GrampsParser: self.person.death_ref = ref else: 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.event = None