2007-02-17 Anthon Pang <apang@softwaredevelopment.ca>

* src/GrampsDb/_WriteGedcom.py: Fix encoding on output



svn: r8145
This commit is contained in:
Don Allingham 2007-02-17 22:46:51 +00:00
parent cefc47373e
commit 43fd769d53
2 changed files with 24 additions and 15 deletions

View File

@ -1,3 +1,6 @@
2007-02-17 Anthon Pang <apang@softwaredevelopment.ca>
* src/GrampsDb/_WriteGedcom.py: Fix encoding on output
2007-02-16 Alex Roitman <shura@gramps-project.org> 2007-02-16 Alex Roitman <shura@gramps-project.org>
* configure.in: Add HELPPATH and FONTPATH substitutions, generate * configure.in: Add HELPPATH and FONTPATH substitutions, generate
new files in help/output. new files in help/output.

View File

@ -543,7 +543,7 @@ class GedcomWriter(UpdateCallback):
else: else:
self.writeln("1 CHAR UTF-8") self.writeln("1 CHAR UTF-8")
self.writeln("1 SUBM @SUBM@") self.writeln("1 SUBM @SUBM@")
self.writeln("1 FILE %s" % filename) self.writeln("1 FILE %s" % self.cnvtxt(filename))
self.write_copy() self.write_copy()
self.writeln("1 GEDC") self.writeln("1 GEDC")
self.writeln("2 VERS 5.5") self.writeln("2 VERS 5.5")
@ -606,10 +606,10 @@ class GedcomWriter(UpdateCallback):
y = t[0] y = t[0]
if self.copy == 0: if self.copy == 0:
o = self.db.get_researcher().get_name() o = self.cnvtxt(self.db.get_researcher().get_name())
self.writeln('1 COPR Copyright (c) %d %s.' % (y,o)) self.writeln('1 COPR Copyright (c) %d %s.' % (y,o))
elif self.copy == 1: elif self.copy == 1:
o = self.db.get_researcher().get_name() o = self.cnvtxt(self.db.get_researcher().get_name())
self.writeln('1 COPR Copyright (c) %d %s. ' self.writeln('1 COPR Copyright (c) %d %s. '
'See additional copyright NOTE below.' % (y,o)) 'See additional copyright NOTE below.' % (y,o))
@ -619,13 +619,13 @@ class GedcomWriter(UpdateCallback):
t = time.localtime(time.time()) t = time.localtime(time.time())
y = t[0] y = t[0]
o = self.db.get_researcher().get_name() o = self.cnvtxt(self.db.get_researcher().get_name())
self.writeln('1 NOTE Copyright (c) %d %s.' % (y,o)) self.writeln('1 NOTE Copyright (c) %d %s.' % (y,o))
try: try:
f = open(const.fdl,"r") f = open(const.fdl,"r")
for line in f.readlines(): for line in f.readlines():
self.g.write('2 CONT %s' % line) self.g.write('2 CONT %s' % self.cnvxt(line))
f.close() f.close()
except: except:
pass pass
@ -682,9 +682,11 @@ class GedcomWriter(UpdateCallback):
ftype = family.get_relationship() ftype = family.get_relationship()
if ftype != RelLib.FamilyRelType.MARRIED and \ if ftype != RelLib.FamilyRelType.MARRIED and \
str(ftype).strip() != "": str(ftype).strip() != "":
self.writeln("2 TYPE %s" % str(ftype)) self.writeln("2 TYPE %s" %
self.cnvtxt(str(ftype)))
elif event.get_description().strip() != "": elif event.get_description().strip() != "":
self.writeln("2 TYPE %s" % event.get_description()) self.writeln("2 TYPE %s" %
self.cnvtxt(event.get_description()))
else: else:
self.writeln("1 EVEN") self.writeln("1 EVEN")
the_type = str(event.get_type()) the_type = str(event.get_type())
@ -915,7 +917,8 @@ class GedcomWriter(UpdateCallback):
else: else:
self.writeln("1 BIRT Y") self.writeln("1 BIRT Y")
if birth.get_description().strip() != "": if birth.get_description().strip() != "":
self.writeln("2 TYPE %s" % birth.get_description()) self.writeln("2 TYPE %s" %
self.cnvtxt(birth.get_description()))
self.dump_event_stats(birth, birth_ref) self.dump_event_stats(birth, birth_ref)
death_ref = person.get_death_ref() death_ref = person.get_death_ref()
@ -1143,9 +1146,11 @@ class GedcomWriter(UpdateCallback):
self.writeln('1 OBJE') self.writeln('1 OBJE')
self.writeln('2 FORM URL') self.writeln('2 FORM URL')
if url.get_description(): if url.get_description():
self.writeln('2 TITL %s' % url.get_description()) self.writeln('2 TITL %s' %
self.cnvtxt(url.get_description()))
if url.get_path(): if url.get_path():
self.writeln('2 FILE %s' % url.get_path()) self.writeln('2 FILE %s' %
self.cnvtxt(url.get_path()))
if not restricted or not self.exclnotes: if not restricted or not self.exclnotes:
if person.get_note(): if person.get_note():
@ -1286,7 +1291,7 @@ class GedcomWriter(UpdateCallback):
if family: if family:
self.writeln('%d FAMC @%s@' % (index+1,family.get_gramps_id())) self.writeln('%d FAMC @%s@' % (index+1,family.get_gramps_id()))
if ord.get_temple(): if ord.get_temple():
self.writeln('%d TEMP %s' % (index+1,ord.get_temple())) self.writeln('%d TEMP %s' % (index+1,self.cnvtxt(ord.get_temple())))
if ord.get_place_handle(): if ord.get_place_handle():
self.write_place( self.write_place(
self.db.get_place_from_handle(ord.get_place_handle()),2) self.db.get_place_from_handle(ord.get_place_handle()),2)
@ -1358,7 +1363,7 @@ class GedcomWriter(UpdateCallback):
if name.get_title(): if name.get_title():
self.writeln("2 NPFX %s" % title) self.writeln("2 NPFX %s" % title)
if nick: if nick:
self.writeln('2 NICK %s' % nick) self.writeln('2 NICK %s' % self.cnvtxt(nick))
if name.get_note(): if name.get_note():
self.write_long_text("NOTE",2,self.cnvtxt(name.get_note())) self.write_long_text("NOTE",2,self.cnvtxt(name.get_note()))
for srcref in name.get_source_references(): for srcref in name.get_source_references():
@ -1452,10 +1457,11 @@ class GedcomWriter(UpdateCallback):
self.writeln('%d OBJE' % level) self.writeln('%d OBJE' % level)
if form: if form:
self.writeln('%d FORM %s' % (level+1, form) ) self.writeln('%d FORM %s' % (level+1, form) )
self.writeln('%d TITL %s' % (level+1, photo_obj.get_description())) self.writeln('%d TITL %s' % (level+1,
self.cnvtxt(photo_obj.get_description())))
basename = os.path.basename (path) basename = os.path.basename (path)
self.writeln('%d FILE %s' % (level+1,os.path.join(self.images_path, self.writeln('%d FILE %s' % (level+1,
basename))) self.cnvtxt(os.path.join(self.images_path, basename))))
if photo_obj.get_note(): if photo_obj.get_note():
self.write_long_text("NOTE",level+1, self.write_long_text("NOTE",level+1,
self.cnvtxt(photo_obj.get_note())) self.cnvtxt(photo_obj.get_note()))