From 38b9ab596f341db5bc42f2fd3995dc2fbfe349b4 Mon Sep 17 00:00:00 2001 From: Don Allingham Date: Fri, 31 Jan 2003 04:28:39 +0000 Subject: [PATCH] Drawdoc cleanup svn: r1277 --- configure | 2 +- configure.in | 2 +- gramps.spec | 2 +- src/DrawDoc.py | 14 ++++++++++ src/const.py | 2 +- src/docgen/OpenDrawDoc.py | 50 +++++++++++++++++++++++++++++++++++- src/docgen/PSDrawDoc.py | 50 +++++++++++++++++++++++++++++++++--- src/plugins/AncestorChart.py | 4 +-- src/plugins/DesGraph.py | 8 +++--- 9 files changed, 119 insertions(+), 15 deletions(-) diff --git a/configure b/configure index 87422834d..467579ddf 100755 --- a/configure +++ b/configure @@ -1567,7 +1567,7 @@ INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s" -RELEASE=rc3 +RELEASE=rc5 VERSIONSTRING=$VERSION if test x"$RELEASE" != "x" diff --git a/configure.in b/configure.in index 1b8e65243..c973579bd 100644 --- a/configure.in +++ b/configure.in @@ -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" diff --git a/gramps.spec b/gramps.spec index 7e7f5cf94..5d6b19b78 100644 --- a/gramps.spec +++ b/gramps.spec @@ -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. diff --git a/src/DrawDoc.py b/src/DrawDoc.py index 6ad62c4b3..56139b927 100644 --- a/src/DrawDoc.py +++ b/src/DrawDoc.py @@ -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 diff --git a/src/const.py b/src/const.py index d4a03c0b5..18fbe5f63 100644 --- a/src/const.py +++ b/src/const.py @@ -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 " diff --git a/src/docgen/OpenDrawDoc.py b/src/docgen/OpenDrawDoc.py index d0591a868..040c41772 100644 --- a/src/docgen/OpenDrawDoc.py +++ b/src/docgen/OpenDrawDoc.py @@ -203,7 +203,6 @@ class OpenDrawDoc(DrawDoc.DrawDoc): self.f.write('\n') self.f.write('\n') - self.f.write('\n') self.f.write('\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('\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('' % float(y)) + self.f.write('') + self.f.write('' % para_name) + self.f.write(text) + self.f.write('') + self.f.write('\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('' % float(y)) + self.f.write('\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() diff --git a/src/docgen/PSDrawDoc.py b/src/docgen/PSDrawDoc.py index 8a270d9ad..b3cb8f7e7 100644 --- a/src/docgen/PSDrawDoc.py +++ b/src/docgen/PSDrawDoc.py @@ -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) diff --git a/src/plugins/AncestorChart.py b/src/plugins/AncestorChart.py index 60aba1ee7..ba4fb63b4 100644 --- a/src/plugins/AncestorChart.py +++ b/src/plugins/AncestorChart.py @@ -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), diff --git a/src/plugins/DesGraph.py b/src/plugins/DesGraph.py index fe1cee9e1..0f00ba2fb 100644 --- a/src/plugins/DesGraph.py +++ b/src/plugins/DesGraph.py @@ -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: