* src/BaseDoc.py:
* src/docgen/PSDrawDoc.py: * src/docgen/SvgDrawDoc.py: * src/docgen/PdfDoc.py: * src/docgen/OpenOfficeDoc.py: * src/docgen/GtkPrint.py: * src/docgen/LPRDoc.py: * src/docgen/ODFDoc.py: * src/plugins/AncestorChart2.py: * src/plugins/DescendChart.py: * src/plugins/StatisticsChart.py: * src/plugins/TimeLine.py: Remove height and width from GraphicsStyle svn: r8237
This commit is contained in:
parent
97e29e18d1
commit
4b510b098c
15
ChangeLog
15
ChangeLog
@ -1,3 +1,18 @@
|
|||||||
|
2007-02-25 Brian Matherly <brian@gramps-project.org>
|
||||||
|
* src/BaseDoc.py:
|
||||||
|
* src/docgen/PSDrawDoc.py:
|
||||||
|
* src/docgen/SvgDrawDoc.py:
|
||||||
|
* src/docgen/PdfDoc.py:
|
||||||
|
* src/docgen/OpenOfficeDoc.py:
|
||||||
|
* src/docgen/GtkPrint.py:
|
||||||
|
* src/docgen/LPRDoc.py:
|
||||||
|
* src/docgen/ODFDoc.py:
|
||||||
|
* src/plugins/AncestorChart2.py:
|
||||||
|
* src/plugins/DescendChart.py:
|
||||||
|
* src/plugins/StatisticsChart.py:
|
||||||
|
* src/plugins/TimeLine.py:
|
||||||
|
Remove height and width from GraphicsStyle
|
||||||
|
|
||||||
2007-02-25 Benny Malengier <bm@cage.ugent.be>
|
2007-02-25 Benny Malengier <bm@cage.ugent.be>
|
||||||
* src/gramps_main.py: new icons, register them
|
* src/gramps_main.py: new icons, register them
|
||||||
* src/DateEdit.py : use icon
|
* src/DateEdit.py : use icon
|
||||||
|
@ -1133,8 +1133,6 @@ class GraphicsStyle:
|
|||||||
object.
|
object.
|
||||||
"""
|
"""
|
||||||
if obj:
|
if obj:
|
||||||
self.height = obj.height
|
|
||||||
self.width = obj.width
|
|
||||||
self.para_name = obj.para_name
|
self.para_name = obj.para_name
|
||||||
self.shadow = obj.shadow
|
self.shadow = obj.shadow
|
||||||
self.shadow_space = obj.shadow_space
|
self.shadow_space = obj.shadow_space
|
||||||
@ -1143,8 +1141,6 @@ class GraphicsStyle:
|
|||||||
self.lwidth = obj.lwidth
|
self.lwidth = obj.lwidth
|
||||||
self.lstyle = obj.lstyle
|
self.lstyle = obj.lstyle
|
||||||
else:
|
else:
|
||||||
self.height = 0
|
|
||||||
self.width = 0
|
|
||||||
self.para_name = ""
|
self.para_name = ""
|
||||||
self.shadow = 0
|
self.shadow = 0
|
||||||
self.shadow_space = 0.2
|
self.shadow_space = 0.2
|
||||||
@ -1171,12 +1167,6 @@ class GraphicsStyle:
|
|||||||
def set_line_style(self, val):
|
def set_line_style(self, val):
|
||||||
self.lstyle = val
|
self.lstyle = val
|
||||||
|
|
||||||
def set_height(self, val):
|
|
||||||
self.height = val
|
|
||||||
|
|
||||||
def set_width(self, val):
|
|
||||||
self.width = val
|
|
||||||
|
|
||||||
def set_paragraph_style(self, val):
|
def set_paragraph_style(self, val):
|
||||||
self.para_name = val
|
self.para_name = val
|
||||||
|
|
||||||
@ -1193,12 +1183,6 @@ class GraphicsStyle:
|
|||||||
def set_fill_color(self, val):
|
def set_fill_color(self, val):
|
||||||
self.fill_color = val
|
self.fill_color = val
|
||||||
|
|
||||||
def get_height(self):
|
|
||||||
return self.height
|
|
||||||
|
|
||||||
def get_width(self):
|
|
||||||
return self.width
|
|
||||||
|
|
||||||
def get_paragraph_style(self):
|
def get_paragraph_style(self):
|
||||||
return self.para_name
|
return self.para_name
|
||||||
|
|
||||||
@ -1454,7 +1438,7 @@ class BaseDoc:
|
|||||||
def draw_path(self, style, path):
|
def draw_path(self, style, path):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def draw_box(self, style, text, x, y):
|
def draw_box(self, style, text, x, y, w, h):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def draw_bar(self, style, x1, y1, x2, y2):
|
def draw_bar(self, style, x1, y1, x2, y2):
|
||||||
|
@ -418,7 +418,7 @@ class GtkDoc(BaseDoc.BaseDoc):
|
|||||||
def draw_path(self,style,path):
|
def draw_path(self,style,path):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def draw_box(self,style,text,x,y):
|
def draw_box(self,style,text,x,y, w, h):
|
||||||
pass
|
pass
|
||||||
|
|
||||||
def draw_text(self,style,text,x,y):
|
def draw_text(self,style,text,x,y):
|
||||||
|
@ -1056,7 +1056,7 @@ class LPRDoc(BaseDoc.BaseDoc):
|
|||||||
|
|
||||||
self.gpc.setrgbcolor(0,0,0)
|
self.gpc.setrgbcolor(0,0,0)
|
||||||
|
|
||||||
def draw_box(self,style,text,x,y):
|
def draw_box(self,style,text,x,y, w, h):
|
||||||
#assuming that we start drawing box from current position
|
#assuming that we start drawing box from current position
|
||||||
|
|
||||||
self.brand_new_page = 0
|
self.brand_new_page = 0
|
||||||
@ -1067,8 +1067,8 @@ class LPRDoc(BaseDoc.BaseDoc):
|
|||||||
para_name = box_style.get_paragraph_style()
|
para_name = box_style.get_paragraph_style()
|
||||||
para_style = self.style_list[para_name]
|
para_style = self.style_list[para_name]
|
||||||
fontstyle = para_style.get_font()
|
fontstyle = para_style.get_font()
|
||||||
bh = cm2u(box_style.get_height())
|
bh = cm2u(h)
|
||||||
bw = cm2u(box_style.get_width())
|
bw = cm2u(w)
|
||||||
|
|
||||||
if box_style.get_shadow():
|
if box_style.get_shadow():
|
||||||
ss = cm2u(box_style.get_shadow_space())
|
ss = cm2u(box_style.get_shadow_space())
|
||||||
|
@ -62,6 +62,7 @@ _esc_map = {
|
|||||||
'\x1a' : '',
|
'\x1a' : '',
|
||||||
'\x0c' : '',
|
'\x0c' : '',
|
||||||
'\n' : '<text:line-break/>',
|
'\n' : '<text:line-break/>',
|
||||||
|
'\t' : '<text:tab-stop/>',
|
||||||
'<super>' : '<text:span text:style-name="GSuper">',
|
'<super>' : '<text:span text:style-name="GSuper">',
|
||||||
'</super>' : '</text:span>',
|
'</super>' : '</text:span>',
|
||||||
}
|
}
|
||||||
@ -1049,10 +1050,7 @@ class ODFDoc(BaseDoc.BaseDoc):
|
|||||||
|
|
||||||
pstyle = self.style_list[para_name]
|
pstyle = self.style_list[para_name]
|
||||||
font = pstyle.get_font()
|
font = pstyle.get_font()
|
||||||
if box_style.get_width():
|
sw = ReportUtils.pt2cm(FontScale.string_width(font,text))*1.3
|
||||||
sw = box_style.get_width()*1.2
|
|
||||||
else:
|
|
||||||
sw = ReportUtils.pt2cm(FontScale.string_width(font,text))*1.3
|
|
||||||
|
|
||||||
self.cntnt.write('<draw:frame text:anchor-type="paragraph" ')
|
self.cntnt.write('<draw:frame text:anchor-type="paragraph" ')
|
||||||
self.cntnt.write('draw:z-index="2" ')
|
self.cntnt.write('draw:z-index="2" ')
|
||||||
@ -1084,7 +1082,7 @@ class ODFDoc(BaseDoc.BaseDoc):
|
|||||||
self.cntnt.write('svg:y="%.2fcm">' % float(y))
|
self.cntnt.write('svg:y="%.2fcm">' % float(y))
|
||||||
self.cntnt.write('</draw:rect>\n')
|
self.cntnt.write('</draw:rect>\n')
|
||||||
|
|
||||||
def draw_box(self,style,text,x,y):
|
def draw_box(self,style,text,x,y, w, h):
|
||||||
box_style = self.draw_styles[style]
|
box_style = self.draw_styles[style]
|
||||||
para_name = box_style.get_paragraph_style()
|
para_name = box_style.get_paragraph_style()
|
||||||
shadow_width = box_style.get_shadow_space()
|
shadow_width = box_style.get_shadow_space()
|
||||||
@ -1094,8 +1092,8 @@ class ODFDoc(BaseDoc.BaseDoc):
|
|||||||
self.cntnt.write('draw:style-name="%s_shadow" ' % style)
|
self.cntnt.write('draw:style-name="%s_shadow" ' % style)
|
||||||
self.cntnt.write('draw:z-index="0" ')
|
self.cntnt.write('draw:z-index="0" ')
|
||||||
self.cntnt.write('draw:text-style-name="%s" ' % para_name)
|
self.cntnt.write('draw:text-style-name="%s" ' % para_name)
|
||||||
self.cntnt.write('svg:width="%.2fcm" ' % box_style.get_width())
|
self.cntnt.write('svg:width="%.2fcm" ' % w)
|
||||||
self.cntnt.write('svg:height="%.2fcm" ' % box_style.get_height())
|
self.cntnt.write('svg:height="%.2fcm" ' % h)
|
||||||
self.cntnt.write('svg:x="%.2fcm" ' % (float(x)+shadow_width))
|
self.cntnt.write('svg:x="%.2fcm" ' % (float(x)+shadow_width))
|
||||||
self.cntnt.write('svg:y="%.2fcm">\n' % (float(y)+shadow_width))
|
self.cntnt.write('svg:y="%.2fcm">\n' % (float(y)+shadow_width))
|
||||||
self.cntnt.write('</draw:rect>\n')
|
self.cntnt.write('</draw:rect>\n')
|
||||||
@ -1104,16 +1102,14 @@ class ODFDoc(BaseDoc.BaseDoc):
|
|||||||
self.cntnt.write('draw:style-name="%s" ' % style)
|
self.cntnt.write('draw:style-name="%s" ' % style)
|
||||||
self.cntnt.write('draw:text-style-name="%s" ' % para_name)
|
self.cntnt.write('draw:text-style-name="%s" ' % para_name)
|
||||||
self.cntnt.write('draw:z-index="1" ')
|
self.cntnt.write('draw:z-index="1" ')
|
||||||
self.cntnt.write('svg:width="%.2fcm" ' % box_style.get_width())
|
self.cntnt.write('svg:width="%.2fcm" ' % w)
|
||||||
self.cntnt.write('svg:height="%.2fcm" ' % box_style.get_height())
|
self.cntnt.write('svg:height="%.2fcm" ' % h)
|
||||||
self.cntnt.write('svg:x="%.2fcm" ' % float(x))
|
self.cntnt.write('svg:x="%.2fcm" ' % float(x))
|
||||||
self.cntnt.write('svg:y="%.2fcm">\n' % float(y))
|
self.cntnt.write('svg:y="%.2fcm">\n' % float(y))
|
||||||
if text != "":
|
if text != "":
|
||||||
self.cntnt.write('<text:p text:style-name="%s">' % para_name)
|
self.cntnt.write('<text:p text:style-name="%s">' % para_name)
|
||||||
self.cntnt.write('<text:span text:style-name="F%s">' % para_name)
|
self.cntnt.write('<text:span text:style-name="F%s">' % para_name)
|
||||||
text = text.replace('\t','<text:tab-stop/>')
|
self.cntnt.write(escape(text,_esc_map))
|
||||||
text = text.replace('\n','<text:line-break/>')
|
|
||||||
self.cntnt.write(escape(text))
|
|
||||||
self.cntnt.write('</text:span>')
|
self.cntnt.write('</text:span>')
|
||||||
self.cntnt.write('</text:p>\n')
|
self.cntnt.write('</text:p>\n')
|
||||||
self.cntnt.write('</draw:rect>\n')
|
self.cntnt.write('</draw:rect>\n')
|
||||||
|
@ -896,11 +896,7 @@ class OpenOfficeDoc(BaseDoc.BaseDoc):
|
|||||||
|
|
||||||
pstyle = self.style_list[para_name]
|
pstyle = self.style_list[para_name]
|
||||||
font = pstyle.get_font()
|
font = pstyle.get_font()
|
||||||
if box_style.get_width():
|
sw = ReportUtils.pt2cm(FontScale.string_width(font,text))*1.3
|
||||||
sw = box_style.get_width()
|
|
||||||
else:
|
|
||||||
sw = ReportUtils.pt2cm(FontScale.string_width(font,text))*1.3
|
|
||||||
|
|
||||||
|
|
||||||
self.cntnt.write('<draw:text-box draw:style-name="%s" ' % style)
|
self.cntnt.write('<draw:text-box draw:style-name="%s" ' % style)
|
||||||
self.cntnt.write('draw:layer="layout" ')
|
self.cntnt.write('draw:layer="layout" ')
|
||||||
@ -929,7 +925,7 @@ class OpenOfficeDoc(BaseDoc.BaseDoc):
|
|||||||
self.cntnt.write('svg:y="%.3fcm">' % float(y))
|
self.cntnt.write('svg:y="%.3fcm">' % float(y))
|
||||||
self.cntnt.write('</draw:rect>\n')
|
self.cntnt.write('</draw:rect>\n')
|
||||||
|
|
||||||
def draw_box(self,style,text,x,y):
|
def draw_box(self,style,text,x,y, w, h):
|
||||||
box_style = self.draw_styles[style]
|
box_style = self.draw_styles[style]
|
||||||
para_name = box_style.get_paragraph_style()
|
para_name = box_style.get_paragraph_style()
|
||||||
shadow_width = box_style.get_shadow_space()
|
shadow_width = box_style.get_shadow_space()
|
||||||
@ -939,8 +935,8 @@ class OpenOfficeDoc(BaseDoc.BaseDoc):
|
|||||||
self.cntnt.write('draw:style-name="%s_shadow" ' % style)
|
self.cntnt.write('draw:style-name="%s_shadow" ' % style)
|
||||||
self.cntnt.write('draw:text-style-name="%s" ' % para_name)
|
self.cntnt.write('draw:text-style-name="%s" ' % para_name)
|
||||||
self.cntnt.write('draw:z-index="0" ')
|
self.cntnt.write('draw:z-index="0" ')
|
||||||
self.cntnt.write('svg:width="%.3fcm" ' % box_style.get_width())
|
self.cntnt.write('svg:width="%.3fcm" ' % w)
|
||||||
self.cntnt.write('svg:height="%.3fcm" ' % box_style.get_height())
|
self.cntnt.write('svg:height="%.3fcm" ' % h)
|
||||||
self.cntnt.write('svg:x="%.3fcm" ' % (float(x)+shadow_width))
|
self.cntnt.write('svg:x="%.3fcm" ' % (float(x)+shadow_width))
|
||||||
self.cntnt.write('svg:y="%.3fcm">\n' % (float(y)+shadow_width))
|
self.cntnt.write('svg:y="%.3fcm">\n' % (float(y)+shadow_width))
|
||||||
self.cntnt.write('</draw:rect>\n')
|
self.cntnt.write('</draw:rect>\n')
|
||||||
@ -949,8 +945,8 @@ class OpenOfficeDoc(BaseDoc.BaseDoc):
|
|||||||
self.cntnt.write('draw:style-name="%s" ' % style)
|
self.cntnt.write('draw:style-name="%s" ' % style)
|
||||||
self.cntnt.write('draw:text-style-name="%s" ' % para_name)
|
self.cntnt.write('draw:text-style-name="%s" ' % para_name)
|
||||||
self.cntnt.write('draw:z-index="1" ')
|
self.cntnt.write('draw:z-index="1" ')
|
||||||
self.cntnt.write('svg:width="%.3fcm" ' % box_style.get_width())
|
self.cntnt.write('svg:width="%.3fcm" ' % w)
|
||||||
self.cntnt.write('svg:height="%.3fcm" ' % box_style.get_height())
|
self.cntnt.write('svg:height="%.3fcm" ' % h)
|
||||||
self.cntnt.write('svg:x="%.3fcm" ' % float(x))
|
self.cntnt.write('svg:x="%.3fcm" ' % float(x))
|
||||||
self.cntnt.write('svg:y="%.3fcm">\n' % float(y))
|
self.cntnt.write('svg:y="%.3fcm">\n' % float(y))
|
||||||
if text != "":
|
if text != "":
|
||||||
|
@ -324,42 +324,40 @@ class PSDrawDoc(BaseDoc.BaseDoc):
|
|||||||
self.f.write('%s %s %s setrgbcolor stroke\n' % lrgb(color))
|
self.f.write('%s %s %s setrgbcolor stroke\n' % lrgb(color))
|
||||||
self.f.write('grestore\n')
|
self.f.write('grestore\n')
|
||||||
|
|
||||||
def draw_box(self,style,text,x,y):
|
def draw_box(self,style,text,x,y, w, h):
|
||||||
x = x + self.paper.get_left_margin()
|
x = x + self.paper.get_left_margin()
|
||||||
y = y + self.paper.get_top_margin()
|
y = y + self.paper.get_top_margin()
|
||||||
|
|
||||||
box_style = self.draw_styles[style]
|
box_style = self.draw_styles[style]
|
||||||
para_name = box_style.get_paragraph_style()
|
para_name = box_style.get_paragraph_style()
|
||||||
p = self.style_list[para_name]
|
p = self.style_list[para_name]
|
||||||
|
|
||||||
bh = box_style.get_height()
|
|
||||||
bw = box_style.get_width()
|
|
||||||
self.f.write('gsave\n')
|
self.f.write('gsave\n')
|
||||||
|
|
||||||
shadsize = box_style.get_shadow_space()
|
shadsize = box_style.get_shadow_space()
|
||||||
if box_style.get_shadow():
|
if box_style.get_shadow():
|
||||||
self.f.write('newpath\n')
|
self.f.write('newpath\n')
|
||||||
self.f.write('%s cm %s cm moveto\n' % coords(self.translate(x+shadsize,y+shadsize)))
|
self.f.write('%s cm %s cm moveto\n' % coords(self.translate(x+shadsize,y+shadsize)))
|
||||||
self.f.write('0 -%s cm rlineto\n' % gformat(bh))
|
self.f.write('0 -%s cm rlineto\n' % gformat(h))
|
||||||
self.f.write('%s cm 0 rlineto\n' % gformat(bw))
|
self.f.write('%s cm 0 rlineto\n' % gformat(w))
|
||||||
self.f.write('0 %s cm rlineto\n' % gformat(bh))
|
self.f.write('0 %s cm rlineto\n' % gformat(h))
|
||||||
self.f.write('closepath\n')
|
self.f.write('closepath\n')
|
||||||
self.f.write('.5 setgray\n')
|
self.f.write('.5 setgray\n')
|
||||||
self.f.write('fill\n')
|
self.f.write('fill\n')
|
||||||
self.f.write('newpath\n')
|
self.f.write('newpath\n')
|
||||||
self.f.write('%s cm %s cm moveto\n' % coords(self.translate(x,y)))
|
self.f.write('%s cm %s cm moveto\n' % coords(self.translate(x,y)))
|
||||||
self.f.write('0 -%s cm rlineto\n' % gformat(bh))
|
self.f.write('0 -%s cm rlineto\n' % gformat(h))
|
||||||
self.f.write('%s cm 0 rlineto\n' % gformat(bw))
|
self.f.write('%s cm 0 rlineto\n' % gformat(w))
|
||||||
self.f.write('0 %s cm rlineto\n' % gformat(bh))
|
self.f.write('0 %s cm rlineto\n' % gformat(h))
|
||||||
self.f.write('closepath\n')
|
self.f.write('closepath\n')
|
||||||
self.f.write('1 setgray\n')
|
self.f.write('1 setgray\n')
|
||||||
self.f.write('fill\n')
|
self.f.write('fill\n')
|
||||||
self.f.write('newpath\n')
|
self.f.write('newpath\n')
|
||||||
if box_style.get_line_width():
|
if box_style.get_line_width():
|
||||||
self.f.write('%s cm %s cm moveto\n' % coords(self.translate(x,y)))
|
self.f.write('%s cm %s cm moveto\n' % coords(self.translate(x,y)))
|
||||||
self.f.write('0 -%s cm rlineto\n' % gformat(bh))
|
self.f.write('0 -%s cm rlineto\n' % gformat(h))
|
||||||
self.f.write('%s cm 0 rlineto\n' % gformat(bw))
|
self.f.write('%s cm 0 rlineto\n' % gformat(w))
|
||||||
self.f.write('0 %s cm rlineto\n' % gformat(bh))
|
self.f.write('0 %s cm rlineto\n' % gformat(h))
|
||||||
self.f.write('closepath\n')
|
self.f.write('closepath\n')
|
||||||
self.f.write('%s setlinewidth\n' % gformat(box_style.get_line_width()))
|
self.f.write('%s setlinewidth\n' % gformat(box_style.get_line_width()))
|
||||||
self.f.write('%s %s %s setrgbcolor stroke\n' % lrgb(box_style.get_color()))
|
self.f.write('%s %s %s setrgbcolor stroke\n' % lrgb(box_style.get_color()))
|
||||||
@ -372,7 +370,7 @@ class PSDrawDoc(BaseDoc.BaseDoc):
|
|||||||
mar = 10/28.35
|
mar = 10/28.35
|
||||||
f_in_cm = p.get_font().get_size()/28.35
|
f_in_cm = p.get_font().get_size()/28.35
|
||||||
fs = f_in_cm * 1.2
|
fs = f_in_cm * 1.2
|
||||||
center = y + (bh + fs)/2.0 + (fs*shadsize)
|
center = y + (h + fs)/2.0 + (fs*shadsize)
|
||||||
ystart = center - (fs/2.0) * nlines
|
ystart = center - (fs/2.0) * nlines
|
||||||
for i in range(nlines):
|
for i in range(nlines):
|
||||||
ypos = ystart + (i * fs)
|
ypos = ystart + (i * fs)
|
||||||
|
@ -472,22 +472,19 @@ class PdfDoc(BaseDoc.BaseDoc):
|
|||||||
p.closePath()
|
p.closePath()
|
||||||
self.drawing.add(p)
|
self.drawing.add(p)
|
||||||
|
|
||||||
def draw_box(self,style,text,x,y):
|
def draw_box(self,style,text,x,y, w, h):
|
||||||
y = self.get_usable_height() - y
|
y = self.get_usable_height() - y
|
||||||
|
|
||||||
box_style = self.draw_styles[style]
|
box_style = self.draw_styles[style]
|
||||||
para_name = box_style.get_paragraph_style()
|
para_name = box_style.get_paragraph_style()
|
||||||
p = self.style_list[para_name]
|
p = self.style_list[para_name]
|
||||||
|
|
||||||
w = box_style.get_width()*cm
|
|
||||||
h = box_style.get_height()*cm
|
|
||||||
|
|
||||||
sspace = box_style.get_shadow_space()
|
sspace = box_style.get_shadow_space()
|
||||||
if box_style.get_shadow():
|
if box_style.get_shadow():
|
||||||
col = make_color((0xc0,0xc0,0xc0))
|
col = make_color((0xc0,0xc0,0xc0))
|
||||||
r = reportlab.graphics.shapes.Rect((x+sspace)*cm,
|
r = reportlab.graphics.shapes.Rect((x+sspace)*cm,
|
||||||
(y-sspace)*cm-h,
|
(y-sspace)*cm-h,
|
||||||
w,h,
|
w*cm,h*cm,
|
||||||
fillColor=col,
|
fillColor=col,
|
||||||
strokeColor=col)
|
strokeColor=col)
|
||||||
self.drawing.add(r)
|
self.drawing.add(r)
|
||||||
@ -495,7 +492,7 @@ class PdfDoc(BaseDoc.BaseDoc):
|
|||||||
sw = box_style.get_line_width()
|
sw = box_style.get_line_width()
|
||||||
fc = box_style.get_fill_color()
|
fc = box_style.get_fill_color()
|
||||||
sc = box_style.get_color()
|
sc = box_style.get_color()
|
||||||
r = reportlab.graphics.shapes.Rect((x)*cm,(y*cm)-h,w,h,
|
r = reportlab.graphics.shapes.Rect((x)*cm,(y*cm)-(h*cm),w*cm,h*cm,
|
||||||
strokeWidth=sw,
|
strokeWidth=sw,
|
||||||
fillColor=fc,
|
fillColor=fc,
|
||||||
strokeColor=sc)
|
strokeColor=sc)
|
||||||
|
@ -170,28 +170,26 @@ class SvgDrawDoc(BaseDoc.BaseDoc):
|
|||||||
self.f.write('stroke:#%02x%02x%02x; ' % s.get_color())
|
self.f.write('stroke:#%02x%02x%02x; ' % s.get_color())
|
||||||
self.f.write('stroke-width:%.2f;"/>\n' % s.get_line_width())
|
self.f.write('stroke-width:%.2f;"/>\n' % s.get_line_width())
|
||||||
|
|
||||||
def draw_box(self,style,text,x,y):
|
def draw_box(self,style,text,x,y, w, h):
|
||||||
x = x + self.paper.get_left_margin()
|
x = x + self.paper.get_left_margin()
|
||||||
y = y + self.paper.get_top_margin()
|
y = y + self.paper.get_top_margin()
|
||||||
|
|
||||||
box_style = self.draw_styles[style]
|
box_style = self.draw_styles[style]
|
||||||
para_name = box_style.get_paragraph_style()
|
para_name = box_style.get_paragraph_style()
|
||||||
p = self.style_list[para_name]
|
p = self.style_list[para_name]
|
||||||
|
|
||||||
bh = box_style.get_height()
|
|
||||||
bw = box_style.get_width()
|
|
||||||
if box_style.get_shadow():
|
if box_style.get_shadow():
|
||||||
self.f.write('<rect ')
|
self.f.write('<rect ')
|
||||||
self.f.write('x="%4.2fcm" ' % (x+0.15))
|
self.f.write('x="%4.2fcm" ' % (x+0.15))
|
||||||
self.f.write('y="%4.2fcm" ' % (y+0.15))
|
self.f.write('y="%4.2fcm" ' % (y+0.15))
|
||||||
self.f.write('width="%4.2fcm" ' % bw)
|
self.f.write('width="%4.2fcm" ' % w)
|
||||||
self.f.write('height="%4.2fcm" ' % bh)
|
self.f.write('height="%4.2fcm" ' % h)
|
||||||
self.f.write('style="fill:#808080; stroke:#808080; stroke-width:1;"/>\n')
|
self.f.write('style="fill:#808080; stroke:#808080; stroke-width:1;"/>\n')
|
||||||
self.f.write('<rect ')
|
self.f.write('<rect ')
|
||||||
self.f.write('x="%4.2fcm" ' % x)
|
self.f.write('x="%4.2fcm" ' % x)
|
||||||
self.f.write('y="%4.2fcm" ' % y)
|
self.f.write('y="%4.2fcm" ' % y)
|
||||||
self.f.write('width="%4.2fcm" ' % bw)
|
self.f.write('width="%4.2fcm" ' % w)
|
||||||
self.f.write('height="%4.2fcm" ' % bh)
|
self.f.write('height="%4.2fcm" ' % h)
|
||||||
self.f.write('style="fill:#%02x%02x%02x; ' % box_style.get_fill_color())
|
self.f.write('style="fill:#%02x%02x%02x; ' % box_style.get_fill_color())
|
||||||
self.f.write('stroke:#%02x%02x%02x; ' % box_style.get_color())
|
self.f.write('stroke:#%02x%02x%02x; ' % box_style.get_color())
|
||||||
self.f.write('stroke-width:%f;"/>\n' % box_style.get_line_width())
|
self.f.write('stroke-width:%f;"/>\n' % box_style.get_line_width())
|
||||||
@ -202,7 +200,7 @@ class SvgDrawDoc(BaseDoc.BaseDoc):
|
|||||||
nlines = len(lines)
|
nlines = len(lines)
|
||||||
mar = 10/28.35
|
mar = 10/28.35
|
||||||
fs = (font_size/28.35) * 1.2
|
fs = (font_size/28.35) * 1.2
|
||||||
center = y + (bh + fs)/2.0 + (fs*0.2)
|
center = y + (h + fs)/2.0 + (fs*0.2)
|
||||||
ystart = center - (fs/2.0) * nlines
|
ystart = center - (fs/2.0) * nlines
|
||||||
for i in range(nlines):
|
for i in range(nlines):
|
||||||
ypos = ystart + (i * fs)
|
ypos = ystart + (i * fs)
|
||||||
|
@ -328,8 +328,6 @@ class AncestorChart(Report):
|
|||||||
self.font.set_size(self.font.get_size()/self.scale)
|
self.font.set_size(self.font.get_size()/self.scale)
|
||||||
|
|
||||||
g = BaseDoc.GraphicsStyle()
|
g = BaseDoc.GraphicsStyle()
|
||||||
g.set_height(self.box_height)
|
|
||||||
g.set_width(self.box_width)
|
|
||||||
g.set_paragraph_style("AC2-Normal")
|
g.set_paragraph_style("AC2-Normal")
|
||||||
g.set_shadow(1,0.2/self.scale)
|
g.set_shadow(1,0.2/self.scale)
|
||||||
g.set_fill_color((255,255,255))
|
g.set_fill_color((255,255,255))
|
||||||
@ -340,7 +338,6 @@ class AncestorChart(Report):
|
|||||||
g.set_color((0,0,0))
|
g.set_color((0,0,0))
|
||||||
g.set_fill_color((255,255,255))
|
g.set_fill_color((255,255,255))
|
||||||
g.set_line_width(0)
|
g.set_line_width(0)
|
||||||
g.set_width(self.doc.get_usable_width())
|
|
||||||
self.doc.add_draw_style("AC2-title",g)
|
self.doc.add_draw_style("AC2-title",g)
|
||||||
|
|
||||||
g = BaseDoc.GraphicsStyle()
|
g = BaseDoc.GraphicsStyle()
|
||||||
@ -370,8 +367,12 @@ class AncestorChart(Report):
|
|||||||
if type(value) == tuple:
|
if type(value) == tuple:
|
||||||
(person,index) = value
|
(person,index) = value
|
||||||
text = '\n'.join(self.text[index])
|
text = '\n'.join(self.text[index])
|
||||||
self.doc.draw_box("AC2-box",text,phys_x*self.delta,
|
self.doc.draw_box("AC2-box",
|
||||||
phys_y*self.box_height+self.offset)
|
text,
|
||||||
|
phys_x*self.delta,
|
||||||
|
phys_y*self.box_height+self.offset,
|
||||||
|
self.box_width,
|
||||||
|
self.box_height )
|
||||||
elif value == 2:
|
elif value == 2:
|
||||||
self.doc.draw_line("AC2-line",
|
self.doc.draw_line("AC2-line",
|
||||||
phys_x*self.delta+self.box_width*0.5,
|
phys_x*self.delta+self.box_width*0.5,
|
||||||
|
@ -304,8 +304,6 @@ class DescendChart(Report):
|
|||||||
self.font.set_size(self.font.get_size()/self.scale)
|
self.font.set_size(self.font.get_size()/self.scale)
|
||||||
|
|
||||||
g = BaseDoc.GraphicsStyle()
|
g = BaseDoc.GraphicsStyle()
|
||||||
g.set_height(self.box_height)
|
|
||||||
g.set_width(self.box_width)
|
|
||||||
g.set_paragraph_style("DC2-Normal")
|
g.set_paragraph_style("DC2-Normal")
|
||||||
g.set_shadow(1,min(self.box_gap,0.2))
|
g.set_shadow(1,min(self.box_gap,0.2))
|
||||||
|
|
||||||
@ -318,7 +316,6 @@ class DescendChart(Report):
|
|||||||
g.set_color((0,0,0))
|
g.set_color((0,0,0))
|
||||||
g.set_fill_color((255,255,255))
|
g.set_fill_color((255,255,255))
|
||||||
g.set_line_width(0)
|
g.set_line_width(0)
|
||||||
g.set_width(self.doc.get_usable_width())
|
|
||||||
self.doc.add_draw_style("DC2-title",g)
|
self.doc.add_draw_style("DC2-title",g)
|
||||||
|
|
||||||
g = BaseDoc.GraphicsStyle()
|
g = BaseDoc.GraphicsStyle()
|
||||||
@ -349,7 +346,12 @@ class DescendChart(Report):
|
|||||||
text = '\n'.join(self.text[(x,y)])
|
text = '\n'.join(self.text[(x,y)])
|
||||||
xbegin = phys_x*self.delta
|
xbegin = phys_x*self.delta
|
||||||
yend = phys_y*bh+self.offset
|
yend = phys_y*bh+self.offset
|
||||||
self.doc.draw_box("DC2-box",text,xbegin,yend)
|
self.doc.draw_box("DC2-box",
|
||||||
|
text,
|
||||||
|
xbegin,
|
||||||
|
yend,
|
||||||
|
self.box_width,
|
||||||
|
self.box_height)
|
||||||
elif value == _LINE_HORIZONTAL:
|
elif value == _LINE_HORIZONTAL:
|
||||||
xbegin = phys_x*self.delta
|
xbegin = phys_x*self.delta
|
||||||
ystart = (phys_y*bh + self.box_height/2.0) + self.offset
|
ystart = (phys_y*bh + self.box_height/2.0) + self.offset
|
||||||
|
@ -572,7 +572,6 @@ class StatisticsChart(Report):
|
|||||||
g.set_color((0,0,0))
|
g.set_color((0,0,0))
|
||||||
g.set_fill_color((255,255,255))
|
g.set_fill_color((255,255,255))
|
||||||
g.set_line_width(0)
|
g.set_line_width(0)
|
||||||
g.set_width(self.doc.get_usable_width())
|
|
||||||
self.doc.add_draw_style("SC-title",g)
|
self.doc.add_draw_style("SC-title",g)
|
||||||
|
|
||||||
g = BaseDoc.GraphicsStyle()
|
g = BaseDoc.GraphicsStyle()
|
||||||
|
@ -148,7 +148,6 @@ class TimeLine(Report):
|
|||||||
g.set_color((0,0,0))
|
g.set_color((0,0,0))
|
||||||
g.set_fill_color((255,255,255))
|
g.set_fill_color((255,255,255))
|
||||||
g.set_line_width(0)
|
g.set_line_width(0)
|
||||||
g.set_width(self.doc.get_usable_width())
|
|
||||||
self.doc.add_draw_style("TLG-title",g)
|
self.doc.add_draw_style("TLG-title",g)
|
||||||
|
|
||||||
g = BaseDoc.GraphicsStyle()
|
g = BaseDoc.GraphicsStyle()
|
||||||
|
Loading…
Reference in New Issue
Block a user