From 55c549de0a2afb8f0fd3b78f3e552c80f4805796 Mon Sep 17 00:00:00 2001 From: Alex Roitman Date: Sat, 15 Jan 2005 20:24:29 +0000 Subject: [PATCH] * src/docgen/KwordDoc.py: Register with paper capabilites. * src/docgen/PdfDoc.py: Register with paper capabilites. * src/docgen/RTFDoc.py: Register with paper capabilites. * src/const.py.in: Update copyright year. * NEWS: Update. svn: r3914 --- ChangeLog | 7 +++ NEWS | 18 ++++++++ src/const.py.in | 4 +- src/docgen/KwordDoc.py | 16 +++---- src/docgen/PdfDoc.py | 62 +++++++++++++-------------- src/docgen/RTFDoc.py | 96 +++++++++++++++++++++--------------------- 6 files changed, 112 insertions(+), 91 deletions(-) diff --git a/ChangeLog b/ChangeLog index 6f97d2c57..26f22a5fc 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,10 @@ +2005-01-15 Alex Roitman + * src/docgen/KwordDoc.py: Register with paper capabilites. + * src/docgen/PdfDoc.py: Register with paper capabilites. + * src/docgen/RTFDoc.py: Register with paper capabilites. + * src/const.py.in: Update copyright year. + * NEWS: Update. + 2005-01-14 Alex Roitman * src/plugins/GraphViz.py: Restore "Place/cause when no date" option that was available before in RelGraph; rename 'show diff --git a/NEWS b/NEWS index 03e61e918..1c8db64d5 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,21 @@ +Version 1.1.3 -- the "Splunge: this is a great idea, but possibly lousy, + and I'm not being indecisive" release +* New columns for Media and Place Views (Martin Hawlisch). +* New graphical report -- StatisticsChart (Eero Tamminen). +* Alternative .ini -based backend for storing gramps settings (replaces gconf). +* Modules providing database access and basic classes are UI-independent now. +* Improved Name handling. +* Date hadnling improvements. +* Documentation for core API can now be autogenerated (requires epydoc). +* Dramatic performance improvements for large databases. +* Spanish Date handler (Julio Sanchez). +* Cursor interface added to the database. +* Interface improvements. +* GRUMPS -- Grand Report Unification Made Possible, See! + Reports remember their options; command line reports available; + same code provides standalone, book item, and command line repotrs. +* Bug fixes. + Version 1.1.2 -- the "Confuse-a-cat" release * Recent files support (both GNOME- and Gramps-wide). * Key/value pairs for the Source objects. diff --git a/src/const.py.in b/src/const.py.in index 61ae74bc8..e69f0653f 100644 --- a/src/const.py.in +++ b/src/const.py.in @@ -3,7 +3,7 @@ # # Gramps - a GTK+/GNOME based genealogy program # -# Copyright (C) 2000-2004 Donald N. Allingham +# Copyright (C) 2000-2005 Donald N. Allingham # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -123,7 +123,7 @@ dnd_images = 1 #------------------------------------------------------------------------- progName = "GRAMPS" version = "@VERSIONSTRING@" -copyright = unicode("© 2001-2004 Donald N. Allingham","iso-8859-1") +copyright = unicode("© 2001-2005 Donald N. Allingham","iso-8859-1") comments = _("GRAMPS (Genealogical Research and Analysis " "Management Programming System) is a personal " "genealogy program.") diff --git a/src/docgen/KwordDoc.py b/src/docgen/KwordDoc.py index cabf6cfc1..6598679e3 100644 --- a/src/docgen/KwordDoc.py +++ b/src/docgen/KwordDoc.py @@ -1,7 +1,7 @@ # # Gramps - a GTK+/GNOME based genealogy program # -# Copyright (C) 2000-2004 Donald N. Allingham +# Copyright (C) 2000-2005 Donald N. Allingham # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -24,7 +24,6 @@ import BaseDoc from latin_utf8 import latin_to_utf8 import time -import string import cStringIO import gzip import os @@ -290,8 +289,8 @@ class KwordDoc(BaseDoc.BaseDoc): def end_paragraph(self): if self.frameset_flg == 0: - self.f.write('\n') - self.frameset_flg= 1 + self.f.write('\n') + self.frameset_flg= 1 if self.bold_start != 0 and self.bold_stop != len(self.text): txt = '\n\n\n' % self.font_face @@ -454,7 +453,7 @@ class KwordDoc(BaseDoc.BaseDoc): for line in text.split('\n\n'): self.start_paragraph(style_name) line = line.replace('\n',' ') - line = string.join(string.split(line)) + line = ' '.join(line.split()) self.write_text(line) self.end_paragraph() @@ -477,7 +476,7 @@ class KwordDoc(BaseDoc.BaseDoc): text = text.replace('</super>','') self.format_list.append(txt) - self.text = self.text + text + self.text = self.text + text #------------------------------------------------------------------------ # @@ -495,7 +494,6 @@ try: print_label=_("Open in %s") % prog[1] else: print_label=None - PluginMgr.register_text_doc(mtype, KwordDoc, 1, 0, 1, ".kwd", print_label) + PluginMgr.register_text_doc(mtype, KwordDoc, 1, 1, 1, ".kwd", print_label) except: - PluginMgr.register_text_doc(_('KWord'), KwordDoc, 1, 0, 1, ".kwd", print_label) - + PluginMgr.register_text_doc(_('KWord'), KwordDoc, 1, 1, 1, ".kwd", print_label) diff --git a/src/docgen/PdfDoc.py b/src/docgen/PdfDoc.py index bb66a0718..82497bcd0 100644 --- a/src/docgen/PdfDoc.py +++ b/src/docgen/PdfDoc.py @@ -1,7 +1,7 @@ # # Gramps - a GTK+/GNOME based genealogy program # -# Copyright (C) 2000-2004 Donald N. Allingham +# Copyright (C) 2000-2005 Donald N. Allingham # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -73,7 +73,7 @@ class GrampsDocTemplate(BaseDocTemplate): def build(self,flowables): """Override the default build routine, to recalculate for any changes in the document (margins, etc.)""" - self._calc() + self._calc() BaseDocTemplate.build(self,flowables) def enc(s): @@ -99,7 +99,7 @@ class PdfDoc(BaseDoc.BaseDoc): self.pagesize = (self.width*cm,self.height*cm) self.doc = GrampsDocTemplate(self.filename, - pagesize=self.pagesize, + pagesize=self.pagesize, allowSplitting=1, _pageBreakQuick=0, leftMargin=self.lmargin*cm, @@ -119,7 +119,7 @@ class PdfDoc(BaseDoc.BaseDoc): style = self.style_list[style_name] font = style.get_font() - pdf_style = reportlab.lib.styles.ParagraphStyle(name=style_name) + pdf_style = reportlab.lib.styles.ParagraphStyle(name=style_name) pdf_style.fontSize = font.get_size() pdf_style.bulletFontSize = font.get_size() @@ -156,22 +156,22 @@ class PdfDoc(BaseDoc.BaseDoc): pdf_style.firstLineIndent = first pdf_style.bulletIndent = first - align = style.get_alignment() + align = style.get_alignment() if align == BaseDoc.PARA_ALIGN_RIGHT: - pdf_style.alignment = TA_RIGHT + pdf_style.alignment = TA_RIGHT elif align == BaseDoc.PARA_ALIGN_LEFT: - pdf_style.alignment = TA_LEFT + pdf_style.alignment = TA_LEFT elif align == BaseDoc.PARA_ALIGN_CENTER: - pdf_style.alignment = TA_CENTER + pdf_style.alignment = TA_CENTER else: - pdf_style.alignment = TA_JUSTIFY + pdf_style.alignment = TA_JUSTIFY pdf_style.spaceBefore = style.get_padding()*cm pdf_style.spaceAfter = style.get_padding()*cm pdf_style.textColor = make_color(font.get_color()) - self.pdfstyles[style_name] = pdf_style + self.pdfstyles[style_name] = pdf_style - self.story = [] - self.in_table = 0 + self.story = [] + self.in_table = 0 def close(self): try: @@ -204,7 +204,7 @@ class PdfDoc(BaseDoc.BaseDoc): def end_paragraph(self): if self.in_table == 0 and self.image == 0: - self.story.append(Paragraph(enc(self.text),self.current_para)) + self.story.append(Paragraph(enc(self.text),self.current_para)) else: self.image = 0 @@ -229,23 +229,23 @@ class PdfDoc(BaseDoc.BaseDoc): self.cur_row = [] self.table_data = [] - self.tblstyle = [] + self.tblstyle = [] self.cur_table_cols = [] width = float(self.cur_table.get_width()/100.0) * self.get_usable_width() - for val in range(self.cur_table.get_columns()): + for val in range(self.cur_table.get_columns()): percent = float(self.cur_table.get_column_width(val))/100.0 self.cur_table_cols.append(int(width * percent * cm)) def end_table(self): ts = reportlab.platypus.tables.TableStyle(self.tblstyle) - tbl = reportlab.platypus.tables.Table(data=self.table_data, + tbl = reportlab.platypus.tables.Table(data=self.table_data, colWidths=self.cur_table_cols, style=ts) - self.story.append(tbl) + self.story.append(tbl) self.in_table = 0 def start_row(self): - self.row = self.row + 1 + self.row = self.row + 1 self.col = 0 self.cur_row = [] @@ -265,7 +265,7 @@ class PdfDoc(BaseDoc.BaseDoc): for val in range(1,self.span): self.cur_row.append("") - p = self.my_para + p = self.my_para f = p.get_font() if f.get_type_face() == BaseDoc.FONT_SANS_SERIF: if f.get_bold(): @@ -338,7 +338,7 @@ class PdfDoc(BaseDoc.BaseDoc): text = text.replace('</super>','') if self.in_table == 0: - if format == 1: + if format == 1: text = '%s' % text.replace('\t',' '*8) self.story.append(XPreformatted(text,current_para)) elif format == 0: @@ -408,15 +408,15 @@ class PdfDoc(BaseDoc.BaseDoc): def draw_box(self,style,text,x,y): y = self.get_usable_height() - y - box_style = self.draw_styles[style] - para_name = box_style.get_paragraph_style() - p = self.style_list[para_name] + box_style = self.draw_styles[style] + para_name = box_style.get_paragraph_style() + p = self.style_list[para_name] - w = box_style.get_width()*cm + w = box_style.get_width()*cm h = box_style.get_height()*cm sspace = box_style.get_shadow_space() - if box_style.get_shadow(): + if box_style.get_shadow(): col = make_color((0xc0,0xc0,0xc0)) r = reportlab.graphics.shapes.Rect((x+sspace)*cm, (y-sspace)*cm-h, @@ -437,7 +437,7 @@ class PdfDoc(BaseDoc.BaseDoc): size = p.get_font().get_size() x = x + sspace - if text != "": + if text != "": lines = text.split('\n') self.left_print(lines,p.get_font(),x*cm,y*cm - size) @@ -445,7 +445,7 @@ class PdfDoc(BaseDoc.BaseDoc): stype = self.draw_styles[style] pname = stype.get_paragraph_style() p = self.style_list[pname] - font = p.get_font() + font = p.get_font() size = font.get_size() y = (self.get_usable_height()*cm)-(y*cm) sc = make_color(font.get_color()) @@ -481,7 +481,7 @@ class PdfDoc(BaseDoc.BaseDoc): stype = self.draw_styles[style] pname = stype.get_paragraph_style() p = self.style_list[pname] - font = p.get_font() + font = p.get_font() size = font.get_size() yt = (self.get_usable_height()*cm) - (y*cm) @@ -508,7 +508,7 @@ class PdfDoc(BaseDoc.BaseDoc): stype = self.draw_styles[style] pname = stype.get_paragraph_style() p = self.style_list[pname] - font = p.get_font() + font = p.get_font() yt = (self.get_usable_height()*cm) - (y*cm) fnt = self.pdf_set_font(font) @@ -589,10 +589,10 @@ try: print_label=_("Open in %s") % mprog[1] else: print_label=None - PluginMgr.register_text_doc(mtype, PdfDoc, 1, 0, 1, ".pdf", print_label) + PluginMgr.register_text_doc(mtype, PdfDoc, 1, 1, 1, ".pdf", print_label) PluginMgr.register_draw_doc(mtype, PdfDoc, 1, 1, ".pdf", print_label) PluginMgr.register_book_doc(mtype,classref=PdfDoc,table=1,paper=1,style=1,ext=".pdf") except: - PluginMgr.register_text_doc(_('PDF document'), PdfDoc, 1, 0, 1,".pdf", None) + PluginMgr.register_text_doc(_('PDF document'), PdfDoc, 1, 1, 1,".pdf", None) PluginMgr.register_draw_doc(_('PDF document'), PdfDoc, 1, 1, ".pdf", None) PluginMgr.register_book_doc(name=_("PDF document"),classref=PdfDoc,table=1,paper=1,style=1,ext=".pdf") diff --git a/src/docgen/RTFDoc.py b/src/docgen/RTFDoc.py index 6c5db73a5..fb408ca51 100644 --- a/src/docgen/RTFDoc.py +++ b/src/docgen/RTFDoc.py @@ -1,7 +1,7 @@ # # Gramps - a GTK+/GNOME based genealogy program # -# Copyright (C) 2000-2004 Donald N. Allingham +# Copyright (C) 2000-2005 Donald N. Allingham # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -25,9 +25,8 @@ # python modules # #------------------------------------------------------------------------ -import string import os -import GrampsMime +from gettext import gettext as _ #------------------------------------------------------------------------ # @@ -38,8 +37,7 @@ import BaseDoc import PluginMgr import ImgManip import Errors - -from gettext import gettext as _ +import GrampsMime #------------------------------------------------------------------------ # @@ -114,8 +112,8 @@ class RTFDoc(BaseDoc.BaseDoc): self.f.write('\\margt%d' % twips(self.tmargin)) self.f.write('\\margb%d' % twips(self.bmargin)) self.f.write('\\widowctl\n') - self.in_table = 0 - self.text = "" + self.in_table = 0 + self.text = "" #-------------------------------------------------------------------- # @@ -154,7 +152,7 @@ class RTFDoc(BaseDoc.BaseDoc): self.opened = 0 p = self.style_list[style_name] - # build font information + # build font information f = p.get_font() size = f.get_size()*2 @@ -171,9 +169,9 @@ class RTFDoc(BaseDoc.BaseDoc): if f.get_italic(): self.font_type = self.font_type + "\\i" - # build paragraph information + # build paragraph information - if not self.in_table: + if not self.in_table: self.f.write('\\pard') if p.get_alignment() == BaseDoc.PARA_ALIGN_RIGHT: self.f.write('\\qr') @@ -218,7 +216,7 @@ class RTFDoc(BaseDoc.BaseDoc): # #-------------------------------------------------------------------- def end_paragraph(self): - if not self.in_table: + if not self.in_table: self.f.write(self.text) if self.opened: self.f.write('}') @@ -259,8 +257,8 @@ class RTFDoc(BaseDoc.BaseDoc): # #-------------------------------------------------------------------- def start_table(self,name,style_name): - self.in_table = 1 - self.tbl_style = self.table_styles[style_name] + self.in_table = 1 + self.tbl_style = self.table_styles[style_name] #-------------------------------------------------------------------- # @@ -268,7 +266,7 @@ class RTFDoc(BaseDoc.BaseDoc): # #-------------------------------------------------------------------- def end_table(self): - self.in_table = 0 + self.in_table = 0 #-------------------------------------------------------------------- # @@ -280,10 +278,10 @@ class RTFDoc(BaseDoc.BaseDoc): #-------------------------------------------------------------------- def start_row(self): self.contents = [] - self.cell = 0 - self.prev = 0 - self.cell_percent = 0.0 - self.f.write('\\trowd\n') + self.cell = 0 + self.prev = 0 + self.cell_percent = 0.0 + self.f.write('\\trowd\n') #-------------------------------------------------------------------- # @@ -292,11 +290,11 @@ class RTFDoc(BaseDoc.BaseDoc): # #-------------------------------------------------------------------- def end_row(self): - self.f.write('{') - for line in self.contents: - self.f.write(line) + self.f.write('{') + for line in self.contents: + self.f.write(line) self.f.write('\\cell ') - self.f.write('}\\pard\\intbl\\row\n') + self.f.write('}\\pard\\intbl\\row\n') #-------------------------------------------------------------------- # @@ -308,22 +306,22 @@ class RTFDoc(BaseDoc.BaseDoc): # #-------------------------------------------------------------------- def start_cell(self,style_name,span=1): - s = self.cell_styles[style_name] - self.remain = span -1 - if s.get_top_border(): - self.f.write('\\clbrdrt\\brdrs\\brdrw10\n') - if s.get_bottom_border(): - self.f.write('\\clbrdrb\\brdrs\\brdrw10\n') - if s.get_left_border(): - self.f.write('\\clbrdrl\\brdrs\\brdrw10\n') - if s.get_right_border(): - self.f.write('\\clbrdrr\\brdrs\\brdrw10\n') - table_width = float(self.get_usable_width()) - for cell in range(self.cell,self.cell+span): - self.cell_percent = self.cell_percent + float(self.tbl_style.get_column_width(cell)) - cell_width = twips((table_width * self.cell_percent)/100.0) - self.f.write('\\cellx%d\\pard\intbl\n' % cell_width) - self.cell = self.cell+1 + s = self.cell_styles[style_name] + self.remain = span -1 + if s.get_top_border(): + self.f.write('\\clbrdrt\\brdrs\\brdrw10\n') + if s.get_bottom_border(): + self.f.write('\\clbrdrb\\brdrs\\brdrw10\n') + if s.get_left_border(): + self.f.write('\\clbrdrl\\brdrs\\brdrw10\n') + if s.get_right_border(): + self.f.write('\\clbrdrr\\brdrs\\brdrw10\n') + table_width = float(self.get_usable_width()) + for cell in range(self.cell,self.cell+span): + self.cell_percent = self.cell_percent + float(self.tbl_style.get_column_width(cell)) + cell_width = twips((table_width * self.cell_percent)/100.0) + self.f.write('\\cellx%d\\pard\intbl\n' % cell_width) + self.cell = self.cell+1 #-------------------------------------------------------------------- # @@ -365,15 +363,15 @@ class RTFDoc(BaseDoc.BaseDoc): act_width = twips(act_width) act_height = twips(act_height) - self.f.write('{\*\shppict{\\pict\\jpegblip') + self.f.write('{\*\shppict{\\pict\\jpegblip') self.f.write('\\picwgoal%d\\pichgoal%d\n' % (act_width,act_height)) - index = 1 - for i in buf: - self.f.write('%02x' % ord(i)) - if index%32==0: - self.f.write('\n') - index = index+1 - self.f.write('}}\\par\n') + index = 1 + for i in buf: + self.f.write('%02x' % ord(i)) + if index%32==0: + self.f.write('\n') + index = index+1 + self.f.write('}}\\par\n') def write_note(self,text,format,style_name): if format == 1: @@ -385,7 +383,7 @@ class RTFDoc(BaseDoc.BaseDoc): for line in text.split('\n\n'): self.start_paragraph(style_name) line = line.replace('\n',' ') - line = string.join(string.split(line)) + line = ' '.join(line.split()) self.write_text(line) self.end_paragraph() @@ -429,6 +427,6 @@ try: print_label=_("Open in %s") % mprog[1] else: print_label=None - PluginMgr.register_text_doc(mtype, RTFDoc, 1, 0, 1, ".rtf", print_label) + PluginMgr.register_text_doc(mtype, RTFDoc, 1, 1, 1, ".rtf", print_label) except: - PluginMgr.register_text_doc(_('RTF document'), RTFDoc, 1, 0, 1, ".rtf", None) + PluginMgr.register_text_doc(_('RTF document'), RTFDoc, 1, 1, 1, ".rtf", None)