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

@@ -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))