* src/Utils.py: Provide a locale-aware string formatting conversion

into C-locale string (for saving floats in XML)
* src/StyleEditor.py (draw): Call locale.str instead of str.
* src/TextDoc.py (StyleSheetList.save): Call gformat instead of '%f'.


svn: r1744
This commit is contained in:
Alex Roitman
2003-06-15 00:05:43 +00:00
parent 2bfa45813f
commit 3e512cd70d
4 changed files with 37 additions and 13 deletions

View File

@@ -1,7 +1,7 @@
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000 Donald N. Allingham
# Copyright (C) 2000-2003 Donald N. Allingham
#
# Modified September 2002 by Gary Shao
#
@@ -777,13 +777,14 @@ class StyleSheetList:
f.write('underline="%d" ' % font.get_underline())
f.write('color="#%02x%02x%02x"/>\n' % font.get_color())
f.write('<para ')
rm = Utils.gfloat(p.get_right_margin())
lm = Utils.gfloat(p.get_left_margin())
fi = Utils.gfloat(p.get_first_indent())
f.write('rmargin="%.3f" ' % rm)
f.write('lmargin="%.3f" ' % lm)
f.write('first="%.3f" ' % fi)
f.write('pad="%.3f" ' % p.get_padding())
rm = float(p.get_right_margin())
lm = float(p.get_left_margin())
fi = float(p.get_first_indent())
pa = float(p.get_padding())
f.write('rmargin="%s" ' % Utils.gformat(rm))
f.write('lmargin="%s" ' % Utils.gformat(lm))
f.write('first="%s" ' % Utils.gformat(fi))
f.write('pad="%s" ' % Utils.gformat(pa))
f.write('bgcolor="#%02x%02x%02x" ' % p.get_background_color())
f.write('level="%d" ' % p.get_header_level())
f.write('align="%d" ' % p.get_alignment())