Exemplo n.º 1
0
    def make_default_style(self, default_style):
        """Make the default output style for the Kinship Report."""
        font = FontStyle()
        font.set_size(16)
        font.set_type_face(FONT_SANS_SERIF)
        font.set_bold(1)
        para = ParagraphStyle()
        para.set_header_level(1)
        para.set_bottom_border(1)
        para.set_bottom_margin(utils.pt2cm(8))
        para.set_font(font)
        para.set_alignment(PARA_ALIGN_CENTER)
        para.set_description(_("The style used for the title of the page."))
        default_style.add_paragraph_style("KIN-Title", para)

        font = FontStyle()
        font.set_size(12)
        font.set_bold(True)
        para = ParagraphStyle()
        para.set_header_level(3)
        para.set_font(font)
        para.set_top_margin(utils.pt2cm(6))
        para.set_description(_('The basic style used for sub-headings.'))
        default_style.add_paragraph_style("KIN-Subtitle", para)

        font = FontStyle()
        font.set_size(10)
        para = ParagraphStyle()
        para.set_font(font)
        para.set_left_margin(0.5)
        para.set_description(_('The basic style used for the text display.'))
        default_style.add_paragraph_style("KIN-Normal", para)
Exemplo n.º 2
0
 def make_default_style(self, default_style):
     """Make the default output style for the Summary Report."""
     font = FontStyle()
     font.set_size(16)
     font.set_type_face(FONT_SANS_SERIF)
     font.set_bold(1)
     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(PARA_ALIGN_CENTER)
     para.set_description(_("The style used for the title of the page."))
     default_style.add_paragraph_style("SR-Title", para)
     
     font = FontStyle()
     font.set_size(12)
     font.set_bold(True)
     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 = FontStyle()
     font.set_size(12)
     para = ParagraphStyle()
     para.set(first_indent=-0.75, lmargin=.75)
     para.set_font(font)
     para.set_top_margin(ReportUtils.pt2cm(3))
     para.set_bottom_margin(ReportUtils.pt2cm(3))
     para.set_description(_('The basic style used for the text display.'))
     default_style.add_paragraph_style("SR-Normal", para)
Exemplo n.º 3
0
    def make_default_style(self, default_style):
        """Make the default output style for the Person Everything Report."""
        font = FontStyle()
        font.set(face=FONT_SANS_SERIF, size=12, bold=1)
        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(PARA_ALIGN_CENTER)
        para.set_description(_("The style used for the title of the page."))
        default_style.add_paragraph_style("PE-Title", para)

        font = FontStyle()
        font.set(face=FONT_SERIF, size=10)
        for i in range(1, 33):
            para = ParagraphStyle()
            para.set_font(font)
            para.set_top_margin(ReportUtils.pt2cm(font.get_size()*0.125))
            para.set_bottom_margin(ReportUtils.pt2cm(font.get_size()*0.125))
            para.set_left_margin(min(10.0, float(i-1.0)))
            para.set_description(_("The style used for the "
                                "level %d display.") % i)
            default_style.add_paragraph_style("PE-Level%d" % min(i, 32), para)

        add_endnote_styles(default_style)
Exemplo n.º 4
0
    def make_default_style(self, default_style):
        """Make the default output style for the Kinship Report."""
        font = FontStyle()
        font.set_size(16)
        font.set_type_face(FONT_SANS_SERIF)
        font.set_bold(1)
        para = ParagraphStyle()
        para.set_header_level(1)
        para.set_bottom_border(1)
        para.set_bottom_margin(utils.pt2cm(8))
        para.set_font(font)
        para.set_alignment(PARA_ALIGN_CENTER)
        para.set_description(_("The style used for the title."))
        default_style.add_paragraph_style("KIN-Title", para)

        font = FontStyle()
        font.set_size(12)
        font.set_bold(True)
        para = ParagraphStyle()
        para.set_header_level(3)
        para.set_font(font)
        para.set_top_margin(utils.pt2cm(6))
        para.set_description(_('The style used for second level headings.'))
        default_style.add_paragraph_style("KIN-Subtitle", para)

        font = FontStyle()
        font.set_size(10)
        para = ParagraphStyle()
        para.set_font(font)
        para.set_left_margin(0.5)
        para.set_description(_('The basic style used for the text display.'))
        default_style.add_paragraph_style("KIN-Normal", para)
Exemplo n.º 5
0
    def make_default_style(self, default_style):
        """Make the default output style for the Person Everything Report."""
        font = FontStyle()
        font.set(face=FONT_SANS_SERIF, size=12, bold=1)
        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(PARA_ALIGN_CENTER)
        para.set_description(_("The style used for the title of the page."))
        default_style.add_paragraph_style("PE-Title", para)

        font = FontStyle()
        font.set(face=FONT_SERIF, size=10)
        for i in range(1, 33):
            para = ParagraphStyle()
            para.set_font(font)
            para.set_top_margin(ReportUtils.pt2cm(font.get_size() * 0.125))
            para.set_bottom_margin(ReportUtils.pt2cm(font.get_size() * 0.125))
            para.set_left_margin(min(10.0, float(i - 1.0)))
            para.set_description(
                _("The style used for the "
                  "level %d display.") % i)
            default_style.add_paragraph_style("PE-Level%d" % min(i, 32), para)

        add_endnote_styles(default_style)
Exemplo n.º 6
0
    def make_default_style(self, default_style):
        """Make the default output style for the Summary Report."""
        font = FontStyle()
        font.set_size(16)
        font.set_type_face(FONT_SANS_SERIF)
        font.set_bold(1)
        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(PARA_ALIGN_CENTER)
        para.set_description(_("The style used for the title of the page."))
        default_style.add_paragraph_style("SR-Title", para)

        font = FontStyle()
        font.set_size(12)
        font.set_bold(True)
        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 = FontStyle()
        font.set_size(12)
        para = ParagraphStyle()
        para.set(first_indent=-0.75, lmargin=0.75)
        para.set_font(font)
        para.set_top_margin(ReportUtils.pt2cm(3))
        para.set_bottom_margin(ReportUtils.pt2cm(3))
        para.set_description(_("The basic style used for the text display."))
        default_style.add_paragraph_style("SR-Normal", para)
Exemplo n.º 7
0
 def get_optimized_font_size(self, line, font, max_width):
     """
     for a given width, guess the best font size which is equals
     or smaller than font which make line fit into max_width
     """
     test_font = FontStyle(font)
     width = utils.pt2cm(self.doc.string_width(test_font, line))
     while width > max_width and test_font.get_size() > 1:
         test_font.set_size(test_font.get_size() -1)
         width = utils.pt2cm(self.doc.string_width(test_font, line))
     return test_font.get_size()
    def __note_style(self):
        """
        Define the style used for note
        """

        para = ParagraphStyle()
        para.set(first_indent=0.75, lmargin=.75)
        para.set_top_margin(ReportUtils.pt2cm(3))
        para.set_bottom_margin(ReportUtils.pt2cm(3))
        para.set_description(_('The basic style used for the note display.'))
        self.default_style.add_paragraph_style("REPO-Note", para)
Exemplo n.º 9
0
    def __note_style(self):
        """
        Define the style used for note
        """

        para = ParagraphStyle()
        para.set(first_indent=0.75, lmargin=.75)
        para.set_top_margin(ReportUtils.pt2cm(3))
        para.set_bottom_margin(ReportUtils.pt2cm(3))
        para.set_description(_('The basic style used for the note display.'))
        self.default_style.add_paragraph_style("REPO-Note", para)
Exemplo n.º 10
0
 def __section_style(self):
     """
     Define the style used for each section
     """
     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(ReportUtils.pt2cm(10))
     para.set_bottom_margin(ReportUtils.pt2cm(10))       
     para.set_description(_('The style used for each section.'))
     self.default_style.add_paragraph_style("REPO-Section", para)
    def __repository_title_style(self):
        """
        Define the style used for the repository title
        """

        font = FontStyle()
        font.set(face=FONT_SERIF, size=14, italic=0, bold=1)
        para = ParagraphStyle()
        para.set_font(font)
        para.set_top_margin(ReportUtils.pt2cm(10))
        para.set_bottom_margin(ReportUtils.pt2cm(7))
        para.set_description(_('The style used for repository title.'))
        self.default_style.add_paragraph_style('REPO-RepositoryTitle', para)
Exemplo n.º 12
0
 def __section_style(self):
     """
     Define the style used for each section
     """
     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(ReportUtils.pt2cm(10))
     para.set_bottom_margin(ReportUtils.pt2cm(10))
     para.set_description(_('The style used for each section.'))
     self.default_style.add_paragraph_style("REPO-Section", para)
Exemplo n.º 13
0
    def __repository_title_style(self):
        """
        Define the style used for the repository title
        """

        font = FontStyle()
        font.set(face=FONT_SERIF, size=14, italic=0, bold=1)
        para = ParagraphStyle()
        para.set_font(font)
        para.set_top_margin(ReportUtils.pt2cm(10))
        para.set_bottom_margin(ReportUtils.pt2cm(7))
        para.set_description(_('The style used for repository title.'))
        self.default_style.add_paragraph_style('REPO-RepositoryTitle', para)
Exemplo n.º 14
0
    def make_default_style(self, default_style):

        #Paragraph Styles
        font = FontStyle()
        font.set_type_face(FONT_SANS_SERIF)
        font.set_size(16)
        font.set_bold(True)
        para = ParagraphStyle()
        para.set_font(font)
        para.set_alignment(PARA_ALIGN_CENTER)
        para.set_description(_("The style used for the report title."))
        default_style.add_paragraph_style('REC-Title', para)

        font = FontStyle()
        font.set_type_face(FONT_SANS_SERIF)
        font.set_size(12)
        font.set_bold(True)
        para = ParagraphStyle()
        para.set_font(font)
        para.set_alignment(PARA_ALIGN_CENTER)
        para.set_bottom_border(True)
        para.set_bottom_margin(ReportUtils.pt2cm(8))
        para.set_description(_("The style used for the report subtitle."))
        default_style.add_paragraph_style('REC-Subtitle', para)

        font = FontStyle()
        font.set_size(12)
        font.set_bold(True)
        para = ParagraphStyle()
        para.set_font(font)
        para.set_top_margin(ReportUtils.pt2cm(6))
        para.set_description(_('The style used for headings.'))
        default_style.add_paragraph_style('REC-Heading', para)

        font = FontStyle()
        font.set_size(10)
        para = ParagraphStyle()
        para.set_font(font)
        para.set_left_margin(0.5)
        para.set_description(_('The basic style used for the text display.'))
        default_style.add_paragraph_style('REC-Normal', para)

        font = FontStyle()
        font.set_size(8)
        para = ParagraphStyle()
        para.set_font(font)
        para.set_alignment(PARA_ALIGN_CENTER)
        para.set_top_border(True)
        para.set_top_margin(ReportUtils.pt2cm(8))
        para.set_description(_('The style used for the footer.'))
        default_style.add_paragraph_style('REC-Footer', para)
Exemplo n.º 15
0
    def make_default_style(self, default_style):

        #Paragraph Styles
        font = FontStyle()
        font.set_type_face(FONT_SANS_SERIF)
        font.set_size(16)
        font.set_bold(True)
        para = ParagraphStyle()
        para.set_font(font)
        para.set_alignment(PARA_ALIGN_CENTER)
        para.set_description(_("The style used for the report title."))
        default_style.add_paragraph_style('REC-Title', para)

        font = FontStyle()
        font.set_type_face(FONT_SANS_SERIF)
        font.set_size(12)
        font.set_bold(True)
        para = ParagraphStyle()
        para.set_font(font)
        para.set_alignment(PARA_ALIGN_CENTER)
        para.set_bottom_border(True)
        para.set_bottom_margin(ReportUtils.pt2cm(8))
        para.set_description(_("The style used for the report subtitle."))
        default_style.add_paragraph_style('REC-Subtitle', para)

        font = FontStyle()
        font.set_size(12)
        font.set_bold(True)
        para = ParagraphStyle()
        para.set_font(font)
        para.set_top_margin(ReportUtils.pt2cm(6))
        para.set_description(_('The style used for headings.'))
        default_style.add_paragraph_style('REC-Heading', para)

        font = FontStyle()
        font.set_size(10)
        para = ParagraphStyle()
        para.set_font(font)
        para.set_left_margin(0.5)
        para.set_description(_('The basic style used for the text display.'))
        default_style.add_paragraph_style('REC-Normal', para)

        font = FontStyle()
        font.set_size(8)
        para = ParagraphStyle()
        para.set_font(font)
        para.set_alignment(PARA_ALIGN_CENTER)
        para.set_top_border(True)
        para.set_top_margin(ReportUtils.pt2cm(8))
        para.set_description(_('The style used for the footer.'))
        default_style.add_paragraph_style('REC-Footer', para)
Exemplo n.º 16
0
    def __child_section_style(self):
        """
        Define the style used for secondary section
        """

        font = FontStyle()
        font.set(face=FONT_SERIF, size=10, italic=1, bold=0)
        para = ParagraphStyle()
        para.set_font(font)
        para.set(first_indent=0, lmargin=1)
        para.set_top_margin(ReportUtils.pt2cm(1))
        para.set_bottom_margin(ReportUtils.pt2cm(1))
        para.set_description(_('The style used for child section.'))
        self.default_style.add_paragraph_style('REPO-Section2', para)
    def __child_section_style(self):
        """
        Define the style used for secondary section
        """

        font = FontStyle()
        font.set(face=FONT_SERIF, size=10, italic=1, bold=0)
        para = ParagraphStyle()
        para.set_font(font)
        para.set(first_indent=0, lmargin=1)
        para.set_top_margin(ReportUtils.pt2cm(1))
        para.set_bottom_margin(ReportUtils.pt2cm(1))
        para.set_description(_('The style used for child section.'))
        self.default_style.add_paragraph_style('REPO-Section2', para)
Exemplo n.º 18
0
 def __report_title_style(self):
     """
     Define the style used for the report title
     """
     font = FontStyle()
     font.set(face=FONT_SANS_SERIF, size=20, bold=1)
     para = ParagraphStyle()
     para.set_font(font)
     para.set_header_level(1)
     para.set_bottom_border(1)
     para.set_top_margin(ReportUtils.pt2cm(12))
     para.set_bottom_margin(ReportUtils.pt2cm(12))
     para.set_alignment(PARA_ALIGN_CENTER)
     para.set_description(_('The style used for the title of the report.'))
     self.default_style.add_paragraph_style("REPO-ReportTitle", para)
Exemplo n.º 19
0
 def __report_title_style(self):
     """
     Define the style used for the report title
     """
     font = FontStyle()
     font.set(face=FONT_SANS_SERIF, size=20, bold=1)
     para = ParagraphStyle()
     para.set_font(font)
     para.set_header_level(1)
     para.set_bottom_border(1)
     para.set_top_margin(ReportUtils.pt2cm(12))
     para.set_bottom_margin(ReportUtils.pt2cm(12))
     para.set_alignment(PARA_ALIGN_CENTER)       
     para.set_description(_('The style used for the title of the report.'))
     self.default_style.add_paragraph_style("REPO-ReportTitle", para)
Exemplo n.º 20
0
    def make_default_style(self, default_style):
        """Make the default output style for the Descendant Report."""
        f = FontStyle()
        f.set(face=FONT_SANS_SERIF, size=12, bold=1)
        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_description(_("The style used for the title of the page."))
        default_style.add_paragraph_style("DR-Title", p)

        f = FontStyle()
        f.set(face=FONT_SANS_SERIF, size=12, italic=1)
        p = ParagraphStyle()
        p.set_font(f)
        p.set_header_level(2)
        p.set_top_margin(ReportUtils.pt2cm(3))
        p.set_bottom_margin(ReportUtils.pt2cm(3))
        p.set_description(
            _('The style used for the table of contents header.'))
        default_style.add_paragraph_style("DR-TOC-Title", p)

        f = FontStyle()
        f.set_size(10)
        p = ParagraphStyle()
        p.set_font(f)
        p.set_top_margin(0.25)
        p.set_bottom_margin(0.25)
        p.set_first_indent(1.0)
        p.set_description(
            _("The style used for the table of contents detail."))
        default_style.add_paragraph_style("DR-TOC-Detail", p)

        f = FontStyle()
        f.set_size(10)
        for i in range(1, 33):
            p = ParagraphStyle()
            p.set_font(f)
            p.set_top_margin(ReportUtils.pt2cm(f.get_size() * 0.125))
            p.set_bottom_margin(ReportUtils.pt2cm(f.get_size() * 0.125))
            p.set_first_indent(-0.8)
            p.set_left_margin(min(10.0, float(i - 0.5)))
            p.set_description(
                _("The style used for the "
                  "level %d display.") % i)
            default_style.add_paragraph_style("DR-Level%d" % min(i, 32), p)

            p = ParagraphStyle()
            p.set_font(f)
            p.set_top_margin(ReportUtils.pt2cm(f.get_size() * 0.125))
            p.set_bottom_margin(ReportUtils.pt2cm(f.get_size() * 0.125))
            p.set_left_margin(min(10.0, float(i - 0.5)))
            p.set_description(
                _("The style used for the "
                  "spouse level %d display.") % i)
            default_style.add_paragraph_style("DR-Spouse%d" % min(i, 32), p)
Exemplo n.º 21
0
def add_endnote_styles(style_sheet):
    """
    Add paragraph styles to a style sheet to be used for displaying endnotes.
    
    @param style_sheet: Style sheet
    @type style_sheet: L{docgen.StyleSheet}
    """

    font = FontStyle()
    font.set(face=FONT_SERIF, size=10)
    para = ParagraphStyle()
    para.set_font(font)
    para.set(first_indent=-0.75, lmargin=1.00)
    para.set_top_margin(ReportUtils.pt2cm(font.get_size()*0.125))
    para.set_bottom_margin(ReportUtils.pt2cm(font.get_size()*0.125))
    para.set_description(_('The basic style used for the endnotes source display.'))
    style_sheet.add_paragraph_style("Endnotes-Source", para)
Exemplo n.º 22
0
def add_endnote_styles(style_sheet):
    """
    Add paragraph styles to a style sheet to be used for displaying endnotes.

    @param style_sheet: Style sheet
    @type style_sheet: L{docgen.StyleSheet}
    """

    font = FontStyle()
    font.set(face=FONT_SERIF, size=10)
    para = ParagraphStyle()
    para.set_font(font)
    para.set(first_indent=-0.75, lmargin=1.00)
    para.set_top_margin(ReportUtils.pt2cm(font.get_size()*0.125))
    para.set_bottom_margin(ReportUtils.pt2cm(font.get_size()*0.125))
    para.set_description(_('The basic style used for the endnotes source display.'))
    style_sheet.add_paragraph_style("Endnotes-Source", para)
Exemplo n.º 23
0
    def make_default_style(self, default_style):
        """Make the default output style for the Descendant Report."""
        f = FontStyle()
        f.set(face=FONT_SANS_SERIF, size=12, bold=1)
        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_description(_("The style used for the title of the page."))
        default_style.add_paragraph_style("DR-Title", p)

        f = FontStyle()
        f.set(face=FONT_SANS_SERIF, size=12, italic=1)
        p = ParagraphStyle()
        p.set_font(f)
        p.set_header_level(2)
        p.set_top_margin(ReportUtils.pt2cm(3))
        p.set_bottom_margin(ReportUtils.pt2cm(3))
        p.set_description(_('The style used for the table of contents header.'))
        default_style.add_paragraph_style("DR-TOC-Title", p)

        f = FontStyle()
        f.set_size(10)
        p = ParagraphStyle()
        p.set_font(f)
        p.set_top_margin(0.25)
        p.set_bottom_margin(0.25)
        p.set_first_indent(1.0)
        p.set_description(_("The style used for the table of contents detail."))
        default_style.add_paragraph_style("DR-TOC-Detail", p)

        f = FontStyle()
        f.set_size(10)
        for i in range(1, 33):
            p = ParagraphStyle()
            p.set_font(f)
            p.set_top_margin(ReportUtils.pt2cm(f.get_size()*0.125))
            p.set_bottom_margin(ReportUtils.pt2cm(f.get_size()*0.125))
            p.set_first_indent(-0.8)
            p.set_left_margin(min(10.0, float(i-0.5)))
            p.set_description(_("The style used for the "
                                "level %d display.") % i)
            default_style.add_paragraph_style("DR-Level%d" % min(i, 32), p)

            p = ParagraphStyle()
            p.set_font(f)
            p.set_top_margin(ReportUtils.pt2cm(f.get_size()*0.125))
            p.set_bottom_margin(ReportUtils.pt2cm(f.get_size()*0.125))
            p.set_left_margin(min(10.0, float(i-0.5)))
            p.set_description(_("The style used for the "
                                "spouse level %d display.") % i)
            default_style.add_paragraph_style("DR-Spouse%d" % min(i, 32), p)
Exemplo n.º 24
0
 def draw_no_date_heading(self):
     """
     Draws a single heading that says "No Date Information"
     """
     width = self.doc.get_usable_width()
     style_sheet = self.doc.get_style_sheet()
     label_font = style_sheet.get_paragraph_style('TLG-Label').get_font()
     label_y = self.header - (utils.pt2cm(label_font.get_size()) * 1.2)
     self.doc.center_text('TLG-label', self._("No Date Information"),
                          width / 2.0, label_y)
Exemplo n.º 25
0
 def draw_no_date_heading(self):
     """
     Draws a single heading that says "No Date Information"
     """
     width = self.doc.get_usable_width()
     style_sheet = self.doc.get_style_sheet()
     label_font = style_sheet.get_paragraph_style('TLG-Label').get_font()
     label_y = self.header - (utils.pt2cm(label_font.get_size()) * 1.2)
     self.doc.center_text('TLG-label', self._("No Date Information"),
                          width / 2.0, label_y)
Exemplo n.º 26
0
 def draw_title(self, toc):
     """
     Draws the title for the page.
     """
     width = self.doc.get_usable_width()
     title = "%(str1)s -- %(str2)s" % {
         'str1' : self._("Timeline Chart"),
         # feature request 2356: avoid genitive form
         'str2' : self._("Sorted by %s") % self.sort_name}
     title3 = self.living_desc
     mark = None
     if toc:
         mark = IndexMark(title, INDEX_TYPE_TOC, 1)
     self.doc.center_text('TLG-title', title, width / 2.0, 0, mark)
     style_sheet = self.doc.get_style_sheet()
     title_font = style_sheet.get_paragraph_style('TLG-Title').get_font()
     title_y = 1.2 - (utils.pt2cm(title_font.get_size()) * 1.2)
     self.doc.center_text('TLG-title', self.fil_name, width / 2.0, title_y)
     title_y = 1.8 - (utils.pt2cm(title_font.get_size()) * 1.2)
     self.doc.center_text('TLG-title', title3, width / 2.0, title_y)
Exemplo n.º 27
0
 def draw_title(self, toc):
     """
     Draws the title for the page.
     """
     width = self.doc.get_usable_width()
     title = "%(str1)s -- %(str2)s" % {
         'str1' : self._("Timeline Chart"),
         # feature request 2356: avoid genitive form
         'str2' : self._("Sorted by %s") % self.sort_name}
     title3 = self.living_desc
     mark = None
     if toc:
         mark = IndexMark(title, INDEX_TYPE_TOC, 1)
     self.doc.center_text('TLG-title', title, width / 2.0, 0, mark)
     style_sheet = self.doc.get_style_sheet()
     title_font = style_sheet.get_paragraph_style('TLG-Title').get_font()
     title_y = 1.2 - (utils.pt2cm(title_font.get_size()) * 1.2)
     self.doc.center_text('TLG-title', self.fil_name, width / 2.0, title_y)
     title_y = 1.8 - (utils.pt2cm(title_font.get_size()) * 1.2)
     self.doc.center_text('TLG-title', title3, width / 2.0, title_y)
Exemplo n.º 28
0
    def output_piechart(self, title1, typename, data, lookup):

        # set layout variables
        middle_w = self.doc.get_usable_width() / 2
        middle_h = self.doc.get_usable_height() / 2
        middle = min(middle_w, middle_h)

        # start output
        style_sheet = self.doc.get_style_sheet()
        pstyle = style_sheet.get_paragraph_style('SC-Title')
        mark = IndexMark(title1, INDEX_TYPE_TOC, 2)
        self.doc.center_text('SC-title', title1, middle_w, 0, mark)
        yoffset = utils.pt2cm(pstyle.get_font().get_size())
        self.doc.center_text('SC-title', self.fil_name, middle_w, yoffset)
        yoffset = 2 * utils.pt2cm(pstyle.get_font().get_size())
        self.doc.center_text('SC-title', self.living_desc, middle_w, yoffset)

        # collect data for output
        color = 0
        chart_data = []
        for key in lookup:
            style = "SC-color-%d" % color
            text = "%s (%d)" % (self._(key), data[key])
            # graphics style, value, and it's label
            chart_data.append((style, data[key], text))
            color = (color+1) % 7    # There are only 7 color styles defined

        margin = 1.0
        legendx = 2.0

        # output data...
        radius = middle - 2*margin
        yoffset += margin + radius
        draw_pie_chart(self.doc, middle_w, yoffset, radius, chart_data, -90)
        yoffset += radius + 2*margin
        if middle == middle_h:   # Landscape
            legendx = 1.0
            yoffset = margin

        text = self._("%s (persons):") % self._(typename)
        draw_legend(self.doc, legendx, yoffset, chart_data, text, 'SC-legend')
Exemplo n.º 29
0
    def output_piechart(self, title1, typename, data, lookup):

        # set layout variables
        middle_w = self.doc.get_usable_width() / 2
        middle_h = self.doc.get_usable_height() / 2
        middle = min(middle_w, middle_h)

        # start output
        style_sheet = self.doc.get_style_sheet()
        pstyle = style_sheet.get_paragraph_style('SC-Title')
        mark = IndexMark(title1, INDEX_TYPE_TOC, 2)
        self.doc.center_text('SC-title', title1, middle_w, 0, mark)
        yoffset = utils.pt2cm(pstyle.get_font().get_size())
        self.doc.center_text('SC-title', self.fil_name, middle_w, yoffset)
        yoffset = 2 * utils.pt2cm(pstyle.get_font().get_size())
        self.doc.center_text('SC-title', self.living_desc, middle_w, yoffset)

        # collect data for output
        color = 0
        chart_data = []
        for key in lookup:
            style = "SC-color-%d" % color
            text = "%s (%d)" % (self._(key), data[key])
            # graphics style, value, and it's label
            chart_data.append((style, data[key], text))
            color = (color+1) % 7    # There are only 7 color styles defined

        margin = 1.0
        legendx = 2.0

        # output data...
        radius = middle - 2*margin
        yoffset += margin + radius
        draw_pie_chart(self.doc, middle_w, yoffset, radius, chart_data, -90)
        yoffset += radius + 2*margin
        if middle == middle_h:   # Landscape
            legendx = 1.0
            yoffset = margin

        text = self._("%s (persons):") % self._(typename)
        draw_legend(self.doc, legendx, yoffset, chart_data, text, 'SC-legend')
Exemplo n.º 30
0
    def make_default_style(self,default_style):
        """Make the default output style for the Note Link Report."""
        # Paragraph Styles
        f = FontStyle()
        f.set_size(16)
        f.set_type_face(FONT_SANS_SERIF)
        f.set_bold(1)
        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(PARA_ALIGN_CENTER)
        p.set_description(_("The style used for the title of the page."))
        default_style.add_paragraph_style("NoteLink-Title", p)
        
        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)
        para.set_bottom_margin(0.25)
        para.set_description(_('The style used for the section headers.'))
        default_style.add_paragraph_style("NoteLink-Heading", para)
        
        font = FontStyle()
        font.set_size(12)
        p = ParagraphStyle()
        p.set(first_indent=-0.75, lmargin=.75)
        p.set_font(font)
        p.set_top_margin(ReportUtils.pt2cm(3))
        p.set_bottom_margin(ReportUtils.pt2cm(3))
        p.set_description(_('The basic style used for the text display.'))
        default_style.add_paragraph_style("NoteLink-Normal", p)
        
        font = FontStyle()
        font.set_size(12)
        font.set_bold(True)
        p = ParagraphStyle()
        p.set(first_indent=-0.75, lmargin=.75)
        p.set_font(font)
        p.set_top_margin(ReportUtils.pt2cm(3))
        p.set_bottom_margin(ReportUtils.pt2cm(3))
        p.set_description(_('The basic style used for table headings.'))
        default_style.add_paragraph_style("NoteLink-Normal-Bold", p)
        
        #Table Styles
        cell = TableCellStyle()
        default_style.add_cell_style('NoteLink-TableCell', cell)

        table = TableStyle()
        table.set_width(100)
        table.set_columns(4)
        table.set_column_width(0, 10)
        table.set_column_width(1, 15)
        table.set_column_width(2, 65)
        table.set_column_width(3, 10)
        default_style.add_table_style('NoteLink-Table',table)
Exemplo n.º 31
0
    def make_default_style(self, default_style):
        """Make the default output style for the Note Link Report."""
        # Paragraph Styles
        f = FontStyle()
        f.set_size(16)
        f.set_type_face(FONT_SANS_SERIF)
        f.set_bold(1)
        p = ParagraphStyle()
        p.set_header_level(1)
        p.set_bottom_border(1)
        p.set_top_margin(utils.pt2cm(3))
        p.set_bottom_margin(utils.pt2cm(3))
        p.set_font(f)
        p.set_alignment(PARA_ALIGN_CENTER)
        p.set_description(_("The style used for the title of the page."))
        default_style.add_paragraph_style("NoteLink-Title", p)

        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)
        para.set_bottom_margin(0.25)
        para.set_description(_('The style used for the section headers.'))
        default_style.add_paragraph_style("NoteLink-Heading", para)

        font = FontStyle()
        font.set_size(12)
        p = ParagraphStyle()
        p.set(first_indent=-0.75, lmargin=.75)
        p.set_font(font)
        p.set_top_margin(utils.pt2cm(3))
        p.set_bottom_margin(utils.pt2cm(3))
        p.set_description(_('The basic style used for the text display.'))
        default_style.add_paragraph_style("NoteLink-Normal", p)

        font = FontStyle()
        font.set_size(12)
        font.set_bold(True)
        p = ParagraphStyle()
        p.set(first_indent=-0.75, lmargin=.75)
        p.set_font(font)
        p.set_top_margin(utils.pt2cm(3))
        p.set_bottom_margin(utils.pt2cm(3))
        p.set_description(_('The basic style used for table headings.'))
        default_style.add_paragraph_style("NoteLink-Normal-Bold", p)

        #Table Styles
        cell = TableCellStyle()
        default_style.add_cell_style('NoteLink-TableCell', cell)

        table = TableStyle()
        table.set_width(100)
        table.set_columns(4)
        table.set_column_width(0, 10)
        table.set_column_width(1, 15)
        table.set_column_width(2, 65)
        table.set_column_width(3, 10)
        default_style.add_table_style('NoteLink-Table', table)
Exemplo n.º 32
0
def draw_legend(doc, start_x, start_y, data, title, label_style):
    """
    Draws a legend for a graph in the specified document. The data passed is
    used to define the legend.  First item style is used for the optional
    Legend title.

    @param doc: Document to which the legend chart should be added
    @type doc: BaseDoc derived class
    @param start_x: x coordinate in centimeters where the left hand corner
        of the legend is placed. 0 is the left hand edge of the document.
    @type start_x: float
    @param start_y: y coordinate in centimeters where the top of the legend
        should be. 0 is the top edge of the document
    @type start_y: float
    @param data: List of tuples containing the data to be used to create the
       legend. In order to be compatible with the graph plots, the first and
       third values of the tuple used. The format is (graphics_format, value,
       legend_description).
    @type data: list
    """
    style_sheet = doc.get_style_sheet()
    if title:
        gstyle = style_sheet.get_draw_style(label_style)
        pstyle_name = gstyle.get_paragraph_style()
        pstyle = style_sheet.get_paragraph_style(pstyle_name)
        size = utils.pt2cm(pstyle.get_font().get_size())
        doc.draw_text(label_style, title,
                      start_x + (3*size), start_y - (size*0.25))
        start_y += size * 1.3

    for (sformat, size, legend) in data:
        gstyle = style_sheet.get_draw_style(sformat)
        pstyle_name = gstyle.get_paragraph_style()
        pstyle = style_sheet.get_paragraph_style(pstyle_name)
        size = utils.pt2cm(pstyle.get_font().get_size())
        doc.draw_box(sformat, "", start_x, start_y, (2*size), size)
        doc.draw_text(label_style, legend,
                      start_x + (3*size), start_y - (size*0.25))
        start_y += size * 1.3
Exemplo n.º 33
0
 def draw_year_headings(self, year_low, year_high, start_pos, stop_pos):
     """
     Draws the column headings (years) for the page.
     """
     style_sheet = self.doc.get_style_sheet()
     label_font = style_sheet.get_paragraph_style('TLG-Label').get_font()
     label_y = self.header - (utils.pt2cm(label_font.get_size()) * 1.2)
     incr = (year_high - year_low) / 5
     delta = (stop_pos - start_pos) / 5
     for val in range(0, 6):
         xpos = start_pos + (val * delta)
         year_str = str(int(year_low + (incr * val)))
         self.doc.center_text('TLG-label', year_str, xpos, label_y)
Exemplo n.º 34
0
 def draw_year_headings(self, year_low, year_high, start_pos, stop_pos):
     """
     Draws the column headings (years) for the page.
     """
     style_sheet = self.doc.get_style_sheet()
     label_font = style_sheet.get_paragraph_style('TLG-Label').get_font()
     label_y = self.header - (utils.pt2cm(label_font.get_size()) * 1.2)
     incr = (year_high - year_low) / 5
     delta = (stop_pos - start_pos) / 5
     for val in range(0, 6):
         xpos = start_pos + (val * delta)
         year_str = self._get_date(Date(year_low + int(incr * val)))
         self.doc.center_text('TLG-label', year_str, xpos, label_y)
Exemplo n.º 35
0
def draw_legend(doc, start_x, start_y, data, title, label_style):
    """
    Draws a legend for a graph in the specified document. The data passed is
    used to define the legend.  First item style is used for the optional
    Legend title.

    @param doc: Document to which the legend chart should be added
    @type doc: BaseDoc derived class
    @param start_x: x coordinate in centimeters where the left hand corner
        of the legend is placed. 0 is the left hand edge of the document.
    @type start_x: float
    @param start_y: y coordinate in centimeters where the top of the legend
        should be. 0 is the top edge of the document
    @type start_y: float
    @param data: List of tuples containing the data to be used to create the
       legend. In order to be compatible with the graph plots, the first and
       third values of the tuple used. The format is (graphics_format, value,
       legend_description).
    @type data: list
    """
    style_sheet = doc.get_style_sheet()
    if title:
        gstyle = style_sheet.get_draw_style(label_style)
        pstyle_name = gstyle.get_paragraph_style()
        pstyle = style_sheet.get_paragraph_style(pstyle_name)
        size = utils.pt2cm(pstyle.get_font().get_size())
        doc.draw_text(label_style, title,
                      start_x + (3*size), start_y - (size*0.25))
        start_y += size * 1.3

    for (sformat, size, legend) in data:
        gstyle = style_sheet.get_draw_style(sformat)
        pstyle_name = gstyle.get_paragraph_style()
        pstyle = style_sheet.get_paragraph_style(pstyle_name)
        size = utils.pt2cm(pstyle.get_font().get_size())
        doc.draw_box(sformat, "", start_x, start_y, (2*size), size)
        doc.draw_text(label_style, legend,
                      start_x + (3*size), start_y - (size*0.25))
        start_y += size * 1.3
Exemplo n.º 36
0
 def __report_footer_style(self):
     """
     Define the style used for the report footer
     """
     font = FontStyle()
     font.set(face=FONT_SANS_SERIF, size=10, bold=1)
     para = ParagraphStyle()
     para.set_font(font)
     para.set_alignment(PARA_ALIGN_CENTER)
     para.set_top_border(True)
     para.set_top_margin(utils.pt2cm(6))
     para.set_description(_('The style used for the footer of the report.'))
     self.default_style.add_paragraph_style("SRC-Footer", para)
 def __report_footer_style(self):
     """
     Define the style used for the report footer
     """        
     
     font = FontStyle()
     font.set_size(8)
     para = ParagraphStyle()
     para.set_font(font)
     para.set_alignment(PARA_ALIGN_CENTER)
     para.set_top_border(True)
     para.set_top_margin(ReportUtils.pt2cm(8))
     para.set_description(_('The style used for the footer.'))
     self.default_style.add_paragraph_style('SRC-Footer', para)
Exemplo n.º 38
0
    def __report_footer_style(self):
        """
        Define the style used for the report footer
        """

        font = FontStyle()
        font.set_size(8)
        para = ParagraphStyle()
        para.set_font(font)
        para.set_alignment(PARA_ALIGN_CENTER)
        para.set_top_border(True)
        para.set_top_margin(ReportUtils.pt2cm(8))
        para.set_description(_('The style used for the footer.'))
        self.default_style.add_paragraph_style('SRC-Footer', para)
Exemplo n.º 39
0
    def name_size(self):
        """ get the length of the name """
        self.plist = self.filter.apply(self.database,
                                       self.database.iter_person_handles())

        style_sheet = self.doc.get_style_sheet()
        gstyle = style_sheet.get_draw_style('TLG-text')
        pname = gstyle.get_paragraph_style()
        pstyle = style_sheet.get_paragraph_style(pname)
        font = pstyle.get_font()

        size = 0
        for p_id in self.plist:
            person = self.database.get_person_from_handle(p_id)
            dname = self._name_display.display(person)
            size = max(self.doc.string_width(font, dname), size)
        return utils.pt2cm(size)
Exemplo n.º 40
0
    def name_size(self):
        """ get the length of the name """
        self.plist = self.filter.apply(self.database,
                                       self.database.iter_person_handles())

        style_sheet = self.doc.get_style_sheet()
        gstyle = style_sheet.get_draw_style('TLG-text')
        pname = gstyle.get_paragraph_style()
        pstyle = style_sheet.get_paragraph_style(pname)
        font = pstyle.get_font()

        size = 0
        for p_id in self.plist:
            person = self.database.get_person_from_handle(p_id)
            dname = self._name_display.display(person)
            size = max(self.doc.string_width(font, dname), size)
        return utils.pt2cm(size)
Exemplo n.º 41
0
    def _draw_link_arrow(self, link_text, y, h):
        """Draw a path on the document that points to the next page
        where the ancestors continue.

        link_text - a string with the page number
        y - the vertical position of the referenced person box
        h - the height of the person box, used to calculate the arrows position

        """
        # calculate the size of the link text
        w = pt2cm(self.doc.string_width(self.get_font('PC-box'), link_text))
        link_x = self.doc.get_usable_width() - w
        link_y = y + h / 2
        # calculate the position of the arrow
        loc = np.matrix([link_x, link_y])
        path = _ARROW + loc
        self.doc.draw_path('PC-line', path.A)
        # write the text inside the arrow
        self.doc.draw_text('PC-box', link_text, link_x, link_y)
Exemplo n.º 42
0
    def make_default_style(self, default_style):
        """Make the default output style for the Number of Ancestors Report."""
        font = FontStyle()
        font.set_size(16)
        font.set_type_face(FONT_SANS_SERIF)
        font.set_bold(1)
        para = ParagraphStyle()
        para.set_header_level(1)
        para.set_bottom_border(1)
        para.set_bottom_margin(utils.pt2cm(8))
        para.set_font(font)
        para.set_alignment(PARA_ALIGN_CENTER)
        para.set_description(_("The style used for the title."))
        default_style.add_paragraph_style("NOA-Title", para)

        font = FontStyle()
        font.set_size(12)
        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)
Exemplo n.º 43
0
    def make_default_style(self, default_style):
        """Make the default output style for the Number of Ancestors Report."""
        font = FontStyle()
        font.set_size(16)
        font.set_type_face(FONT_SANS_SERIF)
        font.set_bold(1)
        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(PARA_ALIGN_CENTER)
        para.set_description(_("The style used for the title of the page."))
        default_style.add_paragraph_style("NOA-Title", para)

        font = FontStyle()
        font.set_size(12)
        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)
Exemplo n.º 44
0
    def make_default_style(self, default_style):
        """Make the default output style for the Descendant Report."""
        fstyle = FontStyle()
        fstyle.set_size(12)
        fstyle.set_type_face(FONT_SANS_SERIF)
        fstyle.set_bold(1)
        pstyle = ParagraphStyle()
        pstyle.set_header_level(1)
        pstyle.set_bottom_border(1)
        pstyle.set_top_margin(utils.pt2cm(3))
        pstyle.set_bottom_margin(utils.pt2cm(3))
        pstyle.set_font(fstyle)
        pstyle.set_alignment(PARA_ALIGN_CENTER)
        pstyle.set_description(_("The style used for the title."))
        default_style.add_paragraph_style("DR-Title", pstyle)

        fstyle = FontStyle()
        fstyle.set_size(10)
        for i in range(1, 33):
            pstyle = ParagraphStyle()
            pstyle.set_font(fstyle)
            pstyle.set_top_margin(utils.pt2cm(fstyle.get_size()*0.125))
            pstyle.set_bottom_margin(
                utils.pt2cm(fstyle.get_size()*0.125))
            pstyle.set_first_indent(-0.5)
            pstyle.set_left_margin(min(10.0, float(i-0.5)))
            pstyle.set_description(
                _("The style used for the level %d display.") % i)
            default_style.add_paragraph_style("DR-Level%d" % min(i, 32),
                                              pstyle)

            pstyle = ParagraphStyle()
            pstyle.set_font(fstyle)
            pstyle.set_top_margin(utils.pt2cm(fstyle.get_size()*0.125))
            pstyle.set_bottom_margin(
                utils.pt2cm(fstyle.get_size()*0.125))
            pstyle.set_left_margin(min(10.0, float(i-0.5)))
            pstyle.set_description(
                _("The style used for the spouse level %d display.") % i)
            default_style.add_paragraph_style("DR-Spouse%d" % min(i, 32),
                                              pstyle)
Exemplo n.º 45
0
    def make_default_style(self, default_style):
        """Make the default output style for the Descendant Report."""
        fstyle = FontStyle()
        fstyle.set_size(12)
        fstyle.set_type_face(FONT_SANS_SERIF)
        fstyle.set_bold(1)
        pstyle = ParagraphStyle()
        pstyle.set_header_level(1)
        pstyle.set_bottom_border(1)
        pstyle.set_top_margin(utils.pt2cm(3))
        pstyle.set_bottom_margin(utils.pt2cm(3))
        pstyle.set_font(fstyle)
        pstyle.set_alignment(PARA_ALIGN_CENTER)
        pstyle.set_description(_("The style used for the title."))
        default_style.add_paragraph_style("DR-Title", pstyle)

        fstyle = FontStyle()
        fstyle.set_size(10)
        for i in range(1, 33):
            pstyle = ParagraphStyle()
            pstyle.set_font(fstyle)
            pstyle.set_top_margin(utils.pt2cm(fstyle.get_size()*0.125))
            pstyle.set_bottom_margin(
                utils.pt2cm(fstyle.get_size()*0.125))
            pstyle.set_first_indent(-0.5)
            pstyle.set_left_margin(min(10.0, float(i-0.5)))
            pstyle.set_description(
                _("The style used for the level %d display.") % i)
            default_style.add_paragraph_style("DR-Level%d" % min(i, 32),
                                              pstyle)

            pstyle = ParagraphStyle()
            pstyle.set_font(fstyle)
            pstyle.set_top_margin(utils.pt2cm(fstyle.get_size()*0.125))
            pstyle.set_bottom_margin(
                utils.pt2cm(fstyle.get_size()*0.125))
            pstyle.set_left_margin(min(10.0, float(i-0.5)))
            pstyle.set_description(
                _("The style used for the spouse level %d display.") % i)
            default_style.add_paragraph_style("DR-Spouse%d" % min(i, 32),
                                              pstyle)
Exemplo n.º 46
0
    def get_optimized_style_sheet(self, title, max_circular, block_size,
                                  map_style_from_single,
                                  map_paragraphs_colors_to_graphics,
                                  make_background_white):
        """
        returns an optimized (modified) style sheet which make fanchart
        look nicer
        """
        new_style_sheet = self.doc.get_style_sheet()
        if not new_style_sheet:
            return self.doc.get_style_sheet()

        # update title font size
        pstyle_name = 'FC-Title'
        p_style = new_style_sheet.get_paragraph_style(pstyle_name)
        if p_style:
            title_font = p_style.get_font()
            if title_font:
                title_width = utils.pt2cm(
                    self.doc.string_multiline_width(title_font, title))
                while (title_width > self.doc.get_usable_width() and
                       title_font.get_size() > 1):
                    title_font.set_size(title_font.get_size()-1)
                    title_width = utils.pt2cm(
                        self.doc.string_multiline_width(title_font, title))
                new_style_sheet.add_paragraph_style(pstyle_name, p_style)

        # biggest font allowed is the one of the fist generation, after,
        # always lower than the previous one
        p_style = new_style_sheet.get_paragraph_style(self.text_style[0])
        font = None
        if p_style:
            font = p_style.get_font()
        if font:
            previous_generation_font_size = font.get_size()

            for generation in range(0, self.max_generations):
                gstyle_name = self.graphic_style[generation]
                pstyle_name = self.text_style[generation]
                g_style = new_style_sheet.get_draw_style(gstyle_name)

                # p_style is a copy of 'FC-Text' - use different style
                # to be able to auto change some fonts for some generations
                if map_style_from_single:
                    p_style = new_style_sheet.get_paragraph_style('FC-Text')
                else:
                    p_style = new_style_sheet.get_paragraph_style(pstyle_name)

                if g_style and p_style:
                    # set graphic colors to paragraph colors,
                    # while it's functionnaly
                    # the same for fanchart or make backgrounds white
                    if make_background_white:
                        g_style.set_fill_color((255, 255, 255))
                        new_style_sheet.add_draw_style(gstyle_name, g_style)
                    elif map_paragraphs_colors_to_graphics:
                        pstyle = new_style_sheet.get_paragraph_style(
                            pstyle_name)
                        if pstyle:
                            g_style.set_fill_color(
                                pstyle.get_background_color())
                            new_style_sheet.add_draw_style(gstyle_name,
                                                           g_style)

                    # adapt font size if too big
                    segments = 2**generation
                    if generation < min(max_circular, self.max_generations):
                        # adpatation for circular fonts
                        rad1, rad2 = self.get_circular_radius(
                            block_size, generation, self.circle)
                        font = p_style.get_font()
                        if font:
                            min_font_size = font.get_size()
                            # find the smallest font required
                            for index in range(segments - 1, 2*segments - 1):
                                if self.map[index]:
                                    font_size = \
                                        self.get_optimized_font_size_for_text(
                                            rad1, rad2, self.text[index],
                                            p_style.get_font(),
                                            (self.circle == FULL_CIRCLE and
                                             generation == 0)
                                            )
                                if font_size < min_font_size:
                                    min_font_size = font_size
                            font.set_size(min(previous_generation_font_size,
                                              min_font_size))
                    else:
                        # adaptation for radial fonts

                        # find the largest string for the generation
                        longest_line = ""
                        longest_width = 0
                        for index in range(segments - 1, 2*segments - 1):
                            if self.map[index]:
                                for line in self.text[index]:
                                    width = utils.pt2cm(
                                        self.doc.string_multiline_width(
                                            p_style.get_font(), line))
                                    if width > longest_width:
                                        longest_line = line
                                        longest_width = width

                        # determine maximum width allowed for this generation
                        rad1, rad2 = self.get_radial_radius(
                            block_size, generation, self.circle)
                        max_width = rad2 - rad1

                        # reduce the font so that longest_width
                        # fit into max_width
                        font = p_style.get_font()
                        if font:
                            font.set_size(min(previous_generation_font_size,
                                              self.get_optimized_font_size(
                                                  longest_line,
                                                  p_style.get_font(),
                                                  max_width)))

                    # redefine the style
                    new_style_sheet.add_paragraph_style(pstyle_name, p_style)
                    font = p_style.get_font()
        if font:
            previous_generation_font_size = font.get_size()

        # finished
        return new_style_sheet
Exemplo n.º 47
0
    def write_report(self):
        self.doc.start_page()

        self.apply_filter(self.center_person.get_handle(), 1)
        p_rn = self.center_person.get_primary_name().get_regular_name()

        if self.circle == FULL_CIRCLE:
            max_angle = 360.0
            start_angle = 90
            max_circular = 5
            _x_ = self.doc.get_usable_width() / 2.0
            _y_ = self.doc.get_usable_height() / 2.0
            min_xy = min(_x_, _y_)

        elif self.circle == HALF_CIRCLE:
            max_angle = 180.0
            start_angle = 180
            max_circular = 3
            _x_ = (self.doc.get_usable_width()/2.0)
            _y_ = self.doc.get_usable_height()
            min_xy = min(_x_, _y_)

        else:  # quarter circle
            max_angle = 90.0
            start_angle = 270
            max_circular = 2
            _x_ = 0
            _y_ = self.doc.get_usable_height()
            min_xy = min(self.doc.get_usable_width(), _y_)

        # choose  one line or two lines translation according to the width
        title = self._("%(generations)d Generation Fan Chart "
                       "for %(person)s") % {
                           'generations' : self.max_generations,
                           'person' : p_rn}
        title_nb_lines = 1
        style_sheet = self.doc.get_style_sheet()
        if style_sheet:
            p_style = style_sheet.get_paragraph_style('FC-Title')
            if p_style:
                font = p_style.get_font()
                if font:
                    title_width = utils.pt2cm(self.doc.string_width(font,
                                                                    title))
                    if title_width > self.doc.get_usable_width():
                        title = self._(
                            "%(generations)d Generation Fan Chart "
                            "for\n%(person)s") % {
                                'generations' : self.max_generations,
                                'person' : p_rn}
                        title_nb_lines = 2

        if self.circle == FULL_CIRCLE or self.circle == QUAR_CIRCLE:
            # adjust only if full circle or 1/4 circle in landscape mode
            if self.doc.get_usable_height() <= self.doc.get_usable_width():
                # Should be in Landscape now
                style_sheet = self.doc.get_style_sheet()
                p_style = style_sheet.get_paragraph_style('FC-Title')
                if p_style:
                    font = p_style.get_font()
                    if font:
                        fontsize = utils.pt2cm(font.get_size())
                        # _y_ is vertical distance to center of circle,
                        # move center down 1 fontsize
                        _y_ += fontsize*title_nb_lines
                        # min_XY is the diameter of the circle,
                        # subtract two fontsize
                        # so we dont draw outside bottom of the paper
                        min_xy = min(min_xy, _y_ - 2*fontsize*title_nb_lines)
        if self.max_generations > max_circular:
            block_size = min_xy / (self.max_generations * 2 - max_circular)
        else:
            block_size = min_xy / self.max_generations

        # adaptation of the fonts (title and others)
        optimized_style_sheet = self.get_optimized_style_sheet(
            title, max_circular, block_size, self.same_style,
            not self.same_style,
            # if same_style, use default generated colors
            self.background == BACKGROUND_WHITE)

        if optimized_style_sheet:
            self.doc.set_style_sheet(optimized_style_sheet)

        # title
        mark = IndexMark(title, INDEX_TYPE_TOC, 1)
        self.doc.center_text('FC-Graphic-title', title,
                             self.doc.get_usable_width() / 2, 0, mark)
        # wheel
        for generation in range(0, min(max_circular, self.max_generations)):
            self.draw_circular(_x_, _y_,
                               start_angle, max_angle, block_size, generation)
        for generation in range(max_circular, self.max_generations):
            self.draw_radial(_x_, _y_,
                             start_angle, max_angle, block_size, generation)
        self.doc.end_page()
Exemplo n.º 48
0
    def make_default_style(self, default_style):
        # this is for the page header
        font = docgen.FontStyle()
        font.set_size(18)
        font.set_type_face(docgen.FONT_SANS_SERIF)
        font.set_bold(True)

        para = docgen.ParagraphStyle()
        para.set_header_level(1)
        para.set_alignment(docgen.PARA_ALIGN_CENTER)
        para.set_top_margin(0.25)
        para.set_bottom_margin(0.25)
        para.set_font(font)
        para.set_description(_('The style used for the title of the page.'))

        default_style.add_paragraph_style('LCR-Title',para)

        # this is for the section headers
        font = docgen.FontStyle()
        font.set_size(14)
        font.set_type_face(docgen.FONT_SANS_SERIF)
        font.set_bold(True)

        para = docgen.ParagraphStyle()
        para.set_header_level(2)
        para.set_top_margin(0.25)
        para.set_bottom_margin(0.25)
        para.set_font(font)
        para.set_description(_('The style used for the section headers.'))

        default_style.add_paragraph_style('LCR-SecHeader',para)

        font = docgen.FontStyle()
        font.set_size(12)
        font.set_type_face(docgen.FONT_SERIF)

        para = docgen.ParagraphStyle()
        para.set_font(font)
        para.set_description(_('The style used for normal text'))

        default_style.add_paragraph_style('LCR-Normal',para)

        font = docgen.FontStyle()
        font.set_size(12)
        font.set_bold(True)
        para = docgen.ParagraphStyle()
        para.set(first_indent=-0.75, lmargin=.75)
        para.set_font(font)
        para.set_top_margin(ReportUtils.pt2cm(3))
        para.set_bottom_margin(ReportUtils.pt2cm(3))
        para.set_description(_('The basic style used for table headings.'))
        default_style.add_paragraph_style("LCR-Normal-Bold", para)

        #Table Styles
        cell = docgen.TableCellStyle()
        default_style.add_cell_style('LCR-TableCell', cell)

        cell = docgen.TableCellStyle()
        cell.set_bottom_border(1)
        default_style.add_cell_style('LCR-BorderCell', cell)

        table = docgen.TableStyle()
        table.set_width(100)
        table.set_columns(4)
        table.set_column_width(0, 5)
        table.set_column_width(1, 15)
        table.set_column_width(2, 50)
        table.set_column_width(3, 30)
        default_style.add_table_style('LCR-Table', table)
Exemplo n.º 49
0
    def make_default_style(self, default_style):
        """Make the default output style for the Todo Report."""
        # Paragraph Styles
        font = docgen.FontStyle()
        font.set_size(16)
        font.set_type_face(docgen.FONT_SANS_SERIF)
        font.set_bold(1)
        para = docgen.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(docgen.PARA_ALIGN_CENTER)
        para.set_description(_("The style used for the title of the page."))
        default_style.add_paragraph_style("TR-Title", para)

        font = docgen.FontStyle()
        font.set(face=docgen.FONT_SANS_SERIF, size=14, italic=1)
        para = docgen.ParagraphStyle()
        para.set_font(font)
        para.set_header_level(2)
        para.set_top_margin(0.25)
        para.set_bottom_margin(0.25)
        para.set_description(_("The style used for the section headers."))
        default_style.add_paragraph_style("TR-Heading", para)

        font = docgen.FontStyle()
        font.set_size(12)
        para = docgen.ParagraphStyle()
        para.set(first_indent=-0.75, lmargin=0.75)
        para.set_font(font)
        para.set_top_margin(ReportUtils.pt2cm(3))
        para.set_bottom_margin(ReportUtils.pt2cm(3))
        para.set_description(_("The basic style used for the text display."))
        default_style.add_paragraph_style("TR-Normal", para)

        font = docgen.FontStyle()
        font.set_size(12)
        font.set_bold(True)
        para = docgen.ParagraphStyle()
        para.set(first_indent=-0.75, lmargin=0.75)
        para.set_font(font)
        para.set_top_margin(ReportUtils.pt2cm(3))
        para.set_bottom_margin(ReportUtils.pt2cm(3))
        para.set_description(_("The basic style used for table headings."))
        default_style.add_paragraph_style("TR-Normal-Bold", para)

        para = docgen.ParagraphStyle()
        para.set(first_indent=-0.75, lmargin=0.75)
        para.set_top_margin(ReportUtils.pt2cm(3))
        para.set_bottom_margin(ReportUtils.pt2cm(3))
        para.set_description(_("The basic style used for the note display."))
        default_style.add_paragraph_style("TR-Note", para)

        # Table Styles
        cell = docgen.TableCellStyle()
        default_style.add_cell_style("TR-TableCell", cell)

        cell = docgen.TableCellStyle()
        cell.set_bottom_border(1)
        default_style.add_cell_style("TR-BorderCell", cell)

        table = docgen.TableStyle()
        table.set_width(100)
        table.set_columns(4)
        table.set_column_width(0, 10)
        table.set_column_width(1, 30)
        table.set_column_width(2, 30)
        table.set_column_width(3, 30)
        default_style.add_table_style("TR-Table", table)
Exemplo n.º 50
0
    def make_default_style(self, default_style):
        """Make the default output style for the Individual Complete Report."""
        # Paragraph Styles
        font = FontStyle()
        font.set_bold(1)
        font.set_type_face(FONT_SANS_SERIF)
        font.set_size(16)
        para = ParagraphStyle()
        para.set_alignment(PARA_ALIGN_CENTER)
        para.set_top_margin(ReportUtils.pt2cm(8))
        para.set_bottom_margin(ReportUtils.pt2cm(8))
        para.set_font(font)
        para.set_description(_("The style used for the title of the page."))
        default_style.add_paragraph_style("IDS-Title", para)

        font = FontStyle()
        font.set_bold(1)
        font.set_type_face(FONT_SANS_SERIF)
        font.set_size(12)
        font.set_italic(1)
        para = ParagraphStyle()
        para.set_font(font)
        para.set_top_margin(ReportUtils.pt2cm(3))
        para.set_bottom_margin(ReportUtils.pt2cm(3))
        para.set_description(_("The style used for category labels."))
        default_style.add_paragraph_style("IDS-TableTitle", para)

        font = FontStyle()
        font.set_bold(1)
        font.set_type_face(FONT_SANS_SERIF)
        font.set_size(12)
        para = ParagraphStyle()
        para.set_font(font)
        para.set_top_margin(ReportUtils.pt2cm(3))
        para.set_bottom_margin(ReportUtils.pt2cm(3))
        para.set_description(_("The style used for the spouse's name."))
        default_style.add_paragraph_style("IDS-Spouse", para)

        font = FontStyle()
        font.set_size(12)
        para = ParagraphStyle()
        para.set_font(font)
        para.set_top_margin(ReportUtils.pt2cm(3))
        para.set_bottom_margin(ReportUtils.pt2cm(3))
        para.set_description(_('The basic style used for the text display.'))
        default_style.add_paragraph_style("IDS-Normal", para)

        font = FontStyle()
        font.set_size(12)
        font.set_italic(1)
        para = ParagraphStyle()
        para.set_font(font)
        para.set_top_margin(ReportUtils.pt2cm(3))
        para.set_bottom_margin(ReportUtils.pt2cm(3))
        para.set_description(_('The style used for the section headers.'))
        default_style.add_paragraph_style("IDS-Section", para)

        font = FontStyle()
        font.set_size(8)
        para = ParagraphStyle()
        para.set_alignment(PARA_ALIGN_RIGHT)
        para.set_font(font)
        para.set_top_margin(ReportUtils.pt2cm(3))
        para.set_bottom_margin(ReportUtils.pt2cm(3))
        para.set_description(_('A style used for image facts.'))
        default_style.add_paragraph_style("IDS-ImageNote", para)

        font = FontStyle()
        font.set_size(8)
        para = ParagraphStyle()
        para.set_alignment(PARA_ALIGN_CENTER)
        para.set_font(font)
        para.set_top_margin(ReportUtils.pt2cm(3))
        para.set_bottom_margin(ReportUtils.pt2cm(3))
        para.set_description(_('A style used for image captions.'))
        default_style.add_paragraph_style("IDS-ImageCaptionCenter", para)

        # Table Styles
        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 = 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 = TableCellStyle()
        cell.set_top_border(1)
        cell.set_bottom_border(1)
        default_style.add_cell_style("IDS-TableHead", cell)

        cell = TableCellStyle()
        default_style.add_cell_style("IDS-NormalCell", cell)

        cell = TableCellStyle()
        cell.set_longlist(1)
        default_style.add_cell_style("IDS-ListCell", cell)

        tbl = TableStyle()
        tbl.set_width(100)
        tbl.set_columns(3)
        tbl.set_column_width(0,20)
        tbl.set_column_width(1,50)
        tbl.set_column_width(2,30)
        default_style.add_table_style('IDS-PersonTable', tbl)

        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-PersonTable2', tbl)

        tbl = TableStyle()
        tbl.set_width(100)
        tbl.set_columns(5)
        tbl.set_column_width(0,22) # Type
        tbl.set_column_width(1,22) # Date
        tbl.set_column_width(2,16) # Status
        tbl.set_column_width(3,22) # Temple
        tbl.set_column_width(4,18) # Place
        default_style.add_table_style('IDS-OrdinanceTable', tbl)

        tbl = TableStyle()
        tbl.set_width(100)
        tbl.set_columns(6)
        tbl.set_column_width(0,20) # empty
        tbl.set_column_width(1,18) # Type
        tbl.set_column_width(2,18) # Date
        tbl.set_column_width(3,14) # Status
        tbl.set_column_width(4,18) # Temple
        tbl.set_column_width(5,12) # Place
        default_style.add_table_style('IDS-OrdinanceTable2', tbl)

        tbl = TableStyle()
        tbl.set_width(100)
        tbl.set_columns(3)
        tbl.set_column_width(0, 33)
        tbl.set_column_width(1, 33)
        tbl.set_column_width(2, 34)
        default_style.add_table_style("IDS-GalleryTable", tbl)

        Endnotes.add_endnote_styles(default_style)
Exemplo n.º 51
0
    def make_default_style(self, default_style):
        """Make the default output style for the End of Line Report."""
        # Paragraph Styles
        font = FontStyle()
        font.set_size(16)
        font.set_type_face(FONT_SANS_SERIF)
        font.set_bold(1)
        para = ParagraphStyle()
        para.set_header_level(1)
        para.set_bottom_border(1)
        para.set_bottom_margin(utils.pt2cm(8))
        para.set_font(font)
        para.set_alignment(PARA_ALIGN_CENTER)
        para.set_description(_("The style used for the title."))
        default_style.add_paragraph_style("EOL-Title", para)

        font = FontStyle()
        font.set(face=FONT_SANS_SERIF, size=12, italic=1)
        para = ParagraphStyle()
        para.set_bottom_margin(utils.pt2cm(6))
        para.set_font(font)
        para.set_alignment(PARA_ALIGN_CENTER)
        para.set_description(_('The style used for the subtitle.'))
        default_style.add_paragraph_style("EOL-Subtitle", para)

        font = FontStyle()
        font.set_size(10)
        para = ParagraphStyle()
        para.set_font(font)
        para.set_top_margin(utils.pt2cm(6))
        para.set_bottom_margin(utils.pt2cm(6))
        para.set_description(_('The basic style used for the text display.'))
        default_style.add_paragraph_style("EOL-Normal", para)

        font = FontStyle()
        font.set_size(12)
        font.set_italic(True)
        para = ParagraphStyle()
        para.set_font(font)
        para.set_top_margin(utils.pt2cm(6))
        para.set_description(_('The style used for the generation header.'))
        default_style.add_paragraph_style("EOL-Generation", para)

        font = FontStyle()
        font.set_size(8)
        para = ParagraphStyle()
        para.set_font(font)
        para.set_top_margin(0)
        para.set_bottom_margin(utils.pt2cm(6))
        para.set_description(_('The style used for details.'))
        default_style.add_paragraph_style("EOL-Pedigree", para)

        #Table Styles
        cell = TableCellStyle()
        default_style.add_cell_style('EOL-TableCell', cell)

        cell = TableCellStyle()
        cell.set_bottom_border(1)
        default_style.add_cell_style('EOL_GenerationCell', cell)

        table = TableStyle()
        table.set_width(100)
        table.set_columns(2)
        table.set_column_width(0, 10)
        table.set_column_width(1, 90)
        default_style.add_table_style('EOL-Table', table)
Exemplo n.º 52
0
    def generate_timeline(self, low, high):
        """ generate the timeline """
        st_size = self.name_size()
        style_sheet = self.doc.get_style_sheet()
        font = style_sheet.get_paragraph_style('TLG-Name').get_font()
        incr = utils.pt2cm(font.get_size())
        pad = incr * 0.75
        _x1, _x2, _y1, _y2 = (0, 0, 0, 0)
        start = st_size + 0.5
        stop = self.doc.get_usable_width() - 0.5
        size = stop - start
        self.header = 2.6

        # Sort the people as requested
        with self._user.progress(_('Timeline'),
                                 _('Sorting dates...'), 0) as step:
            self.plist.sort(key=self.sort_func)

        self.doc.start_page()
        self.build_grid(low, high, start, stop, True)

        index = 1
        current = 1

        length = len(self.plist)

        with self._user.progress(_('Timeline'), _('Calculating timeline...'),
                                 length) as step:

            for p_id in self.plist:
                person = self.database.get_person_from_handle(p_id)
                birth = get_birth_or_fallback(self.database, person)
                if birth:
                    bth = birth.get_date_object()
                    bth = bth.to_calendar(self.calendar).get_year()
                else:
                    bth = None

                death = get_death_or_fallback(self.database, person)
                if death:
                    dth = death.get_date_object()
                    dth = dth.to_calendar(self.calendar).get_year()
                else:
                    dth = None

                dname = self._name_display.display(person)
                mark = utils.get_person_mark(self.database, person)
                self.doc.draw_text('TLG-text', dname, incr + pad,
                                   self.header + (incr + pad) * index, mark)

                _y1 = self.header + (pad + incr) * index
                _y2 = self.header + ((pad + incr) * index) + incr
                _y3 = (_y1 + _y2) / 2.0
                w05 = 0.05

                if bth:
                    start_offset = ((float(bth - low) / float(high - low)) *
                                    size)
                    _x1 = start + start_offset
                    path = [(_x1, _y1), (_x1 + w05, _y3),
                            (_x1, _y2), (_x1 - w05, _y3)]
                    self.doc.draw_path('TLG-line', path)

                if dth:
                    start_offset = ((float(dth - low) / float(high - low)) *
                                    size)
                    _x1 = start + start_offset
                    path = [(_x1, _y1), (_x1 + w05, _y3),
                            (_x1, _y2), (_x1 - w05, _y3)]
                    self.doc.draw_path('TLG-solid', path)

                if bth and dth:
                    start_offset = ((float(bth - low) / float(high - low)) *
                                    size) + w05
                    stop_offset = ((float(dth - low) / float(high - low)) *
                                   size) - w05

                    _x1 = start + start_offset
                    _x2 = start + stop_offset
                    self.doc.draw_line('open', _x1, _y3, _x2, _y3)

                if (_y2 + incr) >= self.doc.get_usable_height():
                    if current != length:
                        self.doc.end_page()
                        self.doc.start_page()
                        self.build_grid(low, high, start, stop)
                    index = 1
                    _x1, _x2, _y1, _y2 = (0, 0, 0, 0)
                else:
                    index += 1
                current += 1
                step()
            self.doc.end_page()
Exemplo n.º 53
0
    def make_default_style(self, default_style):
        """Make the default output style for the End of Line Report."""
        # Paragraph Styles
        f = FontStyle()
        f.set_size(16)
        f.set_type_face(FONT_SANS_SERIF)
        f.set_bold(1)
        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(PARA_ALIGN_CENTER)
        p.set_description(_("The style used for the title of the page."))
        default_style.add_paragraph_style("EOL-Title", p)

        font = FontStyle()
        font.set(face=FONT_SANS_SERIF, size=12, italic=1)
        p = ParagraphStyle()
        p.set_bottom_margin(ReportUtils.pt2cm(6))
        p.set_font(font)
        p.set_alignment(PARA_ALIGN_CENTER)
        p.set_description(_('The style used for the section headers.'))
        default_style.add_paragraph_style("EOL-Subtitle", p)

        font = FontStyle()
        font.set_size(10)
        p = ParagraphStyle()
        p.set_font(font)
        p.set_top_margin(ReportUtils.pt2cm(6))
        p.set_bottom_margin(ReportUtils.pt2cm(6))
        p.set_description(_('The basic style used for the text display.'))
        default_style.add_paragraph_style("EOL-Normal", p)

        font = FontStyle()
        font.set_size(12)
        font.set_italic(True)
        p = ParagraphStyle()
        p.set_font(font)
        p.set_top_margin(ReportUtils.pt2cm(6))
        p.set_description(_('The basic style used for generation headings.'))
        default_style.add_paragraph_style("EOL-Generation", p)

        font = FontStyle()
        font.set_size(8)
        p = ParagraphStyle()
        p.set_font(font)
        p.set_top_margin(0)
        p.set_bottom_margin(ReportUtils.pt2cm(6))
        p.set_description(_('The basic style used for the text display.'))
        default_style.add_paragraph_style("EOL-Pedigree", p)

        #Table Styles
        cell = TableCellStyle()
        default_style.add_cell_style('EOL-TableCell', cell)

        cell = TableCellStyle()
        cell.set_bottom_border(1)
        default_style.add_cell_style('EOL_GenerationCell', cell)

        table = TableStyle()
        table.set_width(100)
        table.set_columns(2)
        table.set_column_width(0, 10)
        table.set_column_width(1, 90)
        default_style.add_table_style('EOL-Table', table)
Exemplo n.º 54
0
    def make_default_style(self, default_style):
        """Make the default output style for the Todo Report."""
        # Paragraph Styles
        font = docgen.FontStyle()
        font.set_size(16)
        font.set_type_face(docgen.FONT_SANS_SERIF)
        font.set_bold(1)
        para = docgen.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(docgen.PARA_ALIGN_CENTER)
        para.set_description(_("The style used for the title of the page."))
        default_style.add_paragraph_style(_("TR-Title"), para)

        font = docgen.FontStyle()
        font.set(face=docgen.FONT_SANS_SERIF, size=14, italic=1)
        para = docgen.ParagraphStyle()
        para.set_font(font)
        para.set_header_level(2)
        para.set_top_margin(0.25)
        para.set_bottom_margin(0.25)
        para.set_description(_('The style used for the section headers.'))
        default_style.add_paragraph_style(_("TR-Heading"), para)

        font = docgen.FontStyle()
        font.set_size(12)
        para = docgen.ParagraphStyle()
        para.set(first_indent=-0.75, lmargin=.75)
        para.set_font(font)
        para.set_top_margin(ReportUtils.pt2cm(3))
        para.set_bottom_margin(ReportUtils.pt2cm(3))
        para.set_description(_('The basic style used for the text display.'))
        default_style.add_paragraph_style(_("TR-Normal"), para)

        font = docgen.FontStyle()
        font.set_size(12)
        font.set_bold(True)
        para = docgen.ParagraphStyle()
        para.set(first_indent=-0.75, lmargin=.75)
        para.set_font(font)
        para.set_top_margin(ReportUtils.pt2cm(3))
        para.set_bottom_margin(ReportUtils.pt2cm(3))
        para.set_description(_('The basic style used for table headings.'))
        default_style.add_paragraph_style(_("TR-Normal-Bold"), para)

        para = docgen.ParagraphStyle()
        para.set(first_indent=-0.75, lmargin=.75)
        para.set_top_margin(ReportUtils.pt2cm(3))
        para.set_bottom_margin(ReportUtils.pt2cm(3))
        para.set_description(_('The basic style used for the note display.'))
        default_style.add_paragraph_style(_("TR-Note"), para)

        #Table Styles
        cell = docgen.TableCellStyle()
        cell.set_description(
            _('The basic style used for the table cell display.'))
        default_style.add_cell_style(_('TR-TableCell'), cell)

        cell = docgen.TableCellStyle()
        cell.set_bottom_border(1)
        cell.set_description(
            _('The basic style used for the table border cell display.'))
        default_style.add_cell_style(_('TR-BorderCell'), cell)

        table = docgen.TableStyle()
        table.set_width(100)
        table.set_columns(4)
        table.set_column_width(0, 10)
        table.set_column_width(1, 30)
        table.set_column_width(2, 30)
        table.set_column_width(3, 30)
        table.set_description(_('The basic style used for the table display.'))
        default_style.add_table_style(_('TR-Table'), table)