Beispiel #1
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()
Beispiel #2
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 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_description(_("The style used for the 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(utils.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(utils.pt2cm(8))
        para.set_description(_('The style used for the footer.'))
        default_style.add_paragraph_style('REC-Footer', para)
Beispiel #3
0
 def make_my_style(self,
                   default_style,
                   name,
                   description,
                   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 = FontStyle()
     f.set_size(size)
     f.set_type_face(font)
     f.set_italic(italic)
     f.set_bold(bold)
     p = ParagraphStyle()
     p.set_font(f)
     p.set_alignment(align)
     p.set_description(description)
     p.set_top_border(borders)
     p.set_left_border(borders)
     p.set_bottom_border(borders)
     p.set_right_border(borders)
     if indent:
         p.set(first_indent=indent)
     if justified == "left":
         p.set_alignment(PARA_ALIGN_LEFT)
     elif justified == "right":
         p.set_alignment(PARA_ALIGN_RIGHT)
     elif justified == "center":
         p.set_alignment(PARA_ALIGN_CENTER)
     default_style.add_paragraph_style(name, p)
     # Graphics:
     g = GraphicsStyle()
     g.set_paragraph_style(name)
     if shadow:
         g.set_shadow(*shadow)
     if color is not None:
         g.set_fill_color(color)
     if not borders:
         g.set_line_width(0)
     default_style.add_draw_style(name, g)
Beispiel #4
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 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)
Beispiel #5
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)
Beispiel #6
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)
Beispiel #7
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 of the page."))
        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)
Beispiel #8
0
    def make_default_style(self, default_style):
        """Make the default output style for the Fan Chart report."""
        background_colors = [(255, 63, 0), (255, 175, 15), (255, 223, 87),
                             (255, 255, 111), (159, 255, 159), (111, 215, 255),
                             (79, 151, 255), (231, 23, 255), (231, 23, 221),
                             (210, 170, 124), (189, 153, 112)]

        #Paragraph Styles
        f_style = FontStyle()
        f_style.set_size(18)
        f_style.set_bold(1)
        f_style.set_type_face(FONT_SANS_SERIF)
        p_style = ParagraphStyle()
        p_style.set_font(f_style)
        p_style.set_alignment(PARA_ALIGN_CENTER)
        p_style.set_description(_('The style used for the title.'))
        default_style.add_paragraph_style("FC-Title", p_style)

        f_style = FontStyle()
        f_style.set_size(9)
        f_style.set_type_face(FONT_SANS_SERIF)
        p_style = ParagraphStyle()
        p_style.set_font(f_style)
        p_style.set_alignment(PARA_ALIGN_CENTER)
        p_style.set_description(
            _('The basic style used for the default text display.'))
        default_style.add_paragraph_style("FC-Text", p_style)

        for i in range(0, self.max_generations):
            f_style = FontStyle()
            f_style.set_size(9)
            f_style.set_type_face(FONT_SANS_SERIF)
            p_style = ParagraphStyle()
            p_style.set_font(f_style)
            p_style.set_alignment(PARA_ALIGN_CENTER)
            p_style.set_description(
                _('The style used for the text display of generation "%d"') %
                i)
            default_style.add_paragraph_style("FC-Text" + "%02d" % i, p_style)

        # GraphicsStyles
        g_style = GraphicsStyle()
        g_style.set_paragraph_style('FC-Title')
        default_style.add_draw_style('FC-Graphic-title', g_style)

        for i in range(0, self.max_generations):
            g_style = GraphicsStyle()
            g_style.set_paragraph_style('FC-Text' + '%02d' % i)
            g_style.set_fill_color(background_colors[i])
            default_style.add_draw_style('FC-Graphic' + '%02d' % i, g_style)
Beispiel #9
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 of the page."))
        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 section headers.'))
        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 basic style used for generation headings.'))
        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 basic style used for the text display.'))
        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)
Beispiel #10
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(utils.pt2cm(8))
        para.set_bottom_margin(utils.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(utils.pt2cm(3))
        para.set_bottom_margin(utils.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(utils.pt2cm(3))
        para.set_bottom_margin(utils.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(utils.pt2cm(3))
        para.set_bottom_margin(utils.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(utils.pt2cm(3))
        para.set_bottom_margin(utils.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(utils.pt2cm(3))
        para.set_bottom_margin(utils.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(utils.pt2cm(3))
        para.set_bottom_margin(utils.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)
Beispiel #11
0
    def make_default_style(self, default_style):
        """Make default output style for the Family Group Report."""
        para = ParagraphStyle()
        #Paragraph Styles
        font = FontStyle()
        font.set_size(4)
        para.set_font(font)
        default_style.add_paragraph_style('FGR-blank', para)

        font = FontStyle()
        font.set_type_face(FONT_SANS_SERIF)
        font.set_size(16)
        font.set_bold(1)
        para = ParagraphStyle()
        para.set_font(font)
        para.set_alignment(PARA_ALIGN_CENTER)
        para.set_header_level(1)
        para.set_description(_("The style used for the title of the page."))
        default_style.add_paragraph_style('FGR-Title', para)

        font = FontStyle()
        font.set_type_face(FONT_SERIF)
        font.set_size(10)
        font.set_bold(0)
        para = ParagraphStyle()
        para.set_font(font)
        para.set_description(_('The basic style used for the text display.'))
        default_style.add_paragraph_style('FGR-Normal', para)

        para = ParagraphStyle()
        font = FontStyle()
        font.set_type_face(FONT_SERIF)
        font.set_size(10)
        font.set_bold(0)
        para.set_font(font)
        para.set(lmargin=0.0)
        para.set_top_margin(0.0)
        para.set_bottom_margin(0.0)
        para.set_description(_('The basic style used for the note display.'))
        default_style.add_paragraph_style("FGR-Note", para)

        font = FontStyle()
        font.set_type_face(FONT_SANS_SERIF)
        font.set_size(10)
        font.set_bold(1)
        para = ParagraphStyle()
        para.set_font(font)
        para.set_description(
            _('The style used for the text related to the children.'))
        default_style.add_paragraph_style('FGR-ChildText', para)

        font = FontStyle()
        font.set_type_face(FONT_SANS_SERIF)
        font.set_size(12)
        font.set_bold(1)
        para = ParagraphStyle()
        para.set_font(font)
        para.set_header_level(3)
        para.set_description(_("The style used for the parent's name"))
        default_style.add_paragraph_style('FGR-ParentName', para)

        #Table Styles
        cell = TableCellStyle()
        cell.set_padding(0.2)
        cell.set_top_border(1)
        cell.set_bottom_border(1)
        cell.set_right_border(1)
        cell.set_left_border(1)
        default_style.add_cell_style('FGR-ParentHead', cell)

        cell = TableCellStyle()
        cell.set_padding(0.1)
        cell.set_bottom_border(1)
        cell.set_left_border(1)
        default_style.add_cell_style('FGR-TextContents', cell)

        cell = TableCellStyle()
        cell.set_padding(0.1)
        cell.set_bottom_border(0)
        cell.set_left_border(1)
        cell.set_padding(0.1)
        default_style.add_cell_style('FGR-TextChild1', cell)

        cell = TableCellStyle()
        cell.set_padding(0.1)
        cell.set_bottom_border(1)
        cell.set_left_border(1)
        cell.set_padding(0.1)
        default_style.add_cell_style('FGR-TextChild2', cell)

        cell = TableCellStyle()
        cell.set_padding(0.1)
        cell.set_bottom_border(1)
        cell.set_right_border(1)
        cell.set_left_border(1)
        default_style.add_cell_style('FGR-TextContentsEnd', cell)

        cell = TableCellStyle()
        cell.set_padding(0.2)
        cell.set_bottom_border(1)
        cell.set_right_border(1)
        cell.set_left_border(1)
        default_style.add_cell_style('FGR-ChildName', cell)

        table = TableStyle()
        table.set_width(100)
        table.set_columns(3)
        table.set_column_width(0, 20)
        table.set_column_width(1, 40)
        table.set_column_width(2, 40)
        default_style.add_table_style('FGR-ParentTable', table)

        table = TableStyle()
        table.set_width(100)
        table.set_columns(4)
        table.set_column_width(0, 7)
        table.set_column_width(1, 18)
        table.set_column_width(2, 35)
        table.set_column_width(3, 40)
        default_style.add_table_style('FGR-ChildTable', table)
Beispiel #12
0
    def make_default_style(self, default_style):
        """Make the default output style for the Timeline report."""
        # Paragraph Styles
        fstyle = FontStyle()
        fstyle.set_size(10)
        fstyle.set_type_face(FONT_SANS_SERIF)
        pstyle = ParagraphStyle()
        pstyle.set_font(fstyle)
        pstyle.set_description(_("The style used for the person's name."))
        default_style.add_paragraph_style("TLG-Name", pstyle)

        fstyle = FontStyle()
        fstyle.set_size(8)
        fstyle.set_type_face(FONT_SANS_SERIF)
        pstyle = ParagraphStyle()
        pstyle.set_font(fstyle)
        pstyle.set_alignment(PARA_ALIGN_CENTER)
        pstyle.set_description(_("The style used for the year labels."))
        default_style.add_paragraph_style("TLG-Label", pstyle)

        fstyle = FontStyle()
        fstyle.set_size(14)
        fstyle.set_type_face(FONT_SANS_SERIF)
        pstyle = ParagraphStyle()
        pstyle.set_font(fstyle)
        pstyle.set_alignment(PARA_ALIGN_CENTER)
        pstyle.set_description(_("The style used for the title of the page."))
        default_style.add_paragraph_style("TLG-Title", pstyle)
        """
        Graphic Styles
            TLG-grid  - 0.5pt wide line dashed line. Used for the lines that
                        make up the grid.
            TLG-line  - 0.5pt wide line. Used for the line connecting two
                        endpoints and for the birth marker.
            TLG-solid - 0.5pt line with a black fill color. Used for the date of
                        death marker.
            TLG-text  - Contains the TLG-Name paragraph style used for the
                        individual's name.
            TLG-title - Contains the TLG-Title paragraph style used for the
                        title of the document.
            TLG-label - Contains the TLG-Label paragraph style used for the year
                        label's in the document.
        """
        gstyle = GraphicsStyle()
        gstyle.set_line_width(0.5)
        gstyle.set_color((0, 0, 0))
        default_style.add_draw_style("TLG-line", gstyle)

        gstyle = GraphicsStyle()
        gstyle.set_line_width(0.5)
        gstyle.set_color((0, 0, 0))
        gstyle.set_fill_color((0, 0, 0))
        default_style.add_draw_style("TLG-solid", gstyle)

        gstyle = GraphicsStyle()
        gstyle.set_line_width(0.5)
        gstyle.set_color((0, 0, 0))
        gstyle.set_fill_color((255, 255, 255))
        default_style.add_draw_style("open", gstyle)

        gstyle = GraphicsStyle()
        gstyle.set_line_width(0.5)
        gstyle.set_line_style(DASHED)
        gstyle.set_color((0, 0, 0))
        default_style.add_draw_style("TLG-grid", gstyle)

        gstyle = GraphicsStyle()
        gstyle.set_paragraph_style("TLG-Name")
        gstyle.set_color((0, 0, 0))
        gstyle.set_fill_color((255, 255, 255))
        gstyle.set_line_width(0)
        default_style.add_draw_style("TLG-text", gstyle)

        gstyle = GraphicsStyle()
        gstyle.set_paragraph_style("TLG-Title")
        gstyle.set_color((0, 0, 0))
        gstyle.set_fill_color((255, 255, 255))
        gstyle.set_line_width(0)
        default_style.add_draw_style("TLG-title", gstyle)

        gstyle = GraphicsStyle()
        gstyle.set_paragraph_style("TLG-Label")
        gstyle.set_color((0, 0, 0))
        gstyle.set_fill_color((255, 255, 255))
        gstyle.set_line_width(0)
        default_style.add_draw_style("TLG-label", gstyle)
Beispiel #13
0
    def make_default_style(self, default_style):
        """Make the default output style for the Statistics report."""
        # Paragraph Styles
        fstyle = FontStyle()
        fstyle.set_size(10)
        fstyle.set_type_face(FONT_SERIF)
        pstyle = ParagraphStyle()
        pstyle.set_font(fstyle)
        pstyle.set_alignment(PARA_ALIGN_LEFT)
        pstyle.set_description(_("The style used for the items and values."))
        default_style.add_paragraph_style("SC-Text", pstyle)

        fstyle = FontStyle()
        fstyle.set_size(14)
        fstyle.set_type_face(FONT_SANS_SERIF)
        pstyle = ParagraphStyle()
        pstyle.set_font(fstyle)
        pstyle.set_alignment(PARA_ALIGN_CENTER)
        pstyle.set_description(_("The style used for the title of the page."))
        default_style.add_paragraph_style("SC-Title", pstyle)
        """
        Graphic Styles:
            SC-title - Contains the SC-Title paragraph style used for
                       the title of the document
            SC-text  - Contains the SC-Name paragraph style used for
                       the individual's name
            SC-color-N - The colors for drawing pies.
            SC-bar - A red bar with 0.5pt black line.
        """
        gstyle = GraphicsStyle()
        gstyle.set_paragraph_style("SC-Title")
        gstyle.set_color((0, 0, 0))
        gstyle.set_fill_color((255, 255, 255))
        gstyle.set_line_width(0)
        default_style.add_draw_style("SC-title", gstyle)

        gstyle = GraphicsStyle()
        gstyle.set_paragraph_style("SC-Text")
        gstyle.set_color((0, 0, 0))
        gstyle.set_fill_color((255, 255, 255))
        gstyle.set_line_width(0)
        default_style.add_draw_style("SC-text", gstyle)

        width = 0.8
        # red
        gstyle = GraphicsStyle()
        gstyle.set_paragraph_style('SC-Text')
        gstyle.set_color((0, 0, 0))
        gstyle.set_fill_color((255, 0, 0))
        gstyle.set_line_width(width)
        default_style.add_draw_style("SC-color-0", gstyle)
        # orange
        gstyle = GraphicsStyle()
        gstyle.set_paragraph_style('SC-Text')
        gstyle.set_color((0, 0, 0))
        gstyle.set_fill_color((255, 158, 33))
        gstyle.set_line_width(width)
        default_style.add_draw_style("SC-color-1", gstyle)
        # green
        gstyle = GraphicsStyle()
        gstyle.set_paragraph_style('SC-Text')
        gstyle.set_color((0, 0, 0))
        gstyle.set_fill_color((0, 178, 0))
        gstyle.set_line_width(width)
        default_style.add_draw_style("SC-color-2", gstyle)
        # violet
        gstyle = GraphicsStyle()
        gstyle.set_paragraph_style('SC-Text')
        gstyle.set_color((0, 0, 0))
        gstyle.set_fill_color((123, 0, 123))
        gstyle.set_line_width(width)
        default_style.add_draw_style("SC-color-3", gstyle)
        # yellow
        gstyle = GraphicsStyle()
        gstyle.set_paragraph_style('SC-Text')
        gstyle.set_color((0, 0, 0))
        gstyle.set_fill_color((255, 255, 0))
        gstyle.set_line_width(width)
        default_style.add_draw_style("SC-color-4", gstyle)
        # blue
        gstyle = GraphicsStyle()
        gstyle.set_paragraph_style('SC-Text')
        gstyle.set_color((0, 0, 0))
        gstyle.set_fill_color((0, 105, 214))
        gstyle.set_line_width(width)
        default_style.add_draw_style("SC-color-5", gstyle)
        # gray
        gstyle = GraphicsStyle()
        gstyle.set_paragraph_style('SC-Text')
        gstyle.set_color((0, 0, 0))
        gstyle.set_fill_color((210, 204, 210))
        gstyle.set_line_width(width)
        default_style.add_draw_style("SC-color-6", gstyle)

        gstyle = GraphicsStyle()
        gstyle.set_color((0, 0, 0))
        gstyle.set_fill_color((255, 0, 0))
        gstyle.set_line_width(width)
        default_style.add_draw_style("SC-bar", gstyle)

        # legend
        gstyle = GraphicsStyle()
        gstyle.set_paragraph_style('SC-Text')
        gstyle.set_color((0, 0, 0))
        gstyle.set_fill_color((255, 255, 255))
        gstyle.set_line_width(0)
        default_style.add_draw_style("SC-legend", gstyle)