Drawdoc cleanup

svn: r1277
This commit is contained in:
Don Allingham 2003-01-31 04:28:39 +00:00
parent e049fd4f13
commit 38b9ab596f
9 changed files with 119 additions and 15 deletions

2
configure vendored
View File

@ -1567,7 +1567,7 @@ INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
RELEASE=rc3
RELEASE=rc5
VERSIONSTRING=$VERSION
if test x"$RELEASE" != "x"

View File

@ -2,7 +2,7 @@ dnl Process this file with autoconf to produce a configure script.
dnl May need to run automake && aclocal first
AC_INIT(src/gramps.py)
AM_INIT_AUTOMAKE(gramps, 0.9.0)
RELEASE=rc4
RELEASE=rc5
VERSIONSTRING=$VERSION
if test x"$RELEASE" != "x"

View File

@ -1,5 +1,5 @@
%define ver 0.9.0
%define rel rc3
%define rel rc5
%define prefix /usr
Summary: Genealogical Research and Analysis Management Programming System.

View File

@ -38,13 +38,21 @@ class GraphicsStyle:
self.para_name = obj.para_name
self.shadow = obj.shadow
self.color = obj.color
self.lwidth = obj.lwidth
else:
self.height = 0
self.width = 0
self.para_name = ""
self.shadow = 0
self.lwidth = 0.5
self.color = (255,255,255)
def set_line_width(self,val):
self.lwidth = val
def get_line_width(self):
return self.lwidth
def set_height(self,val):
self.height = val
@ -140,6 +148,12 @@ class DrawDoc:
def write_at(self,style,text,x,y):
pass
def draw_bar(self,style,x1,y1,x2,y2):
pass
def draw_text(self,style,text,x1,y1):
pass
def draw_line(self,style,x1,y1,x2,y2):
pass

View File

@ -99,7 +99,7 @@ startup = 1
#
#-------------------------------------------------------------------------
progName = "GRAMPS"
version = "0.9.0-rc3"
version = "0.9.0-rc5"
copyright = "© 2001-2003 Donald N. Allingham"
authors = ["Donald N. Allingham", "David Hampton","Donald A. Peterson"]
comments = _("GRAMPS (Genealogical Research and Analysis "

View File

@ -203,7 +203,6 @@ class OpenDrawDoc(DrawDoc.DrawDoc):
self.f.write('</style:default-style>\n')
self.f.write('<style:style style:name="standard" style:family="graphics">\n')
self.f.write('<style:properties draw:stroke="solid" ')
self.f.write('svg:stroke-width="0cm" ')
self.f.write('svg:stroke-color="#000000" ')
self.f.write('draw:marker-start-width="0.3cm" ')
@ -246,6 +245,10 @@ class OpenDrawDoc(DrawDoc.DrawDoc):
self.f.write('style:parent-style-name="standard">\n')
self.f.write('<style:properties ')
self.f.write('draw:fill-color="#%02x%02x%02x" ' % style.get_color())
if style.get_line_width():
self.f.write('draw:stroke="solid" ')
else:
self.f.write('draw:stroke="none" ')
if style.get_shadow():
self.f.write('draw:shadow="visible" ')
else:
@ -420,6 +423,10 @@ class OpenDrawDoc(DrawDoc.DrawDoc):
self.f.write('</draw:page>\n')
def draw_line(self,style,x1,y1,x2,y2):
x1 = x1 + self.lmargin
x2 = x2 + self.lmargin
y1 = y1 + self.tmargin
y2 = y2 + self.tmargin
self.f.write('<draw:line draw:style="')
self.f.write(style)
self.f.write('" svg:x1="%.3fcm" ' % x1)
@ -427,7 +434,48 @@ class OpenDrawDoc(DrawDoc.DrawDoc):
self.f.write('svg:x2="%.3fcm" ' % x2)
self.f.write('svg:y2="%.3fcm"/>\n' % y2)
def draw_text(self,style,text,x,y):
x = x + self.lmargin
y = y + self.tmargin
box_style = self.draw_styles[style]
para_name = box_style.get_paragraph_style()
self.f.write('<draw:text-box draw:style-name="')
self.f.write(style)
self.f.write('" draw:layer="layout" ')
# fix this
self.f.write('svg:width="%.3fcm" ' % 5.0)
self.f.write('svg:height="%.3fcm" ' % 1.0)
self.f.write('svg:x="%.3fcm" ' % float(x))
self.f.write('svg:y="%.3fcm">' % float(y))
self.f.write('<text:p text:style-name="P1">')
self.f.write('<text:span text:style-name="T%s">' % para_name)
self.f.write(text)
self.f.write('</text:span></text:p>')
self.f.write('</draw:text-box>\n')
def draw_bar(self,style,x,y,x2,y2):
x = x + self.lmargin
x2 = x2 + self.lmargin
y = y + self.tmargin
y2 = y2 + self.tmargin
box_style = self.draw_styles[style]
para_name = box_style.get_paragraph_style()
self.f.write('<draw:rect draw:style-name="')
self.f.write(style)
self.f.write('" draw:layer="layout" ')
self.f.write('svg:width="%.3fcm" ' % float(x2-x))
self.f.write('svg:height="%.3fcm" ' % float(y2-y))
self.f.write('svg:x="%.3fcm" ' % float(x))
self.f.write('svg:y="%.3fcm">' % float(y))
self.f.write('</draw:rect>\n')
def draw_box(self,style,text,x,y):
x = x + self.lmargin
y = y + self.tmargin
box_style = self.draw_styles[style]
para_name = box_style.get_paragraph_style()

View File

@ -19,6 +19,7 @@
#
import string
import cStringIO
import Plugins
from intl import gettext as _
@ -33,7 +34,6 @@ class PSDrawDoc(DrawDoc.DrawDoc):
self.f = None
self.filename = None
self.level = 0
self.time = "0000-00-00T00:00:00"
self.page = 0
def translate(self,x,y):
@ -72,8 +72,7 @@ class PSDrawDoc(DrawDoc.DrawDoc):
else:
self.filename = filename
try:
self.f = open(self.filename,"w")
self.f = open(self.filename,"w")
self.f.write('%!PS-Adobe-3.0\n')
self.f.write('%%LanguageLevel: 2\n')
@ -111,24 +110,67 @@ class PSDrawDoc(DrawDoc.DrawDoc):
self.f.write('showpage\n')
self.f.write('%%PageTrailer\n')
def draw_text(self,style,text,x1,y1):
x1 = x1 + self.lmargin
y1 = y1 + self.tmargin
stype = self.draw_styles[style]
para_name = stype.get_paragraph_style()
p = self.style_list[para_name]
self.f.write('gsave\n')
self.f.write('%f cm %f cm moveto\n' % self.translate(x1,y1))
self.f.write(self.fontdef(p))
self.f.write('(%s) show\n' % text)
self.f.write('grestore\n')
def draw_line(self,style,x1,y1,x2,y2):
x1 = x1 + self.lmargin
x2 = x2 + self.lmargin
y1 = y1 + self.tmargin
y2 = y2 + self.tmargin
stype = self.draw_styles[style]
self.f.write('gsave\n')
self.f.write('newpath\n')
self.f.write('%f cm %f cm moveto\n' % self.translate(x1,y1))
self.f.write('%f cm %f cm lineto\n' % self.translate(x2,y2))
self.f.write('1 setlinewidth\n')
self.f.write('%d setlinewidth\n' % stype.get_line_width())
self.f.write('2 setlinecap\n')
self.f.write('stroke\n')
self.f.write('grestore\n')
def patch_text(self,text):
return text.encode('iso-8859-1')
def draw_bar(self,style,x1,y1,x2,y2):
x1 = x1 + self.lmargin
x2 = x2 + self.lmargin
y1 = y1 + self.tmargin
y2 = y2 + self.tmargin
box_type = self.draw_styles[style]
self.f.write('gsave\n')
self.f.write("%f cm %f cm moveto\n" % self.translate(x1,y1))
self.f.write("0 %f cm rlineto\n" % (y2-y1))
self.f.write("%f cm 0 rlineto\n" % (x2-x1))
self.f.write("0 %f cm rlineto\n" % (y1-y2))
self.f.write('closepath\n')
self.f.write("%d setlinewidth\n" % box_type.get_line_width())
self.f.write("stroke\n")
self.f.write('grestore\n')
def draw_box(self,style,text,x,y):
x = x + self.lmargin
y = y + self.tmargin
box_style = self.draw_styles[style]
para_name = box_style.get_paragraph_style()
p = self.style_list[para_name]
text = self.patch_text(text)
bh = box_style.get_height()
bw = box_style.get_width()
self.f.write('gsave\n')
# if box_style.get_shadow():
self.f.write('newpath\n')
self.f.write('%f cm %f cm moveto\n' % self.translate(x+0.15,y+0.15))
self.f.write('0 -%f cm rlineto\n' % bh)

View File

@ -143,11 +143,11 @@ class AncestorChart:
self.height = self.lines*pt2cm((125.0*self.font.get_size())/100.0)
self.box_width = pt2cm(self.box_width+20)
start = self.doc.get_right_margin()
start = 0
delta = (self.doc.get_usable_width() - (self.box_width + (5.0/10.0)))/3.0
uh = self.doc.get_usable_height()
ystart = self.doc.get_top_margin() - ((self.height+(3.0/10.0))/2.0)
ystart = -self.height/2.0
self.x = [start, start + delta, start + (2*delta), start + (3*delta)]
self.y = [ ystart + (uh/2.0), ystart + (uh/4.0),
ystart + 3*(uh/4.0), ystart + (uh/8.0),

View File

@ -242,10 +242,10 @@ class DescendantReport:
self.doc.start_page()
delta = self.doc.get_usable_width()/(self.maxx)
top = self.doc.get_top_margin()
bottom = self.doc.get_top_margin() + self.doc.get_usable_height()
left = self.doc.get_left_margin()
right = self.doc.get_right_margin() + self.doc.get_usable_width() - (2*_sep)
top = 0
bottom = self.doc.get_usable_height()
left = 0
right = self.doc.get_usable_width() - (2*_sep)
if plist:
for (p,x,y) in plist: