* 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
This commit is contained in:
Alex Roitman 2005-06-17 16:58:26 +00:00
parent 3b925c2653
commit 880c3e7751
2 changed files with 17 additions and 12 deletions

View File

@ -1,3 +1,8 @@
2005-06-17 Alex Roitman <shura@gramps-project.org>
* 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 <Martin.Hawlisch@gmx.de> 2005-06-16 Martin Hawlisch <Martin.Hawlisch@gmx.de>
* src/gramps_main.py (on_merge_activate,on_fast_merge_activate): * src/gramps_main.py (on_merge_activate,on_fast_merge_activate):
only merge if exactly two persons have been selected only merge if exactly two persons have been selected

View File

@ -737,16 +737,18 @@ class GedcomWriter:
self.writeln('2 _STAT %s' % f[2]) self.writeln('2 _STAT %s' % f[2])
break break
for srcref in family.get_source_references():
self.write_source_ref(1,srcref)
self.write_change(1,family.get_change_time()) self.write_change(1,family.get_change_time())
def write_sources(self): def write_sources(self):
index = 0.0 index = 0.0
sorted = [] sorted = []
for key in self.slist.keys(): for handle in self.slist.keys():
source = self.db.get_source_from_handle(key) source = self.db.get_source_from_handle(handle)
if not source: if not source:
continue continue
data = (self.sid (source.get_gramps_id ()), source) data = (self.sid(handle), source)
sorted.append (data) sorted.append (data)
sorted.sort () sorted.sort ()
for (source_id, source) in sorted: for (source_id, source) in sorted:
@ -978,11 +980,14 @@ class GedcomWriter:
if self.adopt == GedcomInfo.ADOPT_PEDI: if self.adopt == GedcomInfo.ADOPT_PEDI:
if family[1] == RelLib.Person.CHILD_REL_ADOPT: if family[1] == RelLib.Person.CHILD_REL_ADOPT:
self.writeln("2 PEDI Adopted") self.writeln("2 PEDI Adopted")
for family_handle in person.get_family_handle_list(): for family_handle in person.get_family_handle_list():
if family_handle != None and self.flist.has_key(family_handle): if family_handle != None and self.flist.has_key(family_handle):
self.writeln("1 FAMS @%s@" % self.fid(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 not restricted:
if self.obje: if self.obje:
for url in person.get_url_list(): for url in person.get_url_list():
@ -1223,14 +1228,9 @@ class GedcomWriter:
if match: if match:
self.writeln('1 REFN %d' % int(match.groups()[0])) self.writeln('1 REFN %d' % int(match.groups()[0]))
def sid(self,id): def sid(self,handle):
if self.sidmap.has_key(id): source = self.db.get_source_from_handle(handle)
return self.sidmap[id] return source.get_gramps_id()
else:
val = "S%05d" % self.sidval
self.sidval = self.sidval + 1
self.sidmap[id] = val
return val
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #