* 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
This commit is contained in:
parent
f89ee71f28
commit
55c549de0a
@ -1,3 +1,10 @@
|
|||||||
|
2005-01-15 Alex Roitman <shura@alex.neuro.umn.edu>
|
||||||
|
* 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 <shura@alex.neuro.umn.edu>
|
2005-01-14 Alex Roitman <shura@alex.neuro.umn.edu>
|
||||||
* src/plugins/GraphViz.py: Restore "Place/cause when no date"
|
* src/plugins/GraphViz.py: Restore "Place/cause when no date"
|
||||||
option that was available before in RelGraph; rename 'show
|
option that was available before in RelGraph; rename 'show
|
||||||
|
18
NEWS
18
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
|
Version 1.1.2 -- the "Confuse-a-cat" release
|
||||||
* Recent files support (both GNOME- and Gramps-wide).
|
* Recent files support (both GNOME- and Gramps-wide).
|
||||||
* Key/value pairs for the Source objects.
|
* Key/value pairs for the Source objects.
|
||||||
|
@ -3,7 +3,7 @@
|
|||||||
#
|
#
|
||||||
# Gramps - a GTK+/GNOME based genealogy program
|
# 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
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
@ -123,7 +123,7 @@ dnd_images = 1
|
|||||||
#-------------------------------------------------------------------------
|
#-------------------------------------------------------------------------
|
||||||
progName = "GRAMPS"
|
progName = "GRAMPS"
|
||||||
version = "@VERSIONSTRING@"
|
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 "
|
comments = _("GRAMPS (Genealogical Research and Analysis "
|
||||||
"Management Programming System) is a personal "
|
"Management Programming System) is a personal "
|
||||||
"genealogy program.")
|
"genealogy program.")
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# Gramps - a GTK+/GNOME based genealogy program
|
# 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
|
# 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
|
# 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
|
from latin_utf8 import latin_to_utf8
|
||||||
|
|
||||||
import time
|
import time
|
||||||
import string
|
|
||||||
import cStringIO
|
import cStringIO
|
||||||
import gzip
|
import gzip
|
||||||
import os
|
import os
|
||||||
@ -290,8 +289,8 @@ class KwordDoc(BaseDoc.BaseDoc):
|
|||||||
|
|
||||||
def end_paragraph(self):
|
def end_paragraph(self):
|
||||||
if self.frameset_flg == 0:
|
if self.frameset_flg == 0:
|
||||||
self.f.write('<FRAMESET>\n')
|
self.f.write('<FRAMESET>\n')
|
||||||
self.frameset_flg= 1
|
self.frameset_flg= 1
|
||||||
|
|
||||||
if self.bold_start != 0 and self.bold_stop != len(self.text):
|
if self.bold_start != 0 and self.bold_stop != len(self.text):
|
||||||
txt = '<FORMAT>\n<FONT name="%s"/>\n</FORMAT>\n' % self.font_face
|
txt = '<FORMAT>\n<FONT name="%s"/>\n</FORMAT>\n' % self.font_face
|
||||||
@ -454,7 +453,7 @@ class KwordDoc(BaseDoc.BaseDoc):
|
|||||||
for line in text.split('\n\n'):
|
for line in text.split('\n\n'):
|
||||||
self.start_paragraph(style_name)
|
self.start_paragraph(style_name)
|
||||||
line = line.replace('\n',' ')
|
line = line.replace('\n',' ')
|
||||||
line = string.join(string.split(line))
|
line = ' '.join(line.split())
|
||||||
self.write_text(line)
|
self.write_text(line)
|
||||||
self.end_paragraph()
|
self.end_paragraph()
|
||||||
|
|
||||||
@ -477,7 +476,7 @@ class KwordDoc(BaseDoc.BaseDoc):
|
|||||||
text = text.replace('</super>','')
|
text = text.replace('</super>','')
|
||||||
self.format_list.append(txt)
|
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]
|
print_label=_("Open in %s") % prog[1]
|
||||||
else:
|
else:
|
||||||
print_label=None
|
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:
|
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)
|
||||||
|
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# Gramps - a GTK+/GNOME based genealogy program
|
# 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
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
@ -73,7 +73,7 @@ class GrampsDocTemplate(BaseDocTemplate):
|
|||||||
def build(self,flowables):
|
def build(self,flowables):
|
||||||
"""Override the default build routine, to recalculate
|
"""Override the default build routine, to recalculate
|
||||||
for any changes in the document (margins, etc.)"""
|
for any changes in the document (margins, etc.)"""
|
||||||
self._calc()
|
self._calc()
|
||||||
BaseDocTemplate.build(self,flowables)
|
BaseDocTemplate.build(self,flowables)
|
||||||
|
|
||||||
def enc(s):
|
def enc(s):
|
||||||
@ -99,7 +99,7 @@ class PdfDoc(BaseDoc.BaseDoc):
|
|||||||
self.pagesize = (self.width*cm,self.height*cm)
|
self.pagesize = (self.width*cm,self.height*cm)
|
||||||
|
|
||||||
self.doc = GrampsDocTemplate(self.filename,
|
self.doc = GrampsDocTemplate(self.filename,
|
||||||
pagesize=self.pagesize,
|
pagesize=self.pagesize,
|
||||||
allowSplitting=1,
|
allowSplitting=1,
|
||||||
_pageBreakQuick=0,
|
_pageBreakQuick=0,
|
||||||
leftMargin=self.lmargin*cm,
|
leftMargin=self.lmargin*cm,
|
||||||
@ -119,7 +119,7 @@ class PdfDoc(BaseDoc.BaseDoc):
|
|||||||
style = self.style_list[style_name]
|
style = self.style_list[style_name]
|
||||||
font = style.get_font()
|
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.fontSize = font.get_size()
|
||||||
pdf_style.bulletFontSize = font.get_size()
|
pdf_style.bulletFontSize = font.get_size()
|
||||||
|
|
||||||
@ -156,22 +156,22 @@ class PdfDoc(BaseDoc.BaseDoc):
|
|||||||
pdf_style.firstLineIndent = first
|
pdf_style.firstLineIndent = first
|
||||||
pdf_style.bulletIndent = first
|
pdf_style.bulletIndent = first
|
||||||
|
|
||||||
align = style.get_alignment()
|
align = style.get_alignment()
|
||||||
if align == BaseDoc.PARA_ALIGN_RIGHT:
|
if align == BaseDoc.PARA_ALIGN_RIGHT:
|
||||||
pdf_style.alignment = TA_RIGHT
|
pdf_style.alignment = TA_RIGHT
|
||||||
elif align == BaseDoc.PARA_ALIGN_LEFT:
|
elif align == BaseDoc.PARA_ALIGN_LEFT:
|
||||||
pdf_style.alignment = TA_LEFT
|
pdf_style.alignment = TA_LEFT
|
||||||
elif align == BaseDoc.PARA_ALIGN_CENTER:
|
elif align == BaseDoc.PARA_ALIGN_CENTER:
|
||||||
pdf_style.alignment = TA_CENTER
|
pdf_style.alignment = TA_CENTER
|
||||||
else:
|
else:
|
||||||
pdf_style.alignment = TA_JUSTIFY
|
pdf_style.alignment = TA_JUSTIFY
|
||||||
pdf_style.spaceBefore = style.get_padding()*cm
|
pdf_style.spaceBefore = style.get_padding()*cm
|
||||||
pdf_style.spaceAfter = style.get_padding()*cm
|
pdf_style.spaceAfter = style.get_padding()*cm
|
||||||
pdf_style.textColor = make_color(font.get_color())
|
pdf_style.textColor = make_color(font.get_color())
|
||||||
self.pdfstyles[style_name] = pdf_style
|
self.pdfstyles[style_name] = pdf_style
|
||||||
|
|
||||||
self.story = []
|
self.story = []
|
||||||
self.in_table = 0
|
self.in_table = 0
|
||||||
|
|
||||||
def close(self):
|
def close(self):
|
||||||
try:
|
try:
|
||||||
@ -204,7 +204,7 @@ class PdfDoc(BaseDoc.BaseDoc):
|
|||||||
|
|
||||||
def end_paragraph(self):
|
def end_paragraph(self):
|
||||||
if self.in_table == 0 and self.image == 0:
|
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:
|
else:
|
||||||
self.image = 0
|
self.image = 0
|
||||||
|
|
||||||
@ -229,23 +229,23 @@ class PdfDoc(BaseDoc.BaseDoc):
|
|||||||
self.cur_row = []
|
self.cur_row = []
|
||||||
self.table_data = []
|
self.table_data = []
|
||||||
|
|
||||||
self.tblstyle = []
|
self.tblstyle = []
|
||||||
self.cur_table_cols = []
|
self.cur_table_cols = []
|
||||||
width = float(self.cur_table.get_width()/100.0) * self.get_usable_width()
|
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
|
percent = float(self.cur_table.get_column_width(val))/100.0
|
||||||
self.cur_table_cols.append(int(width * percent * cm))
|
self.cur_table_cols.append(int(width * percent * cm))
|
||||||
|
|
||||||
def end_table(self):
|
def end_table(self):
|
||||||
ts = reportlab.platypus.tables.TableStyle(self.tblstyle)
|
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,
|
colWidths=self.cur_table_cols,
|
||||||
style=ts)
|
style=ts)
|
||||||
self.story.append(tbl)
|
self.story.append(tbl)
|
||||||
self.in_table = 0
|
self.in_table = 0
|
||||||
|
|
||||||
def start_row(self):
|
def start_row(self):
|
||||||
self.row = self.row + 1
|
self.row = self.row + 1
|
||||||
self.col = 0
|
self.col = 0
|
||||||
self.cur_row = []
|
self.cur_row = []
|
||||||
|
|
||||||
@ -265,7 +265,7 @@ class PdfDoc(BaseDoc.BaseDoc):
|
|||||||
for val in range(1,self.span):
|
for val in range(1,self.span):
|
||||||
self.cur_row.append("")
|
self.cur_row.append("")
|
||||||
|
|
||||||
p = self.my_para
|
p = self.my_para
|
||||||
f = p.get_font()
|
f = p.get_font()
|
||||||
if f.get_type_face() == BaseDoc.FONT_SANS_SERIF:
|
if f.get_type_face() == BaseDoc.FONT_SANS_SERIF:
|
||||||
if f.get_bold():
|
if f.get_bold():
|
||||||
@ -338,7 +338,7 @@ class PdfDoc(BaseDoc.BaseDoc):
|
|||||||
text = text.replace('</super>','</super></font>')
|
text = text.replace('</super>','</super></font>')
|
||||||
|
|
||||||
if self.in_table == 0:
|
if self.in_table == 0:
|
||||||
if format == 1:
|
if format == 1:
|
||||||
text = '<para firstLineIndent="0" fontname="Courier">%s</para>' % text.replace('\t',' '*8)
|
text = '<para firstLineIndent="0" fontname="Courier">%s</para>' % text.replace('\t',' '*8)
|
||||||
self.story.append(XPreformatted(text,current_para))
|
self.story.append(XPreformatted(text,current_para))
|
||||||
elif format == 0:
|
elif format == 0:
|
||||||
@ -408,15 +408,15 @@ class PdfDoc(BaseDoc.BaseDoc):
|
|||||||
def draw_box(self,style,text,x,y):
|
def draw_box(self,style,text,x,y):
|
||||||
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
|
w = box_style.get_width()*cm
|
||||||
h = box_style.get_height()*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,
|
||||||
@ -437,7 +437,7 @@ class PdfDoc(BaseDoc.BaseDoc):
|
|||||||
size = p.get_font().get_size()
|
size = p.get_font().get_size()
|
||||||
|
|
||||||
x = x + sspace
|
x = x + sspace
|
||||||
if text != "":
|
if text != "":
|
||||||
lines = text.split('\n')
|
lines = text.split('\n')
|
||||||
self.left_print(lines,p.get_font(),x*cm,y*cm - size)
|
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]
|
stype = self.draw_styles[style]
|
||||||
pname = stype.get_paragraph_style()
|
pname = stype.get_paragraph_style()
|
||||||
p = self.style_list[pname]
|
p = self.style_list[pname]
|
||||||
font = p.get_font()
|
font = p.get_font()
|
||||||
size = font.get_size()
|
size = font.get_size()
|
||||||
y = (self.get_usable_height()*cm)-(y*cm)
|
y = (self.get_usable_height()*cm)-(y*cm)
|
||||||
sc = make_color(font.get_color())
|
sc = make_color(font.get_color())
|
||||||
@ -481,7 +481,7 @@ class PdfDoc(BaseDoc.BaseDoc):
|
|||||||
stype = self.draw_styles[style]
|
stype = self.draw_styles[style]
|
||||||
pname = stype.get_paragraph_style()
|
pname = stype.get_paragraph_style()
|
||||||
p = self.style_list[pname]
|
p = self.style_list[pname]
|
||||||
font = p.get_font()
|
font = p.get_font()
|
||||||
size = font.get_size()
|
size = font.get_size()
|
||||||
yt = (self.get_usable_height()*cm) - (y*cm)
|
yt = (self.get_usable_height()*cm) - (y*cm)
|
||||||
|
|
||||||
@ -508,7 +508,7 @@ class PdfDoc(BaseDoc.BaseDoc):
|
|||||||
stype = self.draw_styles[style]
|
stype = self.draw_styles[style]
|
||||||
pname = stype.get_paragraph_style()
|
pname = stype.get_paragraph_style()
|
||||||
p = self.style_list[pname]
|
p = self.style_list[pname]
|
||||||
font = p.get_font()
|
font = p.get_font()
|
||||||
yt = (self.get_usable_height()*cm) - (y*cm)
|
yt = (self.get_usable_height()*cm) - (y*cm)
|
||||||
|
|
||||||
fnt = self.pdf_set_font(font)
|
fnt = self.pdf_set_font(font)
|
||||||
@ -589,10 +589,10 @@ try:
|
|||||||
print_label=_("Open in %s") % mprog[1]
|
print_label=_("Open in %s") % mprog[1]
|
||||||
else:
|
else:
|
||||||
print_label=None
|
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_draw_doc(mtype, PdfDoc, 1, 1, ".pdf", print_label)
|
||||||
PluginMgr.register_book_doc(mtype,classref=PdfDoc,table=1,paper=1,style=1,ext=".pdf")
|
PluginMgr.register_book_doc(mtype,classref=PdfDoc,table=1,paper=1,style=1,ext=".pdf")
|
||||||
except:
|
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_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")
|
PluginMgr.register_book_doc(name=_("PDF document"),classref=PdfDoc,table=1,paper=1,style=1,ext=".pdf")
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
#
|
#
|
||||||
# Gramps - a GTK+/GNOME based genealogy program
|
# 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
|
# 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
|
# it under the terms of the GNU General Public License as published by
|
||||||
@ -25,9 +25,8 @@
|
|||||||
# python modules
|
# python modules
|
||||||
#
|
#
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
import string
|
|
||||||
import os
|
import os
|
||||||
import GrampsMime
|
from gettext import gettext as _
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -38,8 +37,7 @@ import BaseDoc
|
|||||||
import PluginMgr
|
import PluginMgr
|
||||||
import ImgManip
|
import ImgManip
|
||||||
import Errors
|
import Errors
|
||||||
|
import GrampsMime
|
||||||
from gettext import gettext as _
|
|
||||||
|
|
||||||
#------------------------------------------------------------------------
|
#------------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -114,8 +112,8 @@ class RTFDoc(BaseDoc.BaseDoc):
|
|||||||
self.f.write('\\margt%d' % twips(self.tmargin))
|
self.f.write('\\margt%d' % twips(self.tmargin))
|
||||||
self.f.write('\\margb%d' % twips(self.bmargin))
|
self.f.write('\\margb%d' % twips(self.bmargin))
|
||||||
self.f.write('\\widowctl\n')
|
self.f.write('\\widowctl\n')
|
||||||
self.in_table = 0
|
self.in_table = 0
|
||||||
self.text = ""
|
self.text = ""
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -154,7 +152,7 @@ class RTFDoc(BaseDoc.BaseDoc):
|
|||||||
self.opened = 0
|
self.opened = 0
|
||||||
p = self.style_list[style_name]
|
p = self.style_list[style_name]
|
||||||
|
|
||||||
# build font information
|
# build font information
|
||||||
|
|
||||||
f = p.get_font()
|
f = p.get_font()
|
||||||
size = f.get_size()*2
|
size = f.get_size()*2
|
||||||
@ -171,9 +169,9 @@ class RTFDoc(BaseDoc.BaseDoc):
|
|||||||
if f.get_italic():
|
if f.get_italic():
|
||||||
self.font_type = self.font_type + "\\i"
|
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')
|
self.f.write('\\pard')
|
||||||
if p.get_alignment() == BaseDoc.PARA_ALIGN_RIGHT:
|
if p.get_alignment() == BaseDoc.PARA_ALIGN_RIGHT:
|
||||||
self.f.write('\\qr')
|
self.f.write('\\qr')
|
||||||
@ -218,7 +216,7 @@ class RTFDoc(BaseDoc.BaseDoc):
|
|||||||
#
|
#
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
def end_paragraph(self):
|
def end_paragraph(self):
|
||||||
if not self.in_table:
|
if not self.in_table:
|
||||||
self.f.write(self.text)
|
self.f.write(self.text)
|
||||||
if self.opened:
|
if self.opened:
|
||||||
self.f.write('}')
|
self.f.write('}')
|
||||||
@ -259,8 +257,8 @@ class RTFDoc(BaseDoc.BaseDoc):
|
|||||||
#
|
#
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
def start_table(self,name,style_name):
|
def start_table(self,name,style_name):
|
||||||
self.in_table = 1
|
self.in_table = 1
|
||||||
self.tbl_style = self.table_styles[style_name]
|
self.tbl_style = self.table_styles[style_name]
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -268,7 +266,7 @@ class RTFDoc(BaseDoc.BaseDoc):
|
|||||||
#
|
#
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
def end_table(self):
|
def end_table(self):
|
||||||
self.in_table = 0
|
self.in_table = 0
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -280,10 +278,10 @@ class RTFDoc(BaseDoc.BaseDoc):
|
|||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
def start_row(self):
|
def start_row(self):
|
||||||
self.contents = []
|
self.contents = []
|
||||||
self.cell = 0
|
self.cell = 0
|
||||||
self.prev = 0
|
self.prev = 0
|
||||||
self.cell_percent = 0.0
|
self.cell_percent = 0.0
|
||||||
self.f.write('\\trowd\n')
|
self.f.write('\\trowd\n')
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -292,11 +290,11 @@ class RTFDoc(BaseDoc.BaseDoc):
|
|||||||
#
|
#
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
def end_row(self):
|
def end_row(self):
|
||||||
self.f.write('{')
|
self.f.write('{')
|
||||||
for line in self.contents:
|
for line in self.contents:
|
||||||
self.f.write(line)
|
self.f.write(line)
|
||||||
self.f.write('\\cell ')
|
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):
|
def start_cell(self,style_name,span=1):
|
||||||
s = self.cell_styles[style_name]
|
s = self.cell_styles[style_name]
|
||||||
self.remain = span -1
|
self.remain = span -1
|
||||||
if s.get_top_border():
|
if s.get_top_border():
|
||||||
self.f.write('\\clbrdrt\\brdrs\\brdrw10\n')
|
self.f.write('\\clbrdrt\\brdrs\\brdrw10\n')
|
||||||
if s.get_bottom_border():
|
if s.get_bottom_border():
|
||||||
self.f.write('\\clbrdrb\\brdrs\\brdrw10\n')
|
self.f.write('\\clbrdrb\\brdrs\\brdrw10\n')
|
||||||
if s.get_left_border():
|
if s.get_left_border():
|
||||||
self.f.write('\\clbrdrl\\brdrs\\brdrw10\n')
|
self.f.write('\\clbrdrl\\brdrs\\brdrw10\n')
|
||||||
if s.get_right_border():
|
if s.get_right_border():
|
||||||
self.f.write('\\clbrdrr\\brdrs\\brdrw10\n')
|
self.f.write('\\clbrdrr\\brdrs\\brdrw10\n')
|
||||||
table_width = float(self.get_usable_width())
|
table_width = float(self.get_usable_width())
|
||||||
for cell in range(self.cell,self.cell+span):
|
for cell in range(self.cell,self.cell+span):
|
||||||
self.cell_percent = self.cell_percent + float(self.tbl_style.get_column_width(cell))
|
self.cell_percent = self.cell_percent + float(self.tbl_style.get_column_width(cell))
|
||||||
cell_width = twips((table_width * self.cell_percent)/100.0)
|
cell_width = twips((table_width * self.cell_percent)/100.0)
|
||||||
self.f.write('\\cellx%d\\pard\intbl\n' % cell_width)
|
self.f.write('\\cellx%d\\pard\intbl\n' % cell_width)
|
||||||
self.cell = self.cell+1
|
self.cell = self.cell+1
|
||||||
|
|
||||||
#--------------------------------------------------------------------
|
#--------------------------------------------------------------------
|
||||||
#
|
#
|
||||||
@ -365,15 +363,15 @@ class RTFDoc(BaseDoc.BaseDoc):
|
|||||||
act_width = twips(act_width)
|
act_width = twips(act_width)
|
||||||
act_height = twips(act_height)
|
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))
|
self.f.write('\\picwgoal%d\\pichgoal%d\n' % (act_width,act_height))
|
||||||
index = 1
|
index = 1
|
||||||
for i in buf:
|
for i in buf:
|
||||||
self.f.write('%02x' % ord(i))
|
self.f.write('%02x' % ord(i))
|
||||||
if index%32==0:
|
if index%32==0:
|
||||||
self.f.write('\n')
|
self.f.write('\n')
|
||||||
index = index+1
|
index = index+1
|
||||||
self.f.write('}}\\par\n')
|
self.f.write('}}\\par\n')
|
||||||
|
|
||||||
def write_note(self,text,format,style_name):
|
def write_note(self,text,format,style_name):
|
||||||
if format == 1:
|
if format == 1:
|
||||||
@ -385,7 +383,7 @@ class RTFDoc(BaseDoc.BaseDoc):
|
|||||||
for line in text.split('\n\n'):
|
for line in text.split('\n\n'):
|
||||||
self.start_paragraph(style_name)
|
self.start_paragraph(style_name)
|
||||||
line = line.replace('\n',' ')
|
line = line.replace('\n',' ')
|
||||||
line = string.join(string.split(line))
|
line = ' '.join(line.split())
|
||||||
self.write_text(line)
|
self.write_text(line)
|
||||||
self.end_paragraph()
|
self.end_paragraph()
|
||||||
|
|
||||||
@ -429,6 +427,6 @@ try:
|
|||||||
print_label=_("Open in %s") % mprog[1]
|
print_label=_("Open in %s") % mprog[1]
|
||||||
else:
|
else:
|
||||||
print_label=None
|
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:
|
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)
|
||||||
|
Loading…
Reference in New Issue
Block a user