From 523de016144c6f143d70cf74c2b0f6395f972cb8 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Wed, 16 Aug 2006 02:31:29 +0000 Subject: [PATCH] * src/GrampsDb/_WriteGedcom.py: support for AGE, CAUSE, and AGENCY svn: r7185 --- ChangeLog | 1 + src/GrampsDb/_WriteGedcom.py | 28 +++++++++++++++++++++------- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/ChangeLog b/ChangeLog index 0968ef0e7..7f7da21a1 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,4 +1,5 @@ 2006-08-15 Don Allingham + * src/GrampsDb/_WriteGedcom.py: support for AGE, CAUSE, and AGENCY * src/GrampsDb/_ReadGedcom.py: support for AGE, CAUSE, and AGENCY * src/GrampsDb/_GedTokens.py: support for AGE and AGENCY diff --git a/src/GrampsDb/_WriteGedcom.py b/src/GrampsDb/_WriteGedcom.py index ccfa2821d..6a140b74b 100644 --- a/src/GrampsDb/_WriteGedcom.py +++ b/src/GrampsDb/_WriteGedcom.py @@ -673,7 +673,7 @@ class GedcomWriter(UpdateCallback): if the_type: self.writeln("2 TYPE %s" % self.cnvtxt(the_type)) - self.dump_event_stats(event) + self.dump_event_stats(event, event_ref) for attr in family.get_attribute_list(): if self.private and attr.get_privacy(): @@ -898,7 +898,7 @@ class GedcomWriter(UpdateCallback): self.writeln("1 BIRT Y") if birth.get_description().strip() != "": self.writeln("2 TYPE %s" % birth.get_description()) - self.dump_event_stats(birth) + self.dump_event_stats(birth, birth_ref) death_ref = person.get_death_ref() if death_ref: @@ -911,7 +911,7 @@ class GedcomWriter(UpdateCallback): self.writeln("1 DEAT Y") if death.get_description().strip() != "": self.writeln("2 TYPE %s" % death.get_description()) - self.dump_event_stats(death) + self.dump_event_stats(death, death_ref) ad = 0 @@ -988,7 +988,7 @@ class GedcomWriter(UpdateCallback): if val.strip(): self.writeln("2 TYPE %s" % self.cnvtxt(val)) - self.dump_event_stats(event) + self.dump_event_stats(event, event_ref) if (self.adopt == GedcomInfo.ADOPT_EVENT) and (ad == 0) \ and (len(person.get_parent_family_handle_list()) != 0): @@ -1209,15 +1209,29 @@ class GedcomWriter(UpdateCallback): prefix = "%d CONT" % (level+1) ll = len(line) - def dump_event_stats(self,event): + def dump_event_stats(self,event, event_ref): dateobj = event.get_date_object() self.print_date("2 DATE",dateobj) place = None if event.get_place_handle(): place = self.db.get_place_from_handle(event.get_place_handle()) self.write_place(place,2) - if event.get_cause(): - self.writeln("2 CAUS %s" % self.cnvtxt(event.get_cause())) + for attr in event.get_attribute_list(): + t = attr.get_type() + if t == RelLib.AttributeType.CAUSE: + self.writeln("2 CAUS %s" % self.cnvtxt(attr.get_value())) + elif t == RelLib.AttributeType.AGENCY: + self.writeln("2 AGNC %s" % self.cnvtxt(attr.get_value())) + for attr in event_ref.get_attribute_list(): + t = attr.get_type() + if t == RelLib.AttributeType.AGE: + self.writeln("2 AGE %s" % self.cnvtxt(attr.get_value())) + elif t == RelLib.AttributeType.FATHER_AGE: + self.writeln("2 HUSB") + self.writeln("3 AGE %s" % self.cnvtxt(attr.get_value())) + elif t == RelLib.AttributeType.MOTHER_AGE: + self.writeln("2 WIFE") + self.writeln("3 AGE %s" % self.cnvtxt(attr.get_value())) if event.get_note(): self.write_long_text("NOTE",2,self.cnvtxt(event.get_note())) for srcref in event.get_source_references():