8185: Gramps freeze after defining a report stile with German cm values

This commit is contained in:
Paul Franklin 2014-12-17 19:59:49 -08:00
parent 1ed41b33e3
commit 713675521f

View File

@ -46,7 +46,6 @@ from .paragraphstyle import ParagraphStyle
from .fontstyle import FontStyle from .fontstyle import FontStyle
from .tablestyle import TableStyle, TableCellStyle from .tablestyle import TableStyle, TableCellStyle
from .graphicstyle import GraphicsStyle from .graphicstyle import GraphicsStyle
from gramps.gen.const import GRAMPS_LOCALE as glocale
#------------------------------------------------------------------------- #-------------------------------------------------------------------------
# #
@ -476,17 +475,17 @@ class SheetParser(handler.ContentHandler):
self.p = ParagraphStyle() self.p = ParagraphStyle()
if 'description' in attrs: if 'description' in attrs:
self.p.set_description(attrs['description']) self.p.set_description(attrs['description'])
self.p.set_right_margin(glocale.float(attrs['rmargin'])) self.p.set_right_margin(float(attrs['rmargin']))
self.p.set_left_margin(glocale.float(attrs['lmargin'])) self.p.set_left_margin(float(attrs['lmargin']))
self.p.set_first_indent(glocale.float(attrs['first'])) self.p.set_first_indent(float(attrs['first']))
try: try:
# This is needed to read older style files # This is needed to read older style files
# lacking tmargin and bmargin # lacking tmargin and bmargin
self.p.set_top_margin(glocale.float(attrs['tmargin'])) self.p.set_top_margin(float(attrs['tmargin']))
self.p.set_bottom_margin(glocale.float(attrs['bmargin'])) self.p.set_bottom_margin(float(attrs['bmargin']))
except KeyError: except KeyError:
pass pass
self.p.set_padding(glocale.float(attrs['pad'])) self.p.set_padding(float(attrs['pad']))
self.p.set_alignment(int(attrs['align'])) self.p.set_alignment(int(attrs['align']))
self.p.set_right_border(int(attrs['rborder'])) self.p.set_right_border(int(attrs['rborder']))
self.p.set_header_level(int(attrs['level'])) self.p.set_header_level(int(attrs['level']))
@ -510,16 +509,16 @@ class SheetParser(handler.ContentHandler):
self.c.set_right_border(int(attrs['rborder'])) self.c.set_right_border(int(attrs['rborder']))
self.c.set_top_border(int(attrs['tborder'])) self.c.set_top_border(int(attrs['tborder']))
self.c.set_bottom_border(int(attrs['bborder'])) self.c.set_bottom_border(int(attrs['bborder']))
self.c.set_padding(glocale.float(attrs['pad'])) self.c.set_padding(float(attrs['pad']))
elif tag == "draw": elif tag == "draw":
self.g = GraphicsStyle() self.g = GraphicsStyle()
self.g.set_paragraph_style(attrs['para']) self.g.set_paragraph_style(attrs['para'])
self.g.set_line_width(glocale.float(attrs['width'])) self.g.set_line_width(float(attrs['width']))
self.g.set_line_style(int(attrs['style'])) self.g.set_line_style(int(attrs['style']))
self.g.set_color(cnv2color(attrs['color'])) self.g.set_color(cnv2color(attrs['color']))
self.g.set_fill_color(cnv2color(attrs['fillcolor'])) self.g.set_fill_color(cnv2color(attrs['fillcolor']))
self.g.set_shadow(int(attrs['shadow']), self.g.set_shadow(int(attrs['shadow']),
glocale.float(attrs['space'])) float(attrs['space']))
def endElement(self, tag): def endElement(self, tag):
"Overridden class that handles the end of a XML element" "Overridden class that handles the end of a XML element"