From 880c3e775175e3dcf7f79d4a7aa8e6914b753211 Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Fri, 17 Jun 2005 16:58:26 +0000 Subject: [PATCH] * src/WriteGedcom.py (write_sources): Pass handle to the id creator; (write_person): write person sources; (sid): return gramps_id; (write_families): write family sources. svn: r4837 --- gramps2/ChangeLog | 5 +++++ gramps2/src/WriteGedcom.py | 24 ++++++++++++------------ 2 files changed, 17 insertions(+), 12 deletions(-) diff --git a/gramps2/ChangeLog b/gramps2/ChangeLog index 49f13d663..aadbb3bbc 100644 --- a/gramps2/ChangeLog +++ b/gramps2/ChangeLog @@ -1,3 +1,8 @@ +2005-06-17 Alex Roitman + * src/WriteGedcom.py (write_sources): Pass handle to the id + creator; (write_person): write person sources; (sid): return + gramps_id; (write_families): write family sources. + 2005-06-16 Martin Hawlisch * src/gramps_main.py (on_merge_activate,on_fast_merge_activate): only merge if exactly two persons have been selected diff --git a/gramps2/src/WriteGedcom.py b/gramps2/src/WriteGedcom.py index 4133b3e4e..06cabb948 100644 --- a/gramps2/src/WriteGedcom.py +++ b/gramps2/src/WriteGedcom.py @@ -737,16 +737,18 @@ class GedcomWriter: self.writeln('2 _STAT %s' % f[2]) break + for srcref in family.get_source_references(): + self.write_source_ref(1,srcref) self.write_change(1,family.get_change_time()) def write_sources(self): index = 0.0 sorted = [] - for key in self.slist.keys(): - source = self.db.get_source_from_handle(key) + for handle in self.slist.keys(): + source = self.db.get_source_from_handle(handle) if not source: continue - data = (self.sid (source.get_gramps_id ()), source) + data = (self.sid(handle), source) sorted.append (data) sorted.sort () for (source_id, source) in sorted: @@ -978,11 +980,14 @@ class GedcomWriter: if self.adopt == GedcomInfo.ADOPT_PEDI: if family[1] == RelLib.Person.CHILD_REL_ADOPT: self.writeln("2 PEDI Adopted") - + for family_handle in person.get_family_handle_list(): if family_handle != None and self.flist.has_key(family_handle): self.writeln("1 FAMS @%s@" % self.fid(family_handle)) + for srcref in person.get_source_references(): + self.write_source_ref(1,srcref) + if not restricted: if self.obje: for url in person.get_url_list(): @@ -1223,14 +1228,9 @@ class GedcomWriter: if match: self.writeln('1 REFN %d' % int(match.groups()[0])) - def sid(self,id): - if self.sidmap.has_key(id): - return self.sidmap[id] - else: - val = "S%05d" % self.sidval - self.sidval = self.sidval + 1 - self.sidmap[id] = val - return val + def sid(self,handle): + source = self.db.get_source_from_handle(handle) + return source.get_gramps_id() #------------------------------------------------------------------------- #