2007-08-09 Don Allingham <don@gramps-project.org>

* GrampsDbUtils/_WriteGedcom.py: use utf8 encoding only
	* GrampsDbUtils/gedcomexport.glade:  use utf8 encoding only



svn: r8806
This commit is contained in:
Don Allingham 2007-08-10 03:53:48 +00:00
parent ef84a6a93c
commit 215595a56b
3 changed files with 35 additions and 237 deletions

View File

@ -1,3 +1,7 @@
2007-08-09 Don Allingham <don@gramps-project.org>
* GrampsDbUtils/_WriteGedcom.py: use utf8 encoding only
* GrampsDbUtils/gedcomexport.glade: use utf8 encoding only
2007-08-09 Brian Matherly <brian@gramps-project.org>
* src/GrampsDbUtils/_PrivateProxyDb.py: Continued work.

View File

@ -53,7 +53,6 @@ from Filters import GenericFilter, Rules, build_filter_menu
import const
import _GedcomInfo as GedcomInfo
import Errors
import ansel_utf8
import Utils
from BasicUtils import name_displayer
from QuestionDialog import *
@ -66,17 +65,6 @@ except:
log.warn("No Config module available using defaults.")
HAVE_CONFIG = False
#------------------------------------------------------------------------
#
# Helper functions
#
#------------------------------------------------------------------------
def keep_utf8(s):
return s
def iso8859(s):
return s.encode('iso-8859-1', 'replace')
#-------------------------------------------------------------------------
#
# GEDCOM tags representing attributes that may take a parameter, value or
@ -278,7 +266,6 @@ class GedcomWriterOptionBox:
def get_option_box(self):
self.restrict = True
self.private = True
self.cnvtxt = keep_utf8
self.adopt = GedcomInfo.ADOPT_EVENT
glade_file = "%s/gedcomexport.glade" % os.path.dirname(__file__)
@ -287,19 +274,10 @@ class GedcomWriterOptionBox:
self.topDialog = gtk.glade.XML(glade_file, "gedcomExport", "gramps")
self.topDialog.signal_autoconnect({
"gnu_free" : self.gnu_free,
"standard_copyright" : self.standard_copyright,
"no_copyright" : self.no_copyright,
"ansel" : self.ansel,
"ansi" : self.ansi,
"unicode" : self.uncd,
"on_restrict_toggled" : self.on_restrict_toggled,
})
self.topDialog.get_widget("encoding").set_history(1)
filter_obj = self.topDialog.get_widget("filter")
self.copy = 0
all = GenericFilter()
all.set_name(_("Entire Database"))
@ -353,24 +331,6 @@ class GedcomWriterOptionBox:
self.topDialog.get_widget("gedcomExport").destroy()
return the_box
def gnu_free(self, obj):
self.copy = 1
def standard_copyright(self, obj):
self.copy = 0
def no_copyright(self, obj):
self.copy = 2
def ansel(self, obj):
self.cnvtxt = ansel_utf8.utf8_to_ansel
def uncd(self, obj):
self.cnvtxt = keep_utf8
def ansi(self, obj):
self.cnvtxt = iso8859
def on_restrict_toggled(self, restrict):
active = restrict.get_active ()
map (lambda x: x.set_sensitive (active),
@ -408,7 +368,7 @@ class GedcomWriterOptionBox:
self.resi = self.target_ged.get_resi()
self.prefix = self.target_ged.get_prefix()
self.nl = self.cnvtxt(self.target_ged.get_endl())
self.nl = self.target_ged.get_endl()
#-------------------------------------------------------------------------
#
@ -454,9 +414,9 @@ class GedcomWriter(UpdateCallback):
for text in textlist:
if limit:
prefix = "\n%d CONC " % (level + 1)
txt = prefix.join(breakup(self.cnvtxt(text), limit))
txt = prefix.join(breakup(text, limit))
else:
txt = self.cnvtxt(text)
txt = text
self.g.write("%d %s %s\n" % (token_level, token, txt))
token_level = level+1
token = "CONT"
@ -472,7 +432,6 @@ class GedcomWriter(UpdateCallback):
self.exclnotes = self.option_box.exclnotes
self.exclsrcs = self.option_box.exclsrcs
self.private = self.option_box.private
self.copy = self.option_box.copy
self.images = self.option_box.images
self.images_path = self.option_box.images_path
self.target_ged = self.option_box.target_ged
@ -483,7 +442,6 @@ class GedcomWriter(UpdateCallback):
self.obje = self.option_box.obje
self.resi = self.option_box.resi
self.prefix = self.option_box.prefix
self.cnvtxt = self.option_box.cnvtxt
self.nl = self.option_box.nl
if self.option_box.cfilter == None:
@ -502,7 +460,6 @@ class GedcomWriter(UpdateCallback):
# use default settings
self.restrict = 0
self.private = 0
self.copy = 0
self.images = 0
self.plist = set(self.db.get_person_handles(sort_handles=False))
@ -518,8 +475,7 @@ class GedcomWriter(UpdateCallback):
self.resi = self.target_ged.get_resi()
self.prefix = self.target_ged.get_prefix()
self.cnvtxt = keep_utf8
self.nl = self.cnvtxt(self.target_ged.get_endl())
self.nl = self.target_ged.get_endl()
return True
@ -602,13 +558,7 @@ class GedcomWriter(UpdateCallback):
self.__writeln(1, "GEDC")
self.__writeln(2, "VERS", "5.5")
self.__writeln(2, "FORM", 'LINEAGE-LINKED')
if self.cnvtxt == ansel_utf8.utf8_to_ansel:
self.__writeln(1, "CHAR", "ANSEL")
elif self.cnvtxt == iso8859:
self.__writeln(1, "CHAR", "ANSI")
else:
self.__writeln(1, "CHAR", "UTF-8")
self.__writeln(1, "CHAR", "UTF-8")
def __write_submitter(self):
"""
@ -997,20 +947,17 @@ class GedcomWriter(UpdateCallback):
for srcref in attr.get_source_references():
self.write_source_ref(2, srcref)
for child_ref in family.get_child_ref_list():
if child_ref.ref not in self.plist:
continue
person = self.db.get_person_from_handle(child_ref.ref)
if not person:
continue
self.__writeln(1, 'CHIL', '@%s@' % person.get_gramps_id())
for child_ref in [cref.ref for cref in family.get_child_ref_list()
if cref.ref not in self.plist]:
person = self.db.get_person_from_handle(child_ref)
if person:
self.__writeln(1, 'CHIL', '@%s@' % person.get_gramps_id())
for srcref in family.get_source_references():
self.write_source_ref(1, srcref)
if self.images:
photos = family.get_media_list ()
for photo in photos:
for photo in family.get_media_list():
self.write_photo(photo, 1)
self.__write_note_references(family.get_note_list(), 1)
@ -1228,7 +1175,7 @@ class GedcomWriter(UpdateCallback):
val = make_date(start, cal, mod)
self.writeln("%s %s" % (prefix, val))
elif date.get_text():
self.writeln("%s %s" % (prefix, self.cnvtxt(date.get_text())))
self.writeln("%s %s" % (prefix, date.get_text()))
def __write_person_name(self, name, nick):
"""

View File

@ -92,40 +92,12 @@
<widget class="GtkTable" id="table3">
<property name="border_width">12</property>
<property name="visible">True</property>
<property name="n_rows">10</property>
<property name="n_rows">7</property>
<property name="n_columns">3</property>
<property name="homogeneous">False</property>
<property name="row_spacing">6</property>
<property name="column_spacing">12</property>
<child>
<widget class="GtkLabel" id="label10">
<property name="visible">True</property>
<property name="label" translatable="yes">&lt;b&gt;Encoding&lt;/b&gt;</property>
<property name="use_underline">False</property>
<property name="use_markup">True</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">0</property>
<property name="right_attach">3</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label9">
<property name="visible">True</property>
@ -147,8 +119,8 @@
<packing>
<property name="left_attach">0</property>
<property name="right_attach">3</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="top_attach">0</property>
<property name="bottom_attach">1</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
@ -176,8 +148,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
@ -198,8 +170,8 @@
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
@ -227,8 +199,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
@ -257,85 +229,8 @@
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkLabel" id="label6">
<property name="visible">True</property>
<property name="label" translatable="yes">_Copyright:</property>
<property name="use_underline">True</property>
<property name="use_markup">False</property>
<property name="justify">GTK_JUSTIFY_LEFT</property>
<property name="wrap">False</property>
<property name="selectable">False</property>
<property name="xalign">0.0010000000475</property>
<property name="yalign">0.5</property>
<property name="xpad">0</property>
<property name="ypad">0</property>
<property name="mnemonic_widget">copyright</property>
<property name="ellipsize">PANGO_ELLIPSIZE_NONE</property>
<property name="width_chars">-1</property>
<property name="single_line_mode">False</property>
<property name="angle">0</property>
</widget>
<packing>
<property name="left_attach">1</property>
<property name="right_attach">2</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkOptionMenu" id="copyright">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="history">0</property>
<child>
<widget class="GtkMenu" id="menu1">
<child>
<widget class="GtkMenuItem" id="standard_copyright">
<property name="visible">True</property>
<property name="label" translatable="yes">Standard Copyright</property>
<property name="use_underline">True</property>
<signal name="activate" handler="standard_copyright" last_modification_time="Tue, 11 Feb 2003 05:17:56 GMT"/>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="gnu_free">
<property name="visible">True</property>
<property name="label" translatable="yes">GNU Free Documentation License</property>
<property name="use_underline">True</property>
<signal name="activate" handler="gnu_free" last_modification_time="Tue, 11 Feb 2003 05:17:56 GMT"/>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="no_copyright1">
<property name="visible">True</property>
<property name="label" translatable="yes">No Copyright</property>
<property name="use_underline">True</property>
<signal name="activate" handler="no_copyright" last_modification_time="Tue, 11 Feb 2003 05:17:56 GMT"/>
</widget>
</child>
</widget>
</child>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="top_attach">2</property>
<property name="bottom_attach">3</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
@ -357,8 +252,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">3</property>
<property name="top_attach">6</property>
<property name="bottom_attach">7</property>
<property name="top_attach">3</property>
<property name="bottom_attach">4</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
@ -381,8 +276,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">3</property>
<property name="top_attach">7</property>
<property name="bottom_attach">8</property>
<property name="top_attach">4</property>
<property name="bottom_attach">5</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
@ -480,60 +375,12 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">3</property>
<property name="top_attach">8</property>
<property name="bottom_attach">9</property>
<property name="top_attach">5</property>
<property name="bottom_attach">6</property>
<property name="x_options">fill</property>
</packing>
</child>
<child>
<widget class="GtkOptionMenu" id="encoding">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="history">0</property>
<child>
<widget class="GtkMenu" id="menu2">
<child>
<widget class="GtkMenuItem" id="ansel">
<property name="visible">True</property>
<property name="label" translatable="yes">_ANSEL</property>
<property name="use_underline">True</property>
<signal name="activate" handler="ansel" last_modification_time="Mon, 12 Jul 2004 20:33:33 GMT"/>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="unicode">
<property name="visible">True</property>
<property name="label" translatable="yes">_UTF-8</property>
<property name="use_underline">True</property>
<signal name="activate" handler="unicode" last_modification_time="Mon, 12 Jul 2004 20:36:01 GMT"/>
</widget>
</child>
<child>
<widget class="GtkMenuItem" id="ansi">
<property name="visible">True</property>
<property name="label" translatable="yes">AN_SI (ISO-8859-1)</property>
<property name="use_underline">True</property>
<signal name="activate" handler="ansi" last_modification_time="Mon, 12 Jul 2004 20:36:01 GMT"/>
</widget>
</child>
</widget>
</child>
</widget>
<packing>
<property name="left_attach">2</property>
<property name="right_attach">3</property>
<property name="top_attach">1</property>
<property name="bottom_attach">2</property>
<property name="x_options">fill</property>
<property name="y_options"></property>
</packing>
</child>
<child>
<widget class="GtkHBox" id="hbox1">
<property name="visible">True</property>
@ -581,8 +428,8 @@
<packing>
<property name="left_attach">1</property>
<property name="right_attach">3</property>
<property name="top_attach">9</property>
<property name="bottom_attach">10</property>
<property name="top_attach">6</property>
<property name="bottom_attach">7</property>
<property name="x_options">fill</property>
</packing>
</child>