part 2 basedoc: move BaseDoc.py to /gen/plug/docgen and add /gen/plug/docbackend

that was missing in part 1 
 Still to come: makefiles and splitting new basedoc.py in small files


svn: r12591
This commit is contained in:
Benny Malengier
2009-05-29 22:25:44 +00:00
parent f999ba9cc4
commit 8dd7adc607
54 changed files with 1384 additions and 594 deletions

View File

@@ -69,7 +69,7 @@ import const
import Utils
import ListModel
import Errors
import BaseDoc
from gen.plug.docgen import StyleSheet, StyleSheetList
from QuestionDialog import WarningDialog, ErrorDialog
from gen.plug import PluginManager
from gen.plug.menu import PersonOption, FilterOption, FamilyOption
@@ -1093,17 +1093,17 @@ class BookReportDialog(DocReportDialog):
'book', _("Book Report"))
self.book = book
self.database = dbstate.db
self.selected_style = BaseDoc.StyleSheet()
self.selected_style = StyleSheet()
for item in self.book.get_item_list():
# Set up default style
default_style = BaseDoc.StyleSheet()
default_style = StyleSheet()
make_default_style = item.option_class.make_default_style
make_default_style(default_style)
# Read all style sheets available for this item
style_file = item.option_class.handler.get_stylesheet_savefile()
style_list = BaseDoc.StyleSheetList(style_file, default_style)
style_list = StyleSheetList(style_file, default_style)
# Get the selected stylesheet
style_name = item.option_class.handler.get_default_stylesheet_name()
@@ -1205,17 +1205,17 @@ def cl_report(database, name, category, options_str_dict):
book_list = BookList('books.xml', database)
book_name = clr.options_dict['bookname']
book = book_list.get_book(book_name)
selected_style = BaseDoc.StyleSheet()
selected_style = StyleSheet()
for item in book.get_item_list():
# Set up default style
default_style = BaseDoc.StyleSheet()
default_style = StyleSheet()
make_default_style = item.option_class.make_default_style
make_default_style(default_style)
# Read all style sheets available for this item
style_file = item.option_class.handler.get_stylesheet_savefile()
style_list = BaseDoc.StyleSheetList(style_file, default_style)
style_list = StyleSheetList(style_file, default_style)
# Get the selected stylesheet
style_name = item.option_class.handler.get_default_stylesheet_name()

View File

@@ -35,7 +35,8 @@ from TransUtils import sgettext as _
#
#------------------------------------------------------------------------
from gen.lib import ChildRefType, Date, EventType, Name
import BaseDoc
from gen.plug.docgen import FontStyle, ParagraphStyle
from gen.plug.docgen.basedoc import FONT_SANS_SERIF
from BasicUtils import name_displayer
from DataViews import register, Gramplet
from gen.plug.menu import (BooleanOption, EnumeratedListOption,
@@ -500,29 +501,29 @@ class RecordsReportOptions(MenuReportOptions):
def make_default_style(self, default_style):
#Paragraph Styles
font = BaseDoc.FontStyle()
font.set_type_face(BaseDoc.FONT_SANS_SERIF)
font = FontStyle()
font.set_type_face(FONT_SANS_SERIF)
font.set_size(10)
font.set_bold(0)
para = BaseDoc.ParagraphStyle()
para = ParagraphStyle()
para.set_font(font)
para.set_description(_('The basic style used for the text display.'))
default_style.add_paragraph_style('REC-Normal', para)
font = BaseDoc.FontStyle()
font.set_type_face(BaseDoc.FONT_SANS_SERIF)
font = FontStyle()
font.set_type_face(FONT_SANS_SERIF)
font.set_size(10)
font.set_bold(1)
para = BaseDoc.ParagraphStyle()
para = ParagraphStyle()
para.set_font(font)
para.set_description(_('The style used for headings.'))
default_style.add_paragraph_style('REC-Heading', para)
font = BaseDoc.FontStyle()
font.set_type_face(BaseDoc.FONT_SANS_SERIF)
font = FontStyle()
font.set_type_face(FONT_SANS_SERIF)
font.set_size(12)
font.set_bold(1)
para = BaseDoc.ParagraphStyle()
para = ParagraphStyle()
para.set_font(font)
para.set_description(_("The style used for the report title"))
default_style.add_paragraph_style('REC-Title', para)

View File

@@ -34,7 +34,8 @@ from gettext import gettext as _
# Gramps modules
#
#------------------------------------------------------------------------
import BaseDoc
from gen.plug.docgen import BaseDoc, TextDoc
from gen.plug.docgen.basedoc import (PARA_ALIGN_RIGHT, PARA_ALIGN_CENTER)
from gen.plug import PluginManager, DocGenPlugin
import Errors
import Utils
@@ -120,7 +121,7 @@ def reformat_para(para='',left=0,right=72,just=LEFT,right_pad=0,first=0):
# Ascii
#
#------------------------------------------------------------------------
class AsciiDoc(BaseDoc.BaseDoc,BaseDoc.TextDoc):
class AsciiDoc(BaseDoc,TextDoc):
#--------------------------------------------------------------------
#
@@ -196,9 +197,9 @@ class AsciiDoc(BaseDoc.BaseDoc,BaseDoc.TextDoc):
#
#--------------------------------------------------------------------
def end_paragraph(self):
if self.p.get_alignment() == BaseDoc.PARA_ALIGN_RIGHT:
if self.p.get_alignment() == PARA_ALIGN_RIGHT:
fmt = RIGHT
elif self.p.get_alignment() == BaseDoc.PARA_ALIGN_CENTER:
elif self.p.get_alignment() == PARA_ALIGN_CENTER:
fmt = CENTER
else:
fmt = LEFT

View File

@@ -42,7 +42,7 @@ from math import radians
# Gramps modules
#
#------------------------------------------------------------------------
import BaseDoc
from gen.plug.docgen.basedoc import PAPER_PORTRAIT
import libcairodoc
from gen.plug import PluginManager, DocGenPlugin
import Errors
@@ -95,10 +95,10 @@ MARGIN = 6
#------------------------------------------------------------------------
def paperstyle_to_pagesetup(paper_style):
"""Convert a BaseDoc.PaperStyle instance into a gtk.PageSetup instance.
"""Convert a PaperStyle instance into a gtk.PageSetup instance.
@param paper_style: Gramps paper style object to convert
@param type: BaseDoc.PaperStyle
@param type: PaperStyle
@return: page_setup
@rtype: gtk.PageSetup
"""
@@ -149,7 +149,7 @@ def paperstyle_to_pagesetup(paper_style):
page_setup.set_paper_size(paper_size)
# Set paper orientation
if paper_style.get_orientation() == BaseDoc.PAPER_PORTRAIT:
if paper_style.get_orientation() == PAPER_PORTRAIT:
page_setup.set_orientation(gtk.PAGE_ORIENTATION_PORTRAIT)
else:
page_setup.set_orientation(gtk.PAGE_ORIENTATION_LANDSCAPE)

View File

@@ -42,7 +42,8 @@ import ImgManip
import tarfile
import const
import Errors
import BaseDoc
from gen.plug.docgen import BaseDoc, TextDoc
from gen.plug.docgen.basedoc import FONT_SANS_SERIF
from QuestionDialog import ErrorDialog, WarningDialog
import Utils
@@ -94,10 +95,10 @@ _bottom = [
# HtmlDoc
#
#------------------------------------------------------------------------
class HtmlDoc(BaseDoc.BaseDoc,BaseDoc.TextDoc):
class HtmlDoc(BaseDoc,TextDoc):
def __init__(self,styles,type,template):
BaseDoc.BaseDoc.__init__(self,styles,None,template)
BaseDoc.__init__(self,styles,None,template)
self.year = time.localtime(time.time())[0]
self.ext = '.html'
self.meta = ""
@@ -306,7 +307,7 @@ class HtmlDoc(BaseDoc.BaseDoc,BaseDoc.TextDoc):
italic = 'font-style:italic; '
if font.get_bold():
bold = 'font-weight:bold; '
if font.get_type_face() == BaseDoc.FONT_SANS_SERIF:
if font.get_type_face() == FONT_SANS_SERIF:
family = '"Helvetica","Arial","sans-serif"'
else:
family = '"Times New Roman","Times","serif"'

View File

@@ -39,9 +39,11 @@ from gettext import gettext as _
# gramps modules
#
#------------------------------------------------------------------------
import BaseDoc
from docbackend.latexbackend import LateXBackend, latexescape
from gen.plug import PluginManager, DocGenPlugin
from gen.plug.docgen import BaseDoc, TextDoc
from gen.plug.docgen.basedoc import PAPER_LANDSCAPE, FONT_SANS_SERIF
from gen.plug.docbackend import LateXBackend, latexescape
import ImgManip
import Errors
import Utils
@@ -129,7 +131,7 @@ class TexFont(object):
#
#------------------------------------------------------------------------
class LaTeXDoc(BaseDoc.BaseDoc,BaseDoc.TextDoc):
class LaTeXDoc(BaseDoc, TextDoc):
"""LaTeX document interface class. Derived from BaseDoc"""
def page_break(self):
@@ -147,7 +149,7 @@ class LaTeXDoc(BaseDoc.BaseDoc,BaseDoc.TextDoc):
options = "12pt"
if self.paper.get_orientation() == BaseDoc.PAPER_LANDSCAPE:
if self.paper.get_orientation() == PAPER_LANDSCAPE:
options = options + ",landscape"
# Paper selections are somewhat limited on a stock installation.
@@ -235,7 +237,7 @@ class LaTeXDoc(BaseDoc.BaseDoc,BaseDoc.TextDoc):
thisstyle.font_beg = thisstyle.font_beg + "\\hfill"
# Establish font face and shape
if font.get_type_face() == BaseDoc.FONT_SANS_SERIF:
if font.get_type_face() == FONT_SANS_SERIF:
thisstyle.font_beg = thisstyle.font_beg + "\\sffamily"
thisstyle.font_end = "\\rmfamily" + thisstyle.font_end
if font.get_bold():

View File

@@ -44,7 +44,10 @@ from xml.sax.saxutils import escape
# Gramps modules
#
#-------------------------------------------------------------------------
import BaseDoc
from gen.plug.docgen import BaseDoc, TextDoc, DrawDoc
from gen.plug.docgen.basedoc import (FONT_SANS_SERIF, DASHED, PAPER_PORTRAIT,
INDEX_TYPE_TOC, PARA_ALIGN_CENTER, PARA_ALIGN_LEFT,
INDEX_TYPE_ALP, PARA_ALIGN_RIGHT)
import const
from gen.plug import PluginManager, DocGenPlugin
from ReportBase import ReportUtils
@@ -74,10 +77,10 @@ _esc_map = {
# ODFDoc
#
#-------------------------------------------------------------------------
class ODFDoc(BaseDoc.BaseDoc, BaseDoc.TextDoc, BaseDoc.DrawDoc):
class ODFDoc(BaseDoc, TextDoc, DrawDoc):
def __init__(self, styles, type, template):
BaseDoc.BaseDoc.__init__(self, styles, type, template)
BaseDoc.__init__(self, styles, type, template)
self.media_list = []
self.cntnt = None
self.filename = None
@@ -180,7 +183,7 @@ class ODFDoc(BaseDoc.BaseDoc, BaseDoc.TextDoc, BaseDoc.DrawDoc):
self.cntnt.write('draw:stroke="none" ')
self.cntnt.write('draw:stroke-color="#000000" ')
if style.get_line_style() == BaseDoc.DASHED:
if style.get_line_style() == DASHED:
self.cntnt.write('svg:fill-color="#cccccc" ')
else:
self.cntnt.write('svg:fill-color="#%02x%02x%02x" ' % style.get_color())
@@ -249,18 +252,18 @@ class ODFDoc(BaseDoc.BaseDoc, BaseDoc.TextDoc, BaseDoc.DrawDoc):
self.cntnt.write('fo:keep-with-next="true" ')
align = style.get_alignment()
if align == BaseDoc.PARA_ALIGN_LEFT:
if align == PARA_ALIGN_LEFT:
self.cntnt.write('fo:text-align="start" ')
elif align == BaseDoc.PARA_ALIGN_RIGHT:
elif align == PARA_ALIGN_RIGHT:
self.cntnt.write('fo:text-align="end" ')
elif align == BaseDoc.PARA_ALIGN_CENTER:
elif align == PARA_ALIGN_CENTER:
self.cntnt.write('fo:text-align="center" ')
self.cntnt.write('style:justify-single-word="false" ')
else:
self.cntnt.write('fo:text-align="justify" ')
self.cntnt.write('style:justify-single-word="false" ')
font = style.get_font()
if font.get_type_face() == BaseDoc.FONT_SANS_SERIF:
if font.get_type_face() == FONT_SANS_SERIF:
self.cntnt.write('style:font-name="Arial" ')
else:
self.cntnt.write('style:font-name="Times New Roman" ')
@@ -287,15 +290,15 @@ class ODFDoc(BaseDoc.BaseDoc, BaseDoc.TextDoc, BaseDoc.DrawDoc):
self.cntnt.write('style:family="text">\n')
self.cntnt.write('<style:text-properties ')
align = style.get_alignment()
if align == BaseDoc.PARA_ALIGN_LEFT:
if align == PARA_ALIGN_LEFT:
self.cntnt.write('fo:text-align="start" ')
elif align == BaseDoc.PARA_ALIGN_RIGHT:
elif align == PARA_ALIGN_RIGHT:
self.cntnt.write('fo:text-align="end" ')
elif align == BaseDoc.PARA_ALIGN_CENTER:
elif align == PARA_ALIGN_CENTER:
self.cntnt.write('fo:text-align="center" ')
self.cntnt.write('style:justify-single-word="false" ')
font = style.get_font()
if font.get_type_face() == BaseDoc.FONT_SANS_SERIF:
if font.get_type_face() == FONT_SANS_SERIF:
self.cntnt.write('style:font-name="Arial" ')
else:
self.cntnt.write('style:font-name="Times New Roman" ')
@@ -687,12 +690,12 @@ class ODFDoc(BaseDoc.BaseDoc, BaseDoc.TextDoc, BaseDoc.DrawDoc):
self.sfile.write('fo:keep-with-next="always" ')
align = style.get_alignment()
if align == BaseDoc.PARA_ALIGN_LEFT:
if align == PARA_ALIGN_LEFT:
self.sfile.write('fo:text-align="start" ')
self.sfile.write('style:justify-single-word="false" ')
elif align == BaseDoc.PARA_ALIGN_RIGHT:
elif align == PARA_ALIGN_RIGHT:
self.sfile.write('fo:text-align="end" ')
elif align == BaseDoc.PARA_ALIGN_CENTER:
elif align == PARA_ALIGN_CENTER:
self.sfile.write('fo:text-align="center" ')
self.sfile.write('style:justify-single-word="false" ')
else:
@@ -704,7 +707,7 @@ class ODFDoc(BaseDoc.BaseDoc, BaseDoc.TextDoc, BaseDoc.DrawDoc):
font = style.get_font()
color = font.get_color()
self.sfile.write('fo:color="#%02x%02x%02x" ' % color)
if font.get_type_face() == BaseDoc.FONT_SANS_SERIF:
if font.get_type_face() == FONT_SANS_SERIF:
self.sfile.write('style:font-name="Arial" ')
else:
self.sfile.write('style:font-name="Times New Roman" ')
@@ -771,7 +774,7 @@ class ODFDoc(BaseDoc.BaseDoc, BaseDoc.TextDoc, BaseDoc.DrawDoc):
self.sfile.write('<style:page-layout-properties fo:page-width="%.2fcm" ' % self.paper.get_size().get_width())
self.sfile.write('fo:page-height="%.2fcm" ' % self.paper.get_size().get_height())
self.sfile.write('style:num-format="1" ')
if self.paper.get_orientation() == BaseDoc.PAPER_PORTRAIT:
if self.paper.get_orientation() == PAPER_PORTRAIT:
self.sfile.write('style:print-orientation="portrait" ')
else:
self.sfile.write('style:print-orientation="landscape" ')
@@ -887,10 +890,10 @@ class ODFDoc(BaseDoc.BaseDoc, BaseDoc.TextDoc, BaseDoc.DrawDoc):
if mark:
key = escape(mark.key, _esc_map)
key = key.replace('"', '&quot;')
if mark.type == BaseDoc.INDEX_TYPE_ALP:
if mark.type == INDEX_TYPE_ALP:
self.cntnt.write('<text:alphabetical-index-mark ')
self.cntnt.write('text:string-value="%s" />' % key)
elif mark.type == BaseDoc.INDEX_TYPE_TOC:
elif mark.type == INDEX_TYPE_TOC:
self.cntnt.write('<text:toc-mark ')
self.cntnt.write('text:string-value="%s" ' % key)
self.cntnt.write('text:outline-level="%d" />' % mark.level)

View File

@@ -33,7 +33,8 @@ from gettext import gettext as _
#-------------------------------------------------------------------------
from ReportBase import ReportUtils
from gen.plug import PluginManager, DocGenPlugin
import BaseDoc
from gen.plug.docgen import BaseDoc, DrawDoc
from gen.plug.docgen.basedoc import FONT_SERIF, PAPER_PORTRAIT, SOLID
import Errors
from Utils import gformat
@@ -51,10 +52,10 @@ def coords(grp):
# PSDrawDoc
#
#-------------------------------------------------------------------------
class PSDrawDoc(BaseDoc.BaseDoc,BaseDoc.DrawDoc):
class PSDrawDoc(BaseDoc,DrawDoc):
def __init__(self,styles,type,template):
BaseDoc.BaseDoc.__init__(self,styles,type,template)
BaseDoc.__init__(self,styles,type,template)
self.f = None
self.filename = None
self.level = 0
@@ -62,7 +63,7 @@ class PSDrawDoc(BaseDoc.BaseDoc,BaseDoc.DrawDoc):
def fontdef(self,para):
font = para.get_font()
if font.get_type_face() == BaseDoc.FONT_SERIF:
if font.get_type_face() == FONT_SERIF:
if font.get_bold():
if font.get_italic():
font_name = "/Times-BoldItalic"
@@ -108,7 +109,7 @@ class PSDrawDoc(BaseDoc.BaseDoc,BaseDoc.DrawDoc):
self.f.write('%%LanguageLevel: 2\n')
self.f.write('%%Pages: (atend)\n')
self.f.write('%%PageOrder: Ascend\n')
if self.paper.get_orientation() != BaseDoc.PAPER_PORTRAIT:
if self.paper.get_orientation() != PAPER_PORTRAIT:
self.f.write('%%Orientation: Landscape\n')
else:
self.f.write('%%Orientation: Portrait\n')
@@ -145,7 +146,7 @@ class PSDrawDoc(BaseDoc.BaseDoc,BaseDoc.DrawDoc):
self.page = self.page + 1
self.f.write("%%Page:")
self.f.write("%d %d\n" % (self.page,self.page))
if self.paper.get_orientation() != BaseDoc.PAPER_PORTRAIT:
if self.paper.get_orientation() != PAPER_PORTRAIT:
self.f.write('90 rotate %s cm %s cm translate\n' % (
gformat(0),gformat(-1*self.paper.get_size().get_height())))
@@ -242,7 +243,7 @@ class PSDrawDoc(BaseDoc.BaseDoc,BaseDoc.DrawDoc):
self.f.write('gsave\n')
self.f.write('newpath\n')
self.f.write('%s setlinewidth\n' % gformat(stype.get_line_width()))
if stype.get_line_style() == BaseDoc.SOLID:
if stype.get_line_style() == SOLID:
self.f.write('[] 0 setdash\n')
else:
self.f.write('[2 4] 0 setdash\n')
@@ -274,7 +275,7 @@ class PSDrawDoc(BaseDoc.BaseDoc,BaseDoc.DrawDoc):
self.f.write('%s cm %s cm moveto\n' % coords(self.translate(x1,y1)))
self.f.write('%s cm %s cm lineto\n' % coords(self.translate(x2,y2)))
self.f.write('%s setlinewidth\n' % gformat(stype.get_line_width()))
if stype.get_line_style() == BaseDoc.SOLID:
if stype.get_line_style() == SOLID:
self.f.write('[] 0 setdash\n')
else:
self.f.write('[2 4] 0 setdash\n')

View File

@@ -34,7 +34,9 @@ from gettext import gettext as _
# Load the base BaseDoc class
#
#------------------------------------------------------------------------
import BaseDoc
from gen.plug.docgen import BaseDoc, TextDoc
from gen.plug.docgen.basedoc import (FONT_SERIF, PARA_ALIGN_RIGHT
, PARA_ALIGN_CENTER, PARA_ALIGN_JUSTIFY)
from gen.plug import PluginManager, DocGenPlugin
import ImgManip
import Errors
@@ -58,7 +60,7 @@ def twips(cm):
# use style sheets. Instead it writes raw formatting.
#
#------------------------------------------------------------------------
class RTFDoc(BaseDoc.BaseDoc,BaseDoc.TextDoc):
class RTFDoc(BaseDoc,TextDoc):
#--------------------------------------------------------------------
#
@@ -156,7 +158,7 @@ class RTFDoc(BaseDoc.BaseDoc,BaseDoc.TextDoc):
size = f.get_size()*2
bgindex = self.color_map[p.get_background_color()]
fgindex = self.color_map[f.get_color()]
if f.get_type_face() == BaseDoc.FONT_SERIF:
if f.get_type_face() == FONT_SERIF:
self.font_type = '\\f0\\fs%d\\cf%d\\cb%d' % (size,fgindex,bgindex)
else:
self.font_type = '\\f1\\fs%d\\cf%d\\cb%d' % (size,fgindex,bgindex)
@@ -171,14 +173,14 @@ class RTFDoc(BaseDoc.BaseDoc,BaseDoc.TextDoc):
if not self.in_table:
self.f.write('\\pard')
if p.get_alignment() == BaseDoc.PARA_ALIGN_RIGHT:
if p.get_alignment() == PARA_ALIGN_RIGHT:
self.f.write('\\qr')
elif p.get_alignment() == BaseDoc.PARA_ALIGN_CENTER:
elif p.get_alignment() == PARA_ALIGN_CENTER:
self.f.write('\\qc')
self.f.write('\\ri%d' % twips(p.get_right_margin()))
self.f.write('\\li%d' % twips(p.get_left_margin()))
self.f.write('\\fi%d' % twips(p.get_first_indent()))
if p.get_alignment() == BaseDoc.PARA_ALIGN_JUSTIFY:
if p.get_alignment() == PARA_ALIGN_JUSTIFY:
self.f.write('\\qj')
if p.get_padding():
self.f.write('\\sa%d' % twips(p.get_padding()/2.0))

View File

@@ -35,7 +35,8 @@ import StringIO
#
#-------------------------------------------------------------------------
from gen.plug import PluginManager, DocGenPlugin
import BaseDoc
from gen.plug.docgen import BaseDoc, DrawDoc
from gen.plug.docgen.basedoc import FONT_SANS_SERIF
import Errors
#-------------------------------------------------------------------------
@@ -43,10 +44,10 @@ import Errors
# SvgDrawDoc
#
#-------------------------------------------------------------------------
class SvgDrawDoc(BaseDoc.BaseDoc,BaseDoc.DrawDoc):
class SvgDrawDoc(BaseDoc, DrawDoc):
def __init__(self,styles,type,template):
BaseDoc.BaseDoc.__init__(self,styles,type,template)
BaseDoc.__init__(self,styles,type,template)
self.f = None
self.filename = None
self.level = 0
@@ -112,7 +113,7 @@ class SvgDrawDoc(BaseDoc.BaseDoc,BaseDoc.DrawDoc):
if font.get_italic():
self.t.write('font-style:italic;')
self.t.write('font-size:%d; ' % size)
if font.get_type_face() == BaseDoc.FONT_SANS_SERIF:
if font.get_type_face() == FONT_SANS_SERIF:
self.t.write('font-family:sans-serif;')
else:
self.t.write('font-family:serif;')
@@ -206,7 +207,7 @@ class SvgDrawDoc(BaseDoc.BaseDoc,BaseDoc.DrawDoc):
if font.get_italic():
self.t.write(' font-style:italic;')
self.t.write(' font-size:%d;' % font_size)
if font.get_type_face() == BaseDoc.FONT_SANS_SERIF:
if font.get_type_face() == FONT_SANS_SERIF:
self.t.write(' font-family:sans-serif;')
else:
self.t.write(' font-family:serif;')
@@ -235,7 +236,7 @@ class SvgDrawDoc(BaseDoc.BaseDoc,BaseDoc.DrawDoc):
if font.get_italic():
self.t.write('font-style:italic;')
self.t.write('font-size:%d; ' % font_size)
if font.get_type_face() == BaseDoc.FONT_SANS_SERIF:
if font.get_type_face() == FONT_SANS_SERIF:
self.t.write('font-family:sans-serif;')
else:
self.t.write('font-family:serif;')

View File

@@ -35,7 +35,8 @@ from TransUtils import sgettext as _
# GRAMPS modules
#
#------------------------------------------------------------------------
import BaseDoc
from gen.plug.docgen import FontStyle, ParagraphStyle, GraphicsStyle
from gen.plug.docgen.basedoc import FONT_SANS_SERIF, PARA_ALIGN_CENTER
from SubstKeywords import SubstKeywords
from gen.plug import PluginManager
from gen.plug.menu import BooleanOption, NumberOption, TextOption, PersonOption
@@ -488,38 +489,38 @@ class AncestorTreeOptions(MenuReportOptions):
"""Make the default output style for the Ancestor Tree."""
## Paragraph Styles:
f = BaseDoc.FontStyle()
f = FontStyle()
f.set_size(9)
f.set_type_face(BaseDoc.FONT_SANS_SERIF)
p = BaseDoc.ParagraphStyle()
f.set_type_face(FONT_SANS_SERIF)
p = ParagraphStyle()
p.set_font(f)
p.set_description(_('The basic style used for the text display.'))
default_style.add_paragraph_style("AC2-Normal", p)
f = BaseDoc.FontStyle()
f = FontStyle()
f.set_size(16)
f.set_type_face(BaseDoc.FONT_SANS_SERIF)
p = BaseDoc.ParagraphStyle()
f.set_type_face(FONT_SANS_SERIF)
p = ParagraphStyle()
p.set_font(f)
p.set_alignment(BaseDoc.PARA_ALIGN_CENTER)
p.set_alignment(PARA_ALIGN_CENTER)
p.set_description(_('The basic style used for the title display.'))
default_style.add_paragraph_style("AC2-Title", p)
## Draw styles
g = BaseDoc.GraphicsStyle()
g = GraphicsStyle()
g.set_paragraph_style("AC2-Normal")
g.set_shadow(1, 0.2)
g.set_fill_color((255, 255, 255))
default_style.add_draw_style("AC2-box", g)
g = BaseDoc.GraphicsStyle()
g = GraphicsStyle()
g.set_paragraph_style("AC2-Title")
g.set_color((0, 0, 0))
g.set_fill_color((255, 255, 255))
g.set_line_width(0)
default_style.add_draw_style("AC2-title", g)
g = BaseDoc.GraphicsStyle()
g = GraphicsStyle()
default_style.add_draw_style("AC2-line", g)
#------------------------------------------------------------------------

View File

@@ -34,7 +34,9 @@ import time
# GRAMPS modules
#
#------------------------------------------------------------------------
import BaseDoc
from gen.plug.docgen import FontStyle, ParagraphStyle, GraphicsStyle
from gen.plug.docgen.basedoc import (FONT_SERIF, PARA_ALIGN_CENTER
, PARA_ALIGN_LEFT, PARA_ALIGN_RIGHT)
from BasicUtils import name_displayer
from gen.plug import PluginManager
from ReportBase import Report, ReportUtils, MenuReportOptions, CATEGORY_DRAW
@@ -461,17 +463,17 @@ class CalendarOptions(MenuReportOptions):
self.__filter.set_filters(filter_list)
def make_my_style(self, default_style, name, description,
size=9, font=BaseDoc.FONT_SERIF, justified ="left",
color=None, align=BaseDoc.PARA_ALIGN_CENTER,
size=9, font=FONT_SERIF, justified ="left",
color=None, align=PARA_ALIGN_CENTER,
shadow = None, italic=0, bold=0, borders=0, indent=None):
""" Create paragraph and graphic styles of the same name """
# Paragraph:
f = BaseDoc.FontStyle()
f = FontStyle()
f.set_size(size)
f.set_type_face(font)
f.set_italic(italic)
f.set_bold(bold)
p = BaseDoc.ParagraphStyle()
p = ParagraphStyle()
p.set_font(f)
p.set_alignment(align)
p.set_description(description)
@@ -482,14 +484,14 @@ class CalendarOptions(MenuReportOptions):
if indent:
p.set(first_indent=indent)
if justified == "left":
p.set_alignment(BaseDoc.PARA_ALIGN_LEFT)
p.set_alignment(PARA_ALIGN_LEFT)
elif justified == "right":
p.set_alignment(BaseDoc.PARA_ALIGN_RIGHT)
p.set_alignment(PARA_ALIGN_RIGHT)
elif justified == "center":
p.set_alignment(BaseDoc.PARA_ALIGN_CENTER)
p.set_alignment(PARA_ALIGN_CENTER)
default_style.add_paragraph_style(name, p)
# Graphics:
g = BaseDoc.GraphicsStyle()
g = GraphicsStyle()
g.set_paragraph_style(name)
if shadow:
g.set_shadow(*shadow)

View File

@@ -35,7 +35,8 @@ from gen.plug.menu import TextOption, NumberOption, BooleanOption, PersonOption
from ReportBase import Report, MenuReportOptions, ReportUtils, CATEGORY_DRAW
from SubstKeywords import SubstKeywords
from TransUtils import sgettext as _
import BaseDoc
from gen.plug.docgen import GraphicsStyle, FontStyle, ParagraphStyle
from gen.plug.docgen.basedoc import FONT_SANS_SERIF, PARA_ALIGN_CENTER
#------------------------------------------------------------------------
#
@@ -487,38 +488,38 @@ class DescendTreeOptions(MenuReportOptions):
def make_default_style(self,default_style):
"""Make the default output style for the Ancestor Tree."""
## Paragraph Styles:
f = BaseDoc.FontStyle()
f = FontStyle()
f.set_size(9)
f.set_type_face(BaseDoc.FONT_SANS_SERIF)
p = BaseDoc.ParagraphStyle()
f.set_type_face(FONT_SANS_SERIF)
p = ParagraphStyle()
p.set_font(f)
p.set_description(_('The basic style used for the text display.'))
default_style.add_paragraph_style("DC2-Normal", p)
f = BaseDoc.FontStyle()
f = FontStyle()
f.set_size(16)
f.set_type_face(BaseDoc.FONT_SANS_SERIF)
p = BaseDoc.ParagraphStyle()
f.set_type_face(FONT_SANS_SERIF)
p = ParagraphStyle()
p.set_font(f)
p.set_alignment(BaseDoc.PARA_ALIGN_CENTER)
p.set_alignment(PARA_ALIGN_CENTER)
p.set_description(_('The basic style used for the title display.'))
default_style.add_paragraph_style("DC2-Title", p)
## Draw styles
g = BaseDoc.GraphicsStyle()
g = GraphicsStyle()
g.set_paragraph_style("DC2-Normal")
g.set_shadow(1, 0.2)
g.set_fill_color((255, 255, 255))
default_style.add_draw_style("DC2-box", g)
g = BaseDoc.GraphicsStyle()
g = GraphicsStyle()
g.set_paragraph_style("DC2-Title")
g.set_color((0, 0, 0))
g.set_fill_color((255, 255, 255))
g.set_line_width(0)
default_style.add_draw_style("DC2-title", g)
g = BaseDoc.GraphicsStyle()
g = GraphicsStyle()
default_style.add_draw_style("DC2-line", g)
#------------------------------------------------------------------------

View File

@@ -33,7 +33,8 @@ from gettext import gettext as _
# gramps modules
#
#------------------------------------------------------------------------
import BaseDoc
from gen.plug.docgen import FontStyle, ParagraphStyle, GraphicsStyle
from gen.plug.docgen.basedoc import FONT_SANS_SERIF, PARA_ALIGN_CENTER
from gen.plug import PluginManager
from gen.plug.menu import EnumeratedListOption, NumberOption, PersonOption
from ReportBase import Report, ReportUtils, MenuReportOptions, CATEGORY_DRAW
@@ -383,46 +384,46 @@ class FanChartOptions(MenuReportOptions):
]
#Paragraph Styles
f = BaseDoc.FontStyle()
f = FontStyle()
f.set_size(20)
f.set_bold(1)
f.set_type_face(BaseDoc.FONT_SANS_SERIF)
p = BaseDoc.ParagraphStyle()
f.set_type_face(FONT_SANS_SERIF)
p = ParagraphStyle()
p.set_font(f)
p.set_alignment(BaseDoc.PARA_ALIGN_CENTER)
p.set_alignment(PARA_ALIGN_CENTER)
p.set_description(_('The style used for the title.'))
default_style.add_paragraph_style("FC-Title",p)
f = BaseDoc.FontStyle()
f = FontStyle()
f.set_size(9)
f.set_type_face(BaseDoc.FONT_SANS_SERIF)
p = BaseDoc.ParagraphStyle()
f.set_type_face(FONT_SANS_SERIF)
p = ParagraphStyle()
p.set_font(f)
p.set_alignment(BaseDoc.PARA_ALIGN_CENTER)
p.set_alignment(PARA_ALIGN_CENTER)
p.set_description(_('The basic style used for the text display.'))
default_style.add_paragraph_style("text_style", p)
# GraphicsStyles
g = BaseDoc.GraphicsStyle()
g = GraphicsStyle()
g.set_paragraph_style('FC-Title')
g.set_line_width(0)
default_style.add_draw_style("t",g)
for i in range (0, self.MAX_GENERATIONS):
g = BaseDoc.GraphicsStyle()
g = GraphicsStyle()
g.set_fill_color(BACKGROUND_COLORS[i])
g.set_paragraph_style('FC-Normal')
background_style_name = 'background_style' + '%d' % i
default_style.add_draw_style(background_style_name,g)
g = BaseDoc.GraphicsStyle()
g = GraphicsStyle()
g.set_fill_color(BACKGROUND_COLORS[i])
g.set_paragraph_style('text_style')
g.set_line_width(0)
text_style_name = 'text_style' + '%d' % i
default_style.add_draw_style(text_style_name,g)
g = BaseDoc.GraphicsStyle()
g = GraphicsStyle()
g.set_fill_color((255,255,255))
g.set_paragraph_style('FC-Normal')
default_style.add_draw_style('background_style_white',g)

View File

@@ -43,7 +43,9 @@ from TransUtils import sgettext as _
# Person and relation types
from gen.lib import Person, FamilyRelType, EventType
# gender and report type names
import BaseDoc
from gen.plug.docgen import FontStyle, ParagraphStyle, GraphicsStyle
from gen.plug.docgen.basedoc import (FONT_SANS_SERIF, FONT_SERIF,
PARA_ALIGN_CENTER, PARA_ALIGN_LEFT)
from gen.plug import PluginManager
from gen.plug.menu import BooleanOption, NumberOption, EnumeratedListOption, \
FilterOption, PersonOption
@@ -775,21 +777,21 @@ class StatisticsChartOptions(MenuReportOptions):
def make_default_style(self, default_style):
"""Make the default output style for the Statistics report."""
# Paragraph Styles
f = BaseDoc.FontStyle()
f = FontStyle()
f.set_size(10)
f.set_type_face(BaseDoc.FONT_SERIF)
p = BaseDoc.ParagraphStyle()
f.set_type_face(FONT_SERIF)
p = ParagraphStyle()
p.set_font(f)
p.set_alignment(BaseDoc.PARA_ALIGN_LEFT)
p.set_alignment(PARA_ALIGN_LEFT)
p.set_description(_("The style used for the items and values."))
default_style.add_paragraph_style("SC-Text",p)
f = BaseDoc.FontStyle()
f = FontStyle()
f.set_size(14)
f.set_type_face(BaseDoc.FONT_SANS_SERIF)
p = BaseDoc.ParagraphStyle()
f.set_type_face(FONT_SANS_SERIF)
p = ParagraphStyle()
p.set_font(f)
p.set_alignment(BaseDoc.PARA_ALIGN_CENTER)
p.set_alignment(PARA_ALIGN_CENTER)
p.set_description(_("The style used for the title of the page."))
default_style.add_paragraph_style("SC-Title",p)
@@ -802,14 +804,14 @@ class StatisticsChartOptions(MenuReportOptions):
SC-color-N - The colors for drawing pies.
SC-bar - A red bar with 0.5pt black line.
"""
g = BaseDoc.GraphicsStyle()
g = GraphicsStyle()
g.set_paragraph_style("SC-Title")
g.set_color((0,0,0))
g.set_fill_color((255,255,255))
g.set_line_width(0)
default_style.add_draw_style("SC-title",g)
g = BaseDoc.GraphicsStyle()
g = GraphicsStyle()
g.set_paragraph_style("SC-Text")
g.set_color((0,0,0))
g.set_fill_color((255,255,255))
@@ -818,63 +820,63 @@ class StatisticsChartOptions(MenuReportOptions):
width = 0.8
# red
g = BaseDoc.GraphicsStyle()
g = GraphicsStyle()
g.set_paragraph_style('SC-Text')
g.set_color((0,0,0))
g.set_fill_color((255,0,0))
g.set_line_width(width)
default_style.add_draw_style("SC-color-0",g)
# orange
g = BaseDoc.GraphicsStyle()
g = GraphicsStyle()
g.set_paragraph_style('SC-Text')
g.set_color((0,0,0))
g.set_fill_color((255,158,33))
g.set_line_width(width)
default_style.add_draw_style("SC-color-1",g)
# green
g = BaseDoc.GraphicsStyle()
g = GraphicsStyle()
g.set_paragraph_style('SC-Text')
g.set_color((0,0,0))
g.set_fill_color((0,178,0))
g.set_line_width(width)
default_style.add_draw_style("SC-color-2",g)
# violet
g = BaseDoc.GraphicsStyle()
g = GraphicsStyle()
g.set_paragraph_style('SC-Text')
g.set_color((0,0,0))
g.set_fill_color((123,0,123))
g.set_line_width(width)
default_style.add_draw_style("SC-color-3",g)
# yellow
g = BaseDoc.GraphicsStyle()
g = GraphicsStyle()
g.set_paragraph_style('SC-Text')
g.set_color((0,0,0))
g.set_fill_color((255,255,0))
g.set_line_width(width)
default_style.add_draw_style("SC-color-4",g)
# blue
g = BaseDoc.GraphicsStyle()
g = GraphicsStyle()
g.set_paragraph_style('SC-Text')
g.set_color((0,0,0))
g.set_fill_color((0,105,214))
g.set_line_width(width)
default_style.add_draw_style("SC-color-5",g)
# gray
g = BaseDoc.GraphicsStyle()
g = GraphicsStyle()
g.set_paragraph_style('SC-Text')
g.set_color((0,0,0))
g.set_fill_color((210,204,210))
g.set_line_width(width)
default_style.add_draw_style("SC-color-6",g)
g = BaseDoc.GraphicsStyle()
g = GraphicsStyle()
g.set_color((0,0,0))
g.set_fill_color((255,0,0))
g.set_line_width(width)
default_style.add_draw_style("SC-bar",g)
# legend
g = BaseDoc.GraphicsStyle()
g = GraphicsStyle()
g.set_paragraph_style('SC-Text')
g.set_color((0,0,0))
g.set_fill_color((255,255,255))

View File

@@ -41,7 +41,9 @@ from gen.plug import PluginManager
from gen.plug.menu import PersonOption, FilterOption, EnumeratedListOption
from ReportBase import Report, ReportUtils, MenuReportOptions, CATEGORY_DRAW
pt2cm = ReportUtils.pt2cm
import BaseDoc
from gen.plug.docgen import FontStyle, ParagraphStyle, GraphicsStyle
from gen.plug.docgen.basedoc import (FONT_SANS_SERIF,
DASHED, PARA_ALIGN_CENTER)
import Sort
from QuestionDialog import ErrorDialog
from BasicUtils import name_displayer
@@ -363,29 +365,29 @@ class TimeLineOptions(MenuReportOptions):
def make_default_style(self,default_style):
"""Make the default output style for the Timeline report."""
# Paragraph Styles
f = BaseDoc.FontStyle()
f = FontStyle()
f.set_size(10)
f.set_type_face(BaseDoc.FONT_SANS_SERIF)
p = BaseDoc.ParagraphStyle()
f.set_type_face(FONT_SANS_SERIF)
p = ParagraphStyle()
p.set_font(f)
p.set_description(_("The style used for the person's name."))
default_style.add_paragraph_style("TLG-Name",p)
f = BaseDoc.FontStyle()
f = FontStyle()
f.set_size(8)
f.set_type_face(BaseDoc.FONT_SANS_SERIF)
p = BaseDoc.ParagraphStyle()
f.set_type_face(FONT_SANS_SERIF)
p = ParagraphStyle()
p.set_font(f)
p.set_alignment(BaseDoc.PARA_ALIGN_CENTER)
p.set_alignment(PARA_ALIGN_CENTER)
p.set_description(_("The style used for the year labels."))
default_style.add_paragraph_style("TLG-Label",p)
f = BaseDoc.FontStyle()
f = FontStyle()
f.set_size(14)
f.set_type_face(BaseDoc.FONT_SANS_SERIF)
p = BaseDoc.ParagraphStyle()
f.set_type_face(FONT_SANS_SERIF)
p = ParagraphStyle()
p.set_font(f)
p.set_alignment(BaseDoc.PARA_ALIGN_CENTER)
p.set_alignment(PARA_ALIGN_CENTER)
p.set_description(_("The style used for the title of the page."))
default_style.add_paragraph_style("TLG-Title",p)
@@ -404,44 +406,44 @@ class TimeLineOptions(MenuReportOptions):
TLG-label - Contains the TLG-Label paragraph style used for the year
label's in the document.
"""
g = BaseDoc.GraphicsStyle()
g = GraphicsStyle()
g.set_line_width(0.5)
g.set_color((0,0,0))
default_style.add_draw_style("TLG-line",g)
g = BaseDoc.GraphicsStyle()
g = GraphicsStyle()
g.set_line_width(0.5)
g.set_color((0,0,0))
g.set_fill_color((0,0,0))
default_style.add_draw_style("TLG-solid",g)
g = BaseDoc.GraphicsStyle()
g = GraphicsStyle()
g.set_line_width(0.5)
g.set_color((0,0,0))
g.set_fill_color((255,255,255))
default_style.add_draw_style("open",g)
g = BaseDoc.GraphicsStyle()
g = GraphicsStyle()
g.set_line_width(0.5)
g.set_line_style(BaseDoc.DASHED)
g.set_line_style(DASHED)
g.set_color((0,0,0))
default_style.add_draw_style("TLG-grid",g)
g = BaseDoc.GraphicsStyle()
g = GraphicsStyle()
g.set_paragraph_style("TLG-Name")
g.set_color((0,0,0))
g.set_fill_color((255,255,255))
g.set_line_width(0)
default_style.add_draw_style("TLG-text",g)
g = BaseDoc.GraphicsStyle()
g = GraphicsStyle()
g.set_paragraph_style("TLG-Title")
g.set_color((0,0,0))
g.set_fill_color((255,255,255))
g.set_line_width(0)
default_style.add_draw_style("TLG-title",g)
g = BaseDoc.GraphicsStyle()
g = GraphicsStyle()
g.set_paragraph_style("TLG-Label")
g.set_color((0,0,0))
g.set_fill_color((255,255,255))

View File

@@ -38,11 +38,14 @@ from math import radians
# Gramps modules
#
#------------------------------------------------------------------------
import BaseDoc
from gen.plug.docgen import BaseDoc, TextDoc, DrawDoc, ParagraphStyle,\
TableCellStyle
from gen.plug.docgen.basedoc import (FONT_SANS_SERIF, FONT_SERIF,
FONT_MONOSPACE, PARA_ALIGN_CENTER, PARA_ALIGN_LEFT)
from ReportBase import ReportUtils
from Errors import PluginError
from gen.plug import PluginManager, Plugin
from docbackend import CairoBackend
from gen.plug.docbackend import CairoBackend
#------------------------------------------------------------------------
#
@@ -77,21 +80,21 @@ DEBUG = False
#------------------------------------------------------------------------
_TTF_FREEFONT = {
BaseDoc.FONT_SERIF: 'FreeSerif',
BaseDoc.FONT_SANS_SERIF: 'FreeSans',
BaseDoc.FONT_MONOSPACE: 'FreeMono',
FONT_SERIF: 'FreeSerif',
FONT_SANS_SERIF: 'FreeSans',
FONT_MONOSPACE: 'FreeMono',
}
_MS_TTFONT = {
BaseDoc.FONT_SERIF: 'Times New Roman',
BaseDoc.FONT_SANS_SERIF: 'Arial',
BaseDoc.FONT_MONOSPACE: 'Courier New',
FONT_SERIF: 'Times New Roman',
FONT_SANS_SERIF: 'Arial',
FONT_MONOSPACE: 'Courier New',
}
_GNOME_FONT = {
BaseDoc.FONT_SERIF: 'Serif',
BaseDoc.FONT_SANS_SERIF: 'Sans',
BaseDoc.FONT_MONOSPACE: 'Monospace',
FONT_SERIF: 'Serif',
FONT_SANS_SERIF: 'Sans',
FONT_MONOSPACE: 'Monospace',
}
font_families = _GNOME_FONT
@@ -136,7 +139,7 @@ set_font_families()
#------------------------------------------------------------------------
def fontstyle_to_fontdescription(font_style):
"""Convert a BaseDoc.FontStyle instance to a pango.FontDescription one.
"""Convert a FontStyle instance to a pango.FontDescription one.
Font color and underline are not implemented in pango.FontDescription,
and have to be set with pango.Layout.set_attributes(attrlist) method.
@@ -179,7 +182,7 @@ def tabstops_to_tabarray(tab_stops, dpi):
##class RowStyle(list):
##"""Specifies the format of a table row.
##RowStyle extents the available styles in BaseDoc.
##RowStyle extents the available styles in
##The RowStyle contains the width of each column as a percentage of the
##width of the full row. Note! The width of the row is not known until
@@ -390,7 +393,7 @@ class GtkDocParagraph(GtkDocBaseElement):
_type = 'PARAGRAPH'
_allowed_children = []
# line spacing is not defined in BaseDoc.ParagraphStyle
# line spacing is not defined in ParagraphStyle
spacing = 2
def __init__(self, style, leader=None):
@@ -529,7 +532,7 @@ class GtkDocParagraph(GtkDocBaseElement):
layout_line = layout.get_line(splitline)
index = layout_line.start_index
# and divide the text, first create the second part
new_style = BaseDoc.ParagraphStyle(self._style)
new_style = ParagraphStyle(self._style)
new_style.set_top_margin(0)
#we split a paragraph, text should begin in correct position: no indent
#as if the paragraph just continues from normal text
@@ -809,7 +812,7 @@ class GtkDocTableCell(GtkDocBaseElement):
available_height -= child_height
if e2 is not None:
#divide the cell
new_style = BaseDoc.TableCellStyle(self._style)
new_style = TableCellStyle(self._style)
if e1 is not None:
new_style.set_top_border(False)
new_cell = GtkDocTableCell(new_style, self._span)
@@ -1114,7 +1117,7 @@ class GtkDocText(GtkDocBaseElement):
_type = 'TEXT'
_allowed_children = []
# line spacing is not defined in BaseDoc.ParagraphStyle
# line spacing is not defined in ParagraphStyle
spacing = 0
def __init__(self, style, vertical_alignment, text, x, y, angle=0):
@@ -1189,7 +1192,7 @@ class GtkDocText(GtkDocBaseElement):
# CairoDoc class
#
#------------------------------------------------------------------------
class CairoDoc(BaseDoc.BaseDoc, BaseDoc.TextDoc, BaseDoc.DrawDoc):
class CairoDoc(BaseDoc, TextDoc, DrawDoc):
"""Act as an abstract document that can render onto a cairo context.
Maintains an abstract model of the document. The root of this abstract
@@ -1421,7 +1424,7 @@ class CairoDoc(BaseDoc.BaseDoc, BaseDoc.TextDoc, BaseDoc.DrawDoc):
paragraph_style_name = style.get_paragraph_style()
if paragraph_style_name:
paragraph_style = style_sheet.get_paragraph_style(paragraph_style_name)
paragraph_style.set_alignment(BaseDoc.PARA_ALIGN_LEFT)
paragraph_style.set_alignment(PARA_ALIGN_LEFT)
# horizontal position of the text is not included in the style,
# we assume that it is the size of the shadow, or 0.2mm
@@ -1439,7 +1442,7 @@ class CairoDoc(BaseDoc.BaseDoc, BaseDoc.TextDoc, BaseDoc.DrawDoc):
style = style_sheet.get_draw_style(style_name)
paragraph_style_name = style.get_paragraph_style()
paragraph_style = style_sheet.get_paragraph_style(paragraph_style_name)
paragraph_style.set_alignment(BaseDoc.PARA_ALIGN_LEFT)
paragraph_style.set_alignment(PARA_ALIGN_LEFT)
new_text = GtkDocText(paragraph_style, 'top', text, x, y, angle=0)
self._active_element.add_child(new_text)
@@ -1449,7 +1452,7 @@ class CairoDoc(BaseDoc.BaseDoc, BaseDoc.TextDoc, BaseDoc.DrawDoc):
style = style_sheet.get_draw_style(style_name)
paragraph_style_name = style.get_paragraph_style()
paragraph_style = style_sheet.get_paragraph_style(paragraph_style_name)
paragraph_style.set_alignment(BaseDoc.PARA_ALIGN_CENTER)
paragraph_style.set_alignment(PARA_ALIGN_CENTER)
new_text = GtkDocText(paragraph_style, 'top', text, x, y, angle=0)
self._active_element.add_child(new_text)
@@ -1459,7 +1462,7 @@ class CairoDoc(BaseDoc.BaseDoc, BaseDoc.TextDoc, BaseDoc.DrawDoc):
style = style_sheet.get_draw_style(style_name)
paragraph_style_name = style.get_paragraph_style()
paragraph_style = style_sheet.get_paragraph_style(paragraph_style_name)
paragraph_style.set_alignment(BaseDoc.PARA_ALIGN_CENTER)
paragraph_style.set_alignment(PARA_ALIGN_CENTER)
new_text = GtkDocText(paragraph_style, 'center', '\n'.join(text),
x, y, angle)

View File

@@ -39,7 +39,9 @@ from gettext import gettext as _
from gen.plug import PluginManager
from gen.plug.menu import BooleanOption, NumberOption, PersonOption
from ReportBase import Report, ReportUtils, MenuReportOptions, CATEGORY_TEXT
import BaseDoc
from gen.plug.docgen import IndexMark, FontStyle, ParagraphStyle
from gen.plug.docgen.basedoc import (FONT_SANS_SERIF,
INDEX_TYPE_TOC, PARA_ALIGN_CENTER)
from BasicUtils import name_displayer
from gen.lib import ChildRefType
@@ -159,7 +161,7 @@ class AncestorReport(Report):
name = name_displayer.display_formal(self.center_person)
title = _("Ahnentafel Report for %s") % name
mark = BaseDoc.IndexMark(title, BaseDoc.INDEX_TYPE_TOC, 1)
mark = IndexMark(title, INDEX_TYPE_TOC, 1)
self.doc.start_paragraph("AHN-Title")
self.doc.write_text(title, mark)
self.doc.end_paragraph()
@@ -179,7 +181,7 @@ class AncestorReport(Report):
generation += 1
# Create the Generation title, set an index marker
mark = BaseDoc.IndexMark(title, BaseDoc.INDEX_TYPE_TOC, 2)
mark = IndexMark(title, INDEX_TYPE_TOC, 2)
self.doc.start_paragraph("AHN-Generation")
self.doc.write_text(_("Generation %d") % generation, mark)
self.doc.end_paragraph()
@@ -294,23 +296,23 @@ class AncestorOptions(MenuReportOptions):
#
# AHN-Title
#
font = BaseDoc.FontStyle()
font.set(face=BaseDoc.FONT_SANS_SERIF, size=16, bold=1)
para = BaseDoc.ParagraphStyle()
font = FontStyle()
font.set(face=FONT_SANS_SERIF, size=16, bold=1)
para = ParagraphStyle()
para.set_font(font)
para.set_header_level(1)
para.set_top_margin(0.25)
para.set_bottom_margin(0.25)
para.set_alignment(BaseDoc.PARA_ALIGN_CENTER)
para.set_alignment(PARA_ALIGN_CENTER)
para.set_description(_('The style used for the title of the page.'))
default_style.add_paragraph_style("AHN-Title", para)
#
# AHN-Generation
#
font = BaseDoc.FontStyle()
font.set(face=BaseDoc.FONT_SANS_SERIF, size=14, italic=1)
para = BaseDoc.ParagraphStyle()
font = FontStyle()
font.set(face=FONT_SANS_SERIF, size=14, italic=1)
para = ParagraphStyle()
para.set_font(font)
para.set_header_level(2)
para.set_top_margin(0.125)
@@ -321,7 +323,7 @@ class AncestorOptions(MenuReportOptions):
#
# AHN-Entry
#
para = BaseDoc.ParagraphStyle()
para = ParagraphStyle()
para.set(first_indent=-1.0, lmargin=1.0)
para.set_top_margin(0.125)
para.set_bottom_margin(0.125)

View File

@@ -35,7 +35,9 @@ import datetime, time
# GRAMPS modules
#
#------------------------------------------------------------------------
import BaseDoc
from gen.plug.docgen import FontStyle, ParagraphStyle, GraphicsStyle
from gen.plug.docgen.basedoc import (FONT_SERIF, PARA_ALIGN_RIGHT,
PARA_ALIGN_LEFT, PARA_ALIGN_CENTER)
from BasicUtils import name_displayer as _nd
from gen.plug import PluginManager
from ReportBase import Report, ReportUtils, MenuReportOptions, CATEGORY_TEXT
@@ -426,17 +428,17 @@ class CalendarOptions(MenuReportOptions):
self.__filter.set_filters(filter_list)
def make_my_style(self, default_style, name, description,
size=9, font=BaseDoc.FONT_SERIF, justified ="left",
color=None, align=BaseDoc.PARA_ALIGN_CENTER,
size=9, font=FONT_SERIF, justified ="left",
color=None, align=PARA_ALIGN_CENTER,
shadow = None, italic=0, bold=0, borders=0, indent=None):
""" Create paragraph and graphic styles of the same name """
# Paragraph:
f = BaseDoc.FontStyle()
f = FontStyle()
f.set_size(size)
f.set_type_face(font)
f.set_italic(italic)
f.set_bold(bold)
p = BaseDoc.ParagraphStyle()
p = ParagraphStyle()
p.set_font(f)
p.set_alignment(align)
p.set_description(description)
@@ -447,14 +449,14 @@ class CalendarOptions(MenuReportOptions):
if indent:
p.set(first_indent=indent)
if justified == "left":
p.set_alignment(BaseDoc.PARA_ALIGN_LEFT)
p.set_alignment(PARA_ALIGN_LEFT)
elif justified == "right":
p.set_alignment(BaseDoc.PARA_ALIGN_RIGHT)
p.set_alignment(PARA_ALIGN_RIGHT)
elif justified == "center":
p.set_alignment(BaseDoc.PARA_ALIGN_CENTER)
p.set_alignment(PARA_ALIGN_CENTER)
default_style.add_paragraph_style(name, p)
# Graphics:
g = BaseDoc.GraphicsStyle()
g = GraphicsStyle()
g.set_paragraph_style(name)
if shadow:
g.set_shadow(*shadow)

View File

@@ -44,7 +44,8 @@ from gettext import gettext as _
from gen.plug import PluginManager
from gen.plug.menu import TextOption
from ReportBase import Report, MenuReportOptions, CATEGORY_TEXT
import BaseDoc
from gen.plug.docgen import FontStyle, ParagraphStyle
from gen.plug.docgen.basedoc import (FONT_SANS_SERIF, PARA_ALIGN_CENTER)
#------------------------------------------------------------------------
#

View File

@@ -39,7 +39,9 @@ from gettext import gettext as _
from gen.plug import PluginManager
from gen.plug.menu import NumberOption, PersonOption
from ReportBase import Report, ReportUtils, MenuReportOptions, CATEGORY_TEXT
import BaseDoc
from gen.plug.docgen import IndexMark, FontStyle, ParagraphStyle
from gen.plug.docgen.basedoc import (FONT_SANS_SERIF,
INDEX_TYPE_TOC, PARA_ALIGN_CENTER)
import Sort
from BasicUtils import name_displayer
import DateHandler

View File

@@ -43,7 +43,9 @@ from gen.plug import PluginManager
from gen.plug.menu import BooleanOption, NumberOption, PersonOption
from ReportBase import Report, ReportUtils, MenuReportOptions, CATEGORY_TEXT
from ReportBase import Bibliography, Endnotes
import BaseDoc
from gen.plug.docgen import IndexMark, FontStyle, ParagraphStyle
from gen.plug.docgen.basedoc import (FONT_SANS_SERIF, FONT_SERIF,
INDEX_TYPE_TOC, PARA_ALIGN_CENTER)
import DateHandler
from BasicUtils import name_displayer as _nd
import Utils
@@ -150,7 +152,7 @@ class DetAncestorReport(Report):
name = _nd.display_name(self.center_person.get_primary_name())
self.doc.start_paragraph("DAR-Title")
title = _("Ancestral Report for %s") % name
mark = BaseDoc.IndexMark(title,BaseDoc.INDEX_TYPE_TOC,1)
mark = IndexMark(title,INDEX_TYPE_TOC,1)
self.doc.write_text(title,mark)
self.doc.end_paragraph()
@@ -163,7 +165,7 @@ class DetAncestorReport(Report):
self.doc.page_break()
self.doc.start_paragraph("DAR-Generation")
text = _("Generation %d") % (generation+1)
mark = BaseDoc.IndexMark(text, BaseDoc.INDEX_TYPE_TOC, 2)
mark = IndexMark(text, INDEX_TYPE_TOC, 2)
self.doc.write_text(text, mark)
self.doc.end_paragraph()
generation = generation + 1
@@ -798,20 +800,20 @@ class DetAncestorOptions(MenuReportOptions):
def make_default_style(self,default_style):
"""Make the default output style for the Detailed Ancestral Report"""
font = BaseDoc.FontStyle()
font.set(face=BaseDoc.FONT_SANS_SERIF,size=16,bold=1)
para = BaseDoc.ParagraphStyle()
font = FontStyle()
font.set(face=FONT_SANS_SERIF,size=16,bold=1)
para = ParagraphStyle()
para.set_font(font)
para.set_header_level(1)
para.set_top_margin(0.25)
para.set_bottom_margin(0.25)
para.set_alignment(BaseDoc.PARA_ALIGN_CENTER)
para.set_alignment(PARA_ALIGN_CENTER)
para.set_description(_('The style used for the title of the page.'))
default_style.add_paragraph_style("DAR-Title",para)
font = BaseDoc.FontStyle()
font.set(face=BaseDoc.FONT_SANS_SERIF,size=14,italic=1)
para = BaseDoc.ParagraphStyle()
font = FontStyle()
font.set(face=FONT_SANS_SERIF,size=14,italic=1)
para = ParagraphStyle()
para.set_font(font)
para.set_header_level(2)
para.set_top_margin(0.25)
@@ -819,9 +821,9 @@ class DetAncestorOptions(MenuReportOptions):
para.set_description(_('The style used for the generation header.'))
default_style.add_paragraph_style("DAR-Generation",para)
font = BaseDoc.FontStyle()
font.set(face=BaseDoc.FONT_SANS_SERIF,size=10,italic=0, bold=1)
para = BaseDoc.ParagraphStyle()
font = FontStyle()
font.set(face=FONT_SANS_SERIF,size=10,italic=0, bold=1)
para = ParagraphStyle()
para.set_font(font)
para.set_left_margin(1.0) # in centimeters
para.set_top_margin(0.25)
@@ -829,9 +831,9 @@ class DetAncestorOptions(MenuReportOptions):
para.set_description(_('The style used for the children list title.'))
default_style.add_paragraph_style("DAR-ChildTitle",para)
font = BaseDoc.FontStyle()
font = FontStyle()
font.set(size=10)
para = BaseDoc.ParagraphStyle()
para = ParagraphStyle()
para.set_font(font)
para.set(first_indent=-0.75,lmargin=1.75)
para.set_top_margin(0.25)
@@ -839,32 +841,32 @@ class DetAncestorOptions(MenuReportOptions):
para.set_description(_('The style used for the children list.'))
default_style.add_paragraph_style("DAR-ChildList",para)
font = BaseDoc.FontStyle()
font.set(face=BaseDoc.FONT_SANS_SERIF,size=10,italic=0, bold=1)
para = BaseDoc.ParagraphStyle()
font = FontStyle()
font.set(face=FONT_SANS_SERIF,size=10,italic=0, bold=1)
para = ParagraphStyle()
para.set_font(font)
para.set(first_indent=0.0,lmargin=1.0)
para.set_top_margin(0.25)
para.set_bottom_margin(0.25)
default_style.add_paragraph_style("DAR-NoteHeader",para)
para = BaseDoc.ParagraphStyle()
para = ParagraphStyle()
para.set(lmargin=1.0)
para.set_top_margin(0.25)
para.set_bottom_margin(0.25)
para.set_description(_('The basic style used for the text display.'))
default_style.add_paragraph_style("DAR-Entry",para)
para = BaseDoc.ParagraphStyle()
para = ParagraphStyle()
para.set(first_indent=-1.0,lmargin=1.0)
para.set_top_margin(0.25)
para.set_bottom_margin(0.25)
para.set_description(_('The style used for the first personal entry.'))
default_style.add_paragraph_style("DAR-First-Entry",para)
font = BaseDoc.FontStyle()
font.set(size=10,face=BaseDoc.FONT_SANS_SERIF,bold=1)
para = BaseDoc.ParagraphStyle()
font = FontStyle()
font.set(size=10,face=FONT_SANS_SERIF,bold=1)
para = ParagraphStyle()
para.set_font(font)
para.set(first_indent=0.0,lmargin=1.0)
para.set_top_margin(0.25)
@@ -872,9 +874,9 @@ class DetAncestorOptions(MenuReportOptions):
para.set_description(_('The style used for the More About header.'))
default_style.add_paragraph_style("DAR-MoreHeader",para)
font = BaseDoc.FontStyle()
font.set(face=BaseDoc.FONT_SERIF,size=10)
para = BaseDoc.ParagraphStyle()
font = FontStyle()
font.set(face=FONT_SERIF,size=10)
para = ParagraphStyle()
para.set_font(font)
para.set(first_indent=0.0,lmargin=1.0)
para.set_top_margin(0.25)

View File

@@ -44,7 +44,9 @@ from gen.plug import PluginManager
from gen.plug.menu import BooleanOption, NumberOption, PersonOption
from ReportBase import Report, ReportUtils, MenuReportOptions, CATEGORY_TEXT
from ReportBase import Bibliography, Endnotes
import BaseDoc
from gen.plug.docgen import IndexMark, FontStyle, ParagraphStyle
from gen.plug.docgen.basedoc import (FONT_SANS_SERIF, FONT_SERIF,
INDEX_TYPE_TOC, PARA_ALIGN_CENTER)
import DateHandler
from BasicUtils import name_displayer as _nd
import Utils
@@ -205,7 +207,7 @@ class DetDescendantReport(Report):
title = _("Descendant Report for %(person_name)s") % {
'person_name' : name }
mark = BaseDoc.IndexMark(title, BaseDoc.INDEX_TYPE_TOC, 1)
mark = IndexMark(title, INDEX_TYPE_TOC, 1)
self.doc.write_text(title, mark)
self.doc.end_paragraph()
@@ -217,7 +219,7 @@ class DetDescendantReport(Report):
self.doc.page_break()
self.doc.start_paragraph("DDR-Generation")
text = _("Generation %d") % (generation+1)
mark = BaseDoc.IndexMark(text, BaseDoc.INDEX_TYPE_TOC, 2)
mark = IndexMark(text, INDEX_TYPE_TOC, 2)
self.doc.write_text(text, mark)
self.doc.end_paragraph()
if self.childref:
@@ -833,20 +835,20 @@ class DetDescendantOptions(MenuReportOptions):
def make_default_style(self, default_style):
"""Make the default output style for the Detailed Ancestral Report"""
font = BaseDoc.FontStyle()
font.set(face=BaseDoc.FONT_SANS_SERIF, size=16, bold=1)
para = BaseDoc.ParagraphStyle()
font = FontStyle()
font.set(face=FONT_SANS_SERIF, size=16, bold=1)
para = ParagraphStyle()
para.set_font(font)
para.set_header_level(1)
para.set_top_margin(0.25)
para.set_bottom_margin(0.25)
para.set_alignment(BaseDoc.PARA_ALIGN_CENTER)
para.set_alignment(PARA_ALIGN_CENTER)
para.set_description(_('The style used for the title of the page.'))
default_style.add_paragraph_style("DDR-Title", para)
font = BaseDoc.FontStyle()
font.set(face=BaseDoc.FONT_SANS_SERIF, size=14, italic=1)
para = BaseDoc.ParagraphStyle()
font = FontStyle()
font.set(face=FONT_SANS_SERIF, size=14, italic=1)
para = ParagraphStyle()
para.set_font(font)
para.set_header_level(2)
para.set_top_margin(0.25)
@@ -854,9 +856,9 @@ class DetDescendantOptions(MenuReportOptions):
para.set_description(_('The style used for the generation header.'))
default_style.add_paragraph_style("DDR-Generation", para)
font = BaseDoc.FontStyle()
font.set(face=BaseDoc.FONT_SANS_SERIF, size=10, italic=0, bold=1)
para = BaseDoc.ParagraphStyle()
font = FontStyle()
font.set(face=FONT_SANS_SERIF, size=10, italic=0, bold=1)
para = ParagraphStyle()
para.set_font(font)
para.set_left_margin(1.5) # in centimeters
para.set_top_margin(0.25)
@@ -864,9 +866,9 @@ class DetDescendantOptions(MenuReportOptions):
para.set_description(_('The style used for the children list title.'))
default_style.add_paragraph_style("DDR-ChildTitle", para)
font = BaseDoc.FontStyle()
font = FontStyle()
font.set(size=10)
para = BaseDoc.ParagraphStyle()
para = ParagraphStyle()
para.set_font(font)
para.set(first_indent=-0.75, lmargin=2.25)
para.set_top_margin(0.125)
@@ -874,32 +876,32 @@ class DetDescendantOptions(MenuReportOptions):
para.set_description(_('The style used for the children list.'))
default_style.add_paragraph_style("DDR-ChildList", para)
font = BaseDoc.FontStyle()
font.set(face=BaseDoc.FONT_SANS_SERIF, size=10, italic=0, bold=1)
para = BaseDoc.ParagraphStyle()
font = FontStyle()
font.set(face=FONT_SANS_SERIF, size=10, italic=0, bold=1)
para = ParagraphStyle()
para.set_font(font)
para.set(first_indent=0.0, lmargin=1.5)
para.set_top_margin(0.25)
para.set_bottom_margin(0.25)
default_style.add_paragraph_style("DDR-NoteHeader", para)
para = BaseDoc.ParagraphStyle()
para = ParagraphStyle()
para.set(lmargin=1.5)
para.set_top_margin(0.25)
para.set_bottom_margin(0.25)
para.set_description(_('The basic style used for the text display.'))
default_style.add_paragraph_style("DDR-Entry", para)
para = BaseDoc.ParagraphStyle()
para = ParagraphStyle()
para.set(first_indent=-1.5, lmargin=1.5)
para.set_top_margin(0.25)
para.set_bottom_margin(0.25)
para.set_description(_('The style used for the first personal entry.'))
default_style.add_paragraph_style("DDR-First-Entry", para)
font = BaseDoc.FontStyle()
font.set(size=10, face=BaseDoc.FONT_SANS_SERIF, bold=1)
para = BaseDoc.ParagraphStyle()
font = FontStyle()
font.set(size=10, face=FONT_SANS_SERIF, bold=1)
para = ParagraphStyle()
para.set_font(font)
para.set(first_indent=0.0, lmargin=1.5)
para.set_top_margin(0.25)
@@ -907,9 +909,9 @@ class DetDescendantOptions(MenuReportOptions):
para.set_description(_('The style used for the More About header.'))
default_style.add_paragraph_style("DDR-MoreHeader", para)
font = BaseDoc.FontStyle()
font.set(face=BaseDoc.FONT_SERIF, size=10)
para = BaseDoc.ParagraphStyle()
font = FontStyle()
font.set(face=FONT_SERIF, size=10)
para = ParagraphStyle()
para.set_font(font)
para.set(first_indent=0.0, lmargin=1.5)
para.set_top_margin(0.25)

View File

@@ -37,7 +37,10 @@ from gettext import gettext as _
from gen.plug import PluginManager
from gen.plug.menu import PersonOption
from ReportBase import Report, ReportUtils, MenuReportOptions, CATEGORY_TEXT
import BaseDoc
from gen.plug.docgen import IndexMark, FontStyle, ParagraphStyle, TableStyle,\
TableCellStyle
from gen.plug.docgen.basedoc import (FONT_SANS_SERIF, INDEX_TYPE_TOC,
PARA_ALIGN_CENTER)
from BasicUtils import name_displayer
import DateHandler

View File

@@ -32,7 +32,10 @@ import gen.lib
from gen.plug import PluginManager
from gen.plug.menu import BooleanOption, FamilyOption
from ReportBase import Report, ReportUtils, MenuReportOptions, CATEGORY_TEXT
import BaseDoc
from gen.plug.docgen import IndexMark, FontStyle, ParagraphStyle, TableStyle,\
TableCellStyle
from gen.plug.docgen.basedoc import (FONT_SANS_SERIF, FONT_SERIF,
INDEX_TYPE_TOC, PARA_ALIGN_CENTER)
import DateHandler
from TransUtils import sgettext as _
from BasicUtils import name_displayer as _nd

View File

@@ -35,7 +35,10 @@ from gettext import gettext as _
#
#------------------------------------------------------------------------
import gen.lib
import BaseDoc
from gen.plug.docgen import IndexMark, FontStyle, ParagraphStyle, TableStyle,\
TableCellStyle
from gen.plug.docgen.basedoc import (FONT_SANS_SERIF, INDEX_TYPE_TOC,
PARA_ALIGN_CENTER)
import DateHandler
from gen.plug import PluginManager
from gen.plug.menu import BooleanOption, FilterOption, PersonOption
@@ -398,7 +401,7 @@ class IndivCompleteReport(Report):
media_list = self.person.get_media_list()
name = _nd.display(self.person)
title = _("Summary of %s") % name
mark = BaseDoc.IndexMark(title,BaseDoc.INDEX_TYPE_TOC,1)
mark = IndexMark(title, INDEX_TYPE_TOC, 1)
self.doc.start_paragraph("IDS-Title")
self.doc.write_text(title,mark)
self.doc.end_paragraph()
@@ -555,44 +558,44 @@ class IndivCompleteOptions(MenuReportOptions):
def make_default_style(self,default_style):
"""Make the default output style for the Individual Complete Report."""
# Paragraph Styles
font = BaseDoc.FontStyle()
font = FontStyle()
font.set_bold(1)
font.set_type_face(BaseDoc.FONT_SANS_SERIF)
font.set_type_face(FONT_SANS_SERIF)
font.set_size(16)
p = BaseDoc.ParagraphStyle()
p.set_alignment(BaseDoc.PARA_ALIGN_CENTER)
p = ParagraphStyle()
p.set_alignment(PARA_ALIGN_CENTER)
p.set_top_margin(ReportUtils.pt2cm(8))
p.set_bottom_margin(ReportUtils.pt2cm(8))
p.set_font(font)
p.set_description(_("The style used for the title of the page."))
default_style.add_paragraph_style("IDS-Title",p)
font = BaseDoc.FontStyle()
font = FontStyle()
font.set_bold(1)
font.set_type_face(BaseDoc.FONT_SANS_SERIF)
font.set_type_face(FONT_SANS_SERIF)
font.set_size(12)
font.set_italic(1)
p = BaseDoc.ParagraphStyle()
p = ParagraphStyle()
p.set_font(font)
p.set_top_margin(ReportUtils.pt2cm(3))
p.set_bottom_margin(ReportUtils.pt2cm(3))
p.set_description(_("The style used for category labels."))
default_style.add_paragraph_style("IDS-TableTitle",p)
font = BaseDoc.FontStyle()
font = FontStyle()
font.set_bold(1)
font.set_type_face(BaseDoc.FONT_SANS_SERIF)
font.set_type_face(FONT_SANS_SERIF)
font.set_size(12)
p = BaseDoc.ParagraphStyle()
p = ParagraphStyle()
p.set_font(font)
p.set_top_margin(ReportUtils.pt2cm(3))
p.set_bottom_margin(ReportUtils.pt2cm(3))
p.set_description(_("The style used for the spouse's name."))
default_style.add_paragraph_style("IDS-Spouse",p)
font = BaseDoc.FontStyle()
font = FontStyle()
font.set_size(12)
p = BaseDoc.ParagraphStyle()
p = ParagraphStyle()
p.set_font(font)
p.set_top_margin(ReportUtils.pt2cm(3))
p.set_bottom_margin(ReportUtils.pt2cm(3))
@@ -600,29 +603,29 @@ class IndivCompleteOptions(MenuReportOptions):
default_style.add_paragraph_style("IDS-Normal",p)
# Table Styles
tbl = BaseDoc.TableStyle()
tbl = TableStyle()
tbl.set_width(100)
tbl.set_columns(2)
tbl.set_column_width(0,20)
tbl.set_column_width(1,80)
default_style.add_table_style("IDS-IndTable",tbl)
tbl = BaseDoc.TableStyle()
tbl = TableStyle()
tbl.set_width(100)
tbl.set_columns(2)
tbl.set_column_width(0,50)
tbl.set_column_width(1,50)
default_style.add_table_style("IDS-ParentsTable",tbl)
cell = BaseDoc.TableCellStyle()
cell = TableCellStyle()
cell.set_top_border(1)
cell.set_bottom_border(1)
default_style.add_cell_style("IDS-TableHead",cell)
cell = BaseDoc.TableCellStyle()
cell = TableCellStyle()
default_style.add_cell_style("IDS-NormalCell",cell)
cell = BaseDoc.TableCellStyle()
cell = TableCellStyle()
cell.set_longlist(1)
default_style.add_cell_style("IDS-ListCell",cell)

View File

@@ -39,7 +39,9 @@ from string import capitalize
from gen.plug import PluginManager
from gen.plug.menu import NumberOption, BooleanOption, PersonOption
from ReportBase import Report, ReportUtils, MenuReportOptions, CATEGORY_TEXT
import BaseDoc
from gen.plug.docgen import IndexMark, FontStyle, ParagraphStyle
from gen.plug.docgen.basedoc import (FONT_SANS_SERIF,
INDEX_TYPE_TOC, PARA_ALIGN_CENTER)
from BasicUtils import name_displayer
import DateHandler
@@ -97,7 +99,7 @@ class KinshipReport(Report):
self.doc.start_paragraph("KIN-Title")
title = _("Kinship Report for %s") % pname
mark = BaseDoc.IndexMark(title, BaseDoc.INDEX_TYPE_TOC, 1)
mark = IndexMark(title, INDEX_TYPE_TOC, 1)
self.doc.write_text(title, mark)
self.doc.end_paragraph()
@@ -282,7 +284,7 @@ class KinshipReport(Report):
cap_title = capitalize(title)
subtitle = "%s (%d)" % (cap_title, len(people_handles))
self.doc.start_paragraph("KIN-Subtitle")
mark = BaseDoc.IndexMark(cap_title, BaseDoc.INDEX_TYPE_TOC, 2)
mark = IndexMark(cap_title, INDEX_TYPE_TOC, 2)
self.doc.write_text(subtitle, mark)
self.doc.end_paragraph()
for person_handle in people_handles:
@@ -360,31 +362,31 @@ class KinshipOptions(MenuReportOptions):
def make_default_style(self,default_style):
"""Make the default output style for the Kinship Report."""
f = BaseDoc.FontStyle()
f = FontStyle()
f.set_size(16)
f.set_type_face(BaseDoc.FONT_SANS_SERIF)
f.set_type_face(FONT_SANS_SERIF)
f.set_bold(1)
p = BaseDoc.ParagraphStyle()
p = ParagraphStyle()
p.set_header_level(1)
p.set_bottom_border(1)
p.set_bottom_margin(ReportUtils.pt2cm(8))
p.set_font(f)
p.set_alignment(BaseDoc.PARA_ALIGN_CENTER)
p.set_alignment(PARA_ALIGN_CENTER)
p.set_description(_("The style used for the title of the page."))
default_style.add_paragraph_style("KIN-Title",p)
font = BaseDoc.FontStyle()
font = FontStyle()
font.set_size(12)
font.set_bold(True)
p = BaseDoc.ParagraphStyle()
p = ParagraphStyle()
p.set_font(font)
p.set_top_margin(ReportUtils.pt2cm(6))
p.set_description(_('The basic style used for sub-headings.'))
default_style.add_paragraph_style("KIN-Subtitle",p)
font = BaseDoc.FontStyle()
font = FontStyle()
font.set_size(10)
p = BaseDoc.ParagraphStyle()
p = ParagraphStyle()
p.set_font(font)
p.set_left_margin(0.5)
p.set_description(_('The basic style used for the text display.'))

View File

@@ -38,7 +38,10 @@ from gettext import gettext as _
from gen.plug import PluginManager
from gen.plug.menu import EnumeratedListOption
from ReportBase import Report, ReportUtils, MenuReportOptions, CATEGORY_TEXT
import BaseDoc
from gen.plug.docgen import IndexMark, FontStyle, ParagraphStyle,\
TableStyle, TableCellStyle
from gen.plug.docgen.basedoc import (FONT_SANS_SERIF,
INDEX_TYPE_TOC, PARA_ALIGN_CENTER)
from gen.lib import MarkerType
from Filters import GenericFilterFactory, Rules
from BasicUtils import name_displayer
@@ -79,7 +82,7 @@ class MarkerReport(Report):
self.doc.start_paragraph("MR-Title")
title = _("Marker Report for %s Items") % markerstr
mark = BaseDoc.IndexMark(title, BaseDoc.INDEX_TYPE_TOC, 1)
mark = IndexMark(title, INDEX_TYPE_TOC, 1)
self.doc.write_text(title, mark)
self.doc.end_paragraph()
@@ -100,7 +103,7 @@ class MarkerReport(Report):
self.doc.start_paragraph("MR-Heading")
header = _("People")
mark = BaseDoc.IndexMark(header, BaseDoc.INDEX_TYPE_TOC, 2)
mark = IndexMark(header, INDEX_TYPE_TOC, 2)
self.doc.write_text(header, mark)
self.doc.end_paragraph()
@@ -187,7 +190,7 @@ class MarkerReport(Report):
self.doc.start_paragraph("MR-Heading")
header = _("Families")
mark = BaseDoc.IndexMark(header,BaseDoc.INDEX_TYPE_TOC, 2)
mark = IndexMark(header,INDEX_TYPE_TOC, 2)
self.doc.write_text(header, mark)
self.doc.end_paragraph()
@@ -277,7 +280,7 @@ class MarkerReport(Report):
self.doc.start_paragraph("MR-Heading")
header = _("Events")
mark = BaseDoc.IndexMark(header, BaseDoc.INDEX_TYPE_TOC, 2)
mark = IndexMark(header, INDEX_TYPE_TOC, 2)
self.doc.write_text(header, mark)
self.doc.end_paragraph()
@@ -363,7 +366,7 @@ class MarkerReport(Report):
self.doc.start_paragraph("MR-Heading")
header = _("Notes")
mark = BaseDoc.IndexMark(header, BaseDoc.INDEX_TYPE_TOC, 2)
mark = IndexMark(header, INDEX_TYPE_TOC, 2)
self.doc.write_text(header ,mark)
self.doc.end_paragraph()
@@ -452,23 +455,23 @@ class MarkerOptions(MenuReportOptions):
def make_default_style(self,default_style):
"""Make the default output style for the Marker Report."""
# Paragraph Styles
f = BaseDoc.FontStyle()
f = FontStyle()
f.set_size(16)
f.set_type_face(BaseDoc.FONT_SANS_SERIF)
f.set_type_face(FONT_SANS_SERIF)
f.set_bold(1)
p = BaseDoc.ParagraphStyle()
p = ParagraphStyle()
p.set_header_level(1)
p.set_bottom_border(1)
p.set_top_margin(ReportUtils.pt2cm(3))
p.set_bottom_margin(ReportUtils.pt2cm(3))
p.set_font(f)
p.set_alignment(BaseDoc.PARA_ALIGN_CENTER)
p.set_alignment(PARA_ALIGN_CENTER)
p.set_description(_("The style used for the title of the page."))
default_style.add_paragraph_style("MR-Title", p)
font = BaseDoc.FontStyle()
font.set(face=BaseDoc.FONT_SANS_SERIF, size=14, italic=1)
para = BaseDoc.ParagraphStyle()
font = FontStyle()
font.set(face=FONT_SANS_SERIF, size=14, italic=1)
para = ParagraphStyle()
para.set_font(font)
para.set_header_level(2)
para.set_top_margin(0.25)
@@ -476,9 +479,9 @@ class MarkerOptions(MenuReportOptions):
para.set_description(_('The style used for the section headers.'))
default_style.add_paragraph_style("MR-Heading", para)
font = BaseDoc.FontStyle()
font = FontStyle()
font.set_size(12)
p = BaseDoc.ParagraphStyle()
p = ParagraphStyle()
p.set(first_indent=-0.75, lmargin=.75)
p.set_font(font)
p.set_top_margin(ReportUtils.pt2cm(3))
@@ -486,10 +489,10 @@ class MarkerOptions(MenuReportOptions):
p.set_description(_('The basic style used for the text display.'))
default_style.add_paragraph_style("MR-Normal", p)
font = BaseDoc.FontStyle()
font = FontStyle()
font.set_size(12)
font.set_bold(True)
p = BaseDoc.ParagraphStyle()
p = ParagraphStyle()
p.set(first_indent=-0.75, lmargin=.75)
p.set_font(font)
p.set_top_margin(ReportUtils.pt2cm(3))
@@ -497,7 +500,7 @@ class MarkerOptions(MenuReportOptions):
p.set_description(_('The basic style used for table headings.'))
default_style.add_paragraph_style("MR-Normal-Bold", p)
para = BaseDoc.ParagraphStyle()
para = ParagraphStyle()
p.set(first_indent=-0.75, lmargin=.75)
para.set_top_margin(ReportUtils.pt2cm(3))
para.set_bottom_margin(ReportUtils.pt2cm(3))
@@ -505,10 +508,10 @@ class MarkerOptions(MenuReportOptions):
default_style.add_paragraph_style("MR-Note",para)
#Table Styles
cell = BaseDoc.TableCellStyle()
cell = TableCellStyle()
default_style.add_cell_style('MR-TableCell', cell)
table = BaseDoc.TableStyle()
table = TableStyle()
table.set_width(100)
table.set_columns(4)
table.set_column_width(0, 10)

View File

@@ -44,7 +44,9 @@ from gen.plug import PluginManager
from gen.plug.menu import PersonOption
from ReportBase import Report, MenuReportOptions, ReportUtils, CATEGORY_TEXT
from BasicUtils import name_displayer
import BaseDoc
from gen.plug.docgen import IndexMark, FontStyle, ParagraphStyle
from gen.plug.docgen.basedoc import (FONT_SANS_SERIF, PARA_ALIGN_CENTER,
INDEX_TYPE_TOC)
#------------------------------------------------------------------------
#
@@ -83,7 +85,7 @@ class NumberOfAncestorsReport(Report):
self.doc.start_paragraph("NOA-Title")
name = name_displayer.display(self.__person)
title = _("Number of Ancestors for %s") % name
mark = BaseDoc.IndexMark(title, BaseDoc.INDEX_TYPE_TOC, 1)
mark = IndexMark(title, INDEX_TYPE_TOC, 1)
self.doc.write_text(title, mark)
self.doc.end_paragraph()
@@ -175,22 +177,22 @@ class NumberOfAncestorsOptions(MenuReportOptions):
def make_default_style(self, default_style):
"""Make the default output style for the Number of Ancestors Report."""
font = BaseDoc.FontStyle()
font = FontStyle()
font.set_size(16)
font.set_type_face(BaseDoc.FONT_SANS_SERIF)
font.set_type_face(FONT_SANS_SERIF)
font.set_bold(1)
para = BaseDoc.ParagraphStyle()
para = ParagraphStyle()
para.set_header_level(1)
para.set_bottom_border(1)
para.set_bottom_margin(ReportUtils.pt2cm(8))
para.set_font(font)
para.set_alignment(BaseDoc.PARA_ALIGN_CENTER)
para.set_alignment(PARA_ALIGN_CENTER)
para.set_description(_("The style used for the title of the page."))
default_style.add_paragraph_style("NOA-Title", para)
font = BaseDoc.FontStyle()
font = FontStyle()
font.set_size(12)
para = BaseDoc.ParagraphStyle()
para = ParagraphStyle()
para.set_font(font)
para.set_description(_('The basic style used for the text display.'))
default_style.add_paragraph_style("NOA-Normal", para)

View File

@@ -37,7 +37,10 @@ from gettext import gettext as _
from gen.plug import PluginManager
from gen.plug.menu import FilterOption, PlaceListOption
from ReportBase import Report, MenuReportOptions, CATEGORY_TEXT
import BaseDoc
from gen.plug.docgen import IndexMark, FontStyle, ParagraphStyle, TableStyle,\
TableCellStyle
from gen.plug.docgen.basedoc import (FONT_SANS_SERIF, FONT_SERIF,
INDEX_TYPE_TOC, PARA_ALIGN_CENTER)
import DateHandler
import Sort
from BasicUtils import name_displayer as _nd
@@ -91,7 +94,7 @@ class PlaceReport(Report):
# identified as a major category if this is included in a Book report.
title = _("Place Report")
mark = BaseDoc.IndexMark(title, BaseDoc.INDEX_TYPE_TOC, 1)
mark = IndexMark(title, INDEX_TYPE_TOC, 1)
self.doc.start_paragraph("PLC-ReportTitle")
self.doc.write_text(title, mark)
self.doc.end_paragraph()
@@ -284,14 +287,14 @@ class PlaceOptions(MenuReportOptions):
"""
Define the style used for the report title
"""
font = BaseDoc.FontStyle()
font.set(face=BaseDoc.FONT_SANS_SERIF, size=16, bold=1)
para = BaseDoc.ParagraphStyle()
font = FontStyle()
font.set(face=FONT_SANS_SERIF, size=16, bold=1)
para = ParagraphStyle()
para.set_font(font)
para.set_header_level(1)
para.set_top_margin(0.25)
para.set_bottom_margin(0.25)
para.set_alignment(BaseDoc.PARA_ALIGN_CENTER)
para.set_alignment(PARA_ALIGN_CENTER)
para.set_description(_('The style used for the title of the report.'))
self.default_style.add_paragraph_style("PLC-ReportTitle", para)
@@ -299,9 +302,9 @@ class PlaceOptions(MenuReportOptions):
"""
Define the style used for the place title
"""
font = BaseDoc.FontStyle()
font.set(face=BaseDoc.FONT_SERIF, size=12, italic=0, bold=1)
para = BaseDoc.ParagraphStyle()
font = FontStyle()
font.set(face=FONT_SERIF, size=12, italic=0, bold=1)
para = ParagraphStyle()
para.set_font(font)
para.set(first_indent=-1.5, lmargin=1.5)
para.set_top_margin(0.75)
@@ -313,9 +316,9 @@ class PlaceOptions(MenuReportOptions):
"""
Define the style used for the place details
"""
font = BaseDoc.FontStyle()
font.set(face=BaseDoc.FONT_SERIF, size=10)
para = BaseDoc.ParagraphStyle()
font = FontStyle()
font.set(face=FONT_SERIF, size=10)
para = ParagraphStyle()
para.set_font(font)
para.set(first_indent=0.0, lmargin=1.5)
para.set_description(_('The style used for place details.'))
@@ -325,9 +328,9 @@ class PlaceOptions(MenuReportOptions):
"""
Define the style used for the event table column title
"""
font = BaseDoc.FontStyle()
font.set(face=BaseDoc.FONT_SERIF, size=10, bold=1)
para = BaseDoc.ParagraphStyle()
font = FontStyle()
font.set(face=FONT_SERIF, size=10, bold=1)
para = ParagraphStyle()
para.set_font(font)
para.set(first_indent=-1.5, lmargin=1.5)
para.set_description(_('The style used for a column title.'))
@@ -337,9 +340,9 @@ class PlaceOptions(MenuReportOptions):
"""
Define the style used for each section
"""
font = BaseDoc.FontStyle()
font.set(face=BaseDoc.FONT_SERIF, size=10, italic=0, bold=0)
para = BaseDoc.ParagraphStyle()
font = FontStyle()
font.set(face=FONT_SERIF, size=10, italic=0, bold=0)
para = ParagraphStyle()
para.set_font(font)
para.set(first_indent=-1.5, lmargin=1.5)
para.set_top_margin(0.5)
@@ -351,7 +354,7 @@ class PlaceOptions(MenuReportOptions):
"""
Define the style used for event table
"""
table = BaseDoc.TableStyle()
table = TableStyle()
table.set_width(80)
table.set_columns(3)
table.set_column_width(0, 20)
@@ -363,9 +366,9 @@ class PlaceOptions(MenuReportOptions):
"""
Define the style used for person and event details
"""
font = BaseDoc.FontStyle()
font.set(face=BaseDoc.FONT_SERIF, size=10)
para = BaseDoc.ParagraphStyle()
font = FontStyle()
font.set(face=FONT_SERIF, size=10)
para = ParagraphStyle()
para.set_font(font)
para.set_description(_('The style used for event and person details.'))
self.default_style.add_paragraph_style("PLC-Details", para)
@@ -374,14 +377,14 @@ class PlaceOptions(MenuReportOptions):
"""
Define the style used for cells in the event table
"""
cell = BaseDoc.TableCellStyle()
cell = TableCellStyle()
self.default_style.add_cell_style("PLC-Cell", cell)
def __table_column_style(self):
"""
Define the style used for event table columns
"""
cell = BaseDoc.TableCellStyle()
cell = TableCellStyle()
cell.set_bottom_border(1)
self.default_style.add_cell_style('PLC-TableColumn', cell)

View File

@@ -37,7 +37,8 @@ from gen.plug import PluginManager
from gen.plug.menu import StringOption, MediaOption, NumberOption
from Utils import media_path_full
from ReportBase import Report, MenuReportOptions, CATEGORY_TEXT
import BaseDoc
from gen.plug.docgen import FontStyle, ParagraphStyle
from gen.plug.docgen.basedoc import (FONT_SANS_SERIF, PARA_ALIGN_CENTER)
#------------------------------------------------------------------------
#
@@ -143,33 +144,33 @@ class SimpleBookTitleOptions(MenuReportOptions):
def make_default_style(self, default_style):
"""Make the default output style for the Simple Boot Title report."""
font = BaseDoc.FontStyle()
font.set(face=BaseDoc.FONT_SANS_SERIF, size=16, bold=1, italic=1)
para = BaseDoc.ParagraphStyle()
font = FontStyle()
font.set(face=FONT_SANS_SERIF, size=16, bold=1, italic=1)
para = ParagraphStyle()
para.set_font(font)
para.set_header_level(1)
para.set_alignment(BaseDoc.PARA_ALIGN_CENTER)
para.set_alignment(PARA_ALIGN_CENTER)
para.set(pad=0.5)
para.set_description(_('The style used for the title of the page.'))
default_style.add_paragraph_style("SBT-Title", para)
font = BaseDoc.FontStyle()
font.set(face=BaseDoc.FONT_SANS_SERIF, size=14, italic=1)
para = BaseDoc.ParagraphStyle()
font = FontStyle()
font.set(face=FONT_SANS_SERIF, size=14, italic=1)
para = ParagraphStyle()
para.set_font(font)
para.set_header_level(2)
para.set(pad=0.5)
para.set_alignment(BaseDoc.PARA_ALIGN_CENTER)
para.set_alignment(PARA_ALIGN_CENTER)
para.set_description(_('The style used for the subtitle.'))
default_style.add_paragraph_style("SBT-Subtitle", para)
font = BaseDoc.FontStyle()
font.set(face=BaseDoc.FONT_SANS_SERIF, size=10, italic=1)
para = BaseDoc.ParagraphStyle()
font = FontStyle()
font.set(face=FONT_SANS_SERIF, size=10, italic=1)
para = ParagraphStyle()
para.set_font(font)
para.set_header_level(2)
para.set(pad=0.5)
para.set_alignment(BaseDoc.PARA_ALIGN_CENTER)
para.set_alignment(PARA_ALIGN_CENTER)
para.set_description(_('The style used for the footer.'))
default_style.add_paragraph_style("SBT-Footer", para)

View File

@@ -39,7 +39,9 @@ from gettext import gettext as _
import gen.lib
from gen.plug import PluginManager
from ReportBase import Report, ReportUtils, MenuReportOptions, CATEGORY_TEXT
import BaseDoc
from gen.plug.docgen import IndexMark, FontStyle, ParagraphStyle
from gen.plug.docgen.basedoc import (FONT_SANS_SERIF,
INDEX_TYPE_TOC, PARA_ALIGN_CENTER)
from Utils import media_path_full
import DateHandler
@@ -73,7 +75,7 @@ class SummaryReport(Report):
"""
self.doc.start_paragraph("SR-Title")
title = _("Database Summary Report")
mark = BaseDoc.IndexMark(title, BaseDoc.INDEX_TYPE_TOC, 1)
mark = IndexMark(title, INDEX_TYPE_TOC, 1)
self.doc.write_text(title, mark)
self.doc.end_paragraph()
@@ -252,32 +254,32 @@ class SummaryOptions(MenuReportOptions):
def make_default_style(self, default_style):
"""Make the default output style for the Summary Report."""
font = BaseDoc.FontStyle()
font = FontStyle()
font.set_size(16)
font.set_type_face(BaseDoc.FONT_SANS_SERIF)
font.set_type_face(FONT_SANS_SERIF)
font.set_bold(1)
para = BaseDoc.ParagraphStyle()
para = ParagraphStyle()
para.set_header_level(1)
para.set_bottom_border(1)
para.set_top_margin(ReportUtils.pt2cm(3))
para.set_bottom_margin(ReportUtils.pt2cm(3))
para.set_font(font)
para.set_alignment(BaseDoc.PARA_ALIGN_CENTER)
para.set_alignment(PARA_ALIGN_CENTER)
para.set_description(_("The style used for the title of the page."))
default_style.add_paragraph_style("SR-Title", para)
font = BaseDoc.FontStyle()
font = FontStyle()
font.set_size(12)
font.set_bold(True)
para = BaseDoc.ParagraphStyle()
para = ParagraphStyle()
para.set_font(font)
para.set_top_margin(0)
para.set_description(_('The basic style used for sub-headings.'))
default_style.add_paragraph_style("SR-Heading", para)
font = BaseDoc.FontStyle()
font = FontStyle()
font.set_size(12)
para = BaseDoc.ParagraphStyle()
para = ParagraphStyle()
para.set(first_indent=-0.75, lmargin=.75)
para.set_font(font)
para.set_top_margin(ReportUtils.pt2cm(3))