From cf7a0649c1d4c2448496b2f05bff48eb2e59c1ef Mon Sep 17 00:00:00 2001 From: Tim Waugh Date: Mon, 23 Aug 2004 11:26:24 +0000 Subject: [PATCH] 2004-08-23 Tim Waugh * src/WriteGedcom.py (GedcomWriter.write_sources): Write sources in ID order for easier change tracking. svn: r3483 --- gramps2/ChangeLog | 3 +++ gramps2/src/WriteGedcom.py | 7 ++++++- 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 7bf4bde8d..cebd07fea 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,4 +1,7 @@ 2004-08-23 Tim Waugh + * src/WriteGedcom.py (GedcomWriter.write_sources): Write sources + in ID order for easier change tracking. + * src/WriteXML.py (XmlWriter.write_xml_data): Use GRAMPS ID not DB handle. (XmlWriter.dump_source_ref): Likewise. diff --git a/gramps2/src/WriteGedcom.py b/gramps2/src/WriteGedcom.py index 035d44819..29534a713 100644 --- a/gramps2/src/WriteGedcom.py +++ b/gramps2/src/WriteGedcom.py @@ -825,9 +825,14 @@ class GedcomWriter: def write_sources(self): nump = float(len(self.slist)) index = 0.0 + sorted = [] for key in self.slist.keys(): source = self.db.get_source_from_handle(key) - self.writeln("0 @%s@ SOUR" % self.sid(source.get_gramps_id())) + tuple = (self.sid (source.get_gramps_id ()), source) + sorted.append (tuple) + sorted.sort () + for (source_id, source) in sorted: + self.writeln("0 @%s@ SOUR" % source_id) if source.get_title(): self.writeln("1 TITL %s" % fmtline(self.cnvtxt(source.get_title()),248,1,self.nl)) if source.get_author():