def make_default_style(self, default_style): """Make the default output style for the Ancestor Tree.""" ## Paragraph Styles: font = FontStyle() font.set_size(9) font.set_type_face(FONT_SANS_SERIF) para_style = ParagraphStyle() para_style.set_font(font) para_style.set_description(_('The basic style used for the ' 'text display.')) default_style.add_paragraph_style("AC2-Normal", para_style) box_shadow = PT2CM(font.get_size()) * .6 font = FontStyle() font.set_size(9) font.set_type_face(FONT_SANS_SERIF) para_style = ParagraphStyle() para_style.set_font(font) para_style.set_description(_('The basic style used for the ' 'note display.')) default_style.add_paragraph_style("AC2-Note", para_style) font = FontStyle() font.set_size(16) font.set_type_face(FONT_SANS_SERIF) para_style = ParagraphStyle() para_style.set_font(font) para_style.set_alignment(PARA_ALIGN_CENTER) para_style.set_description(_('The basic style used for the ' 'title display.')) default_style.add_paragraph_style("AC2-Title", para_style) ## Draw styles graph_style = GraphicsStyle() graph_style.set_paragraph_style("AC2-Normal") graph_style.set_shadow(1, box_shadow) #shadow set by text size graph_style.set_fill_color((255, 255, 255)) default_style.add_draw_style("AC2-box", graph_style) graph_style = GraphicsStyle() graph_style.set_paragraph_style("AC2-Normal") #graph_style.set_shadow(0, PT2CM(9)) #shadow set by text size graph_style.set_fill_color((255, 255, 255)) default_style.add_draw_style("AC2-fam-box", graph_style) graph_style = GraphicsStyle() graph_style.set_paragraph_style("AC2-Note") graph_style.set_fill_color((255, 255, 255)) default_style.add_draw_style("AC2-note-box", graph_style) graph_style = GraphicsStyle() graph_style.set_paragraph_style("AC2-Title") graph_style.set_color((0, 0, 0)) graph_style.set_fill_color((255, 255, 255)) graph_style.set_line_width(0) default_style.add_draw_style("AC2-Title", graph_style) graph_style = GraphicsStyle() default_style.add_draw_style("AC2-line", graph_style)
def scale_styles(self, scale): """ Scale the styles for this report. """ style_sheet = self.doc.get_style_sheet() graph_style = style_sheet.get_draw_style("AC2-box") graph_style.set_shadow(graph_style.get_shadow(), self.canvas.report_opts.box_shadow * scale) graph_style.set_line_width(graph_style.get_line_width() * scale) style_sheet.add_draw_style("AC2-box", graph_style) graph_style = style_sheet.get_draw_style("AC2-fam-box") graph_style.set_shadow(graph_style.get_shadow(), self.canvas.report_opts.box_shadow * scale) graph_style.set_line_width(graph_style.get_line_width() * scale) style_sheet.add_draw_style("AC2-fam-box", graph_style) graph_style = style_sheet.get_draw_style("AC2-note-box") #graph_style.set_shadow(graph_style.get_shadow(), # self.canvas.report_opts.box_shadow * scale) graph_style.set_line_width(graph_style.get_line_width() * scale) style_sheet.add_draw_style("AC2-note-box", graph_style) para_style = style_sheet.get_paragraph_style("AC2-Normal") font = para_style.get_font() font.set_size(font.get_size() * scale) para_style.set_font(font) style_sheet.add_paragraph_style("AC2-Normal", para_style) para_style = style_sheet.get_paragraph_style("AC2-Note") font = para_style.get_font() font.set_size(font.get_size() * scale) para_style.set_font(font) style_sheet.add_paragraph_style("AC2-Note", para_style) para_style = style_sheet.get_paragraph_style("AC2-Title") font = para_style.get_font() font.set_size(font.get_size() * scale) para_style.set_font(font) style_sheet.add_paragraph_style("AC2-Title", para_style) graph_style = GraphicsStyle() width = graph_style.get_line_width() width = width * scale graph_style.set_line_width(width) style_sheet.add_draw_style("AC2-line", graph_style) self.doc.set_style_sheet(style_sheet)
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)
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)
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.")) 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)
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)
def make_default_style(self, default_style): """Make the default output style for the Timeline report.""" # Paragraph Styles f = FontStyle() f.set_size(10) f.set_type_face(FONT_SANS_SERIF) p = ParagraphStyle() p.set_font(f) p.set_description(_("The style used for the person's name.")) default_style.add_paragraph_style("TLG-Name", p) f = FontStyle() f.set_size(8) f.set_type_face(FONT_SANS_SERIF) p = ParagraphStyle() p.set_font(f) p.set_alignment(PARA_ALIGN_CENTER) p.set_description(_("The style used for the year labels.")) default_style.add_paragraph_style("TLG-Label", p) f = FontStyle() f.set_size(14) f.set_type_face(FONT_SANS_SERIF) p = ParagraphStyle() 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("TLG-Title", p) """ 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. """ g = GraphicsStyle() g.set_line_width(0.5) g.set_color((0, 0, 0)) default_style.add_draw_style("TLG-line", g) g = GraphicsStyle() g.set_line_width(0.5) g.set_color((0, 0, 0)) g.set_fill_color((0, 0, 0)) default_style.add_draw_style("TLG-solid", g) g = GraphicsStyle() g.set_line_width(0.5) g.set_color((0, 0, 0)) g.set_fill_color((255, 255, 255)) default_style.add_draw_style("open", g) g = GraphicsStyle() g.set_line_width(0.5) g.set_line_style(DASHED) g.set_color((0, 0, 0)) default_style.add_draw_style("TLG-grid", g) g = GraphicsStyle() g.set_paragraph_style("TLG-Name") g.set_color((0, 0, 0)) g.set_fill_color((255, 255, 255)) g.set_line_width(0) default_style.add_draw_style("TLG-text", g) g = GraphicsStyle() g.set_paragraph_style("TLG-Title") g.set_color((0, 0, 0)) g.set_fill_color((255, 255, 255)) g.set_line_width(0) default_style.add_draw_style("TLG-title", g) g = GraphicsStyle() g.set_paragraph_style("TLG-Label") g.set_color((0, 0, 0)) g.set_fill_color((255, 255, 255)) g.set_line_width(0) default_style.add_draw_style("TLG-label", g)
def make_default_style(self,default_style): """Make the default output style for the Timeline report.""" # Paragraph Styles f = FontStyle() f.set_size(10) f.set_type_face(FONT_SANS_SERIF) p = ParagraphStyle() p.set_font(f) p.set_description(_("The style used for the person's name.")) default_style.add_paragraph_style("TLG-Name",p) f = FontStyle() f.set_size(8) f.set_type_face(FONT_SANS_SERIF) p = ParagraphStyle() p.set_font(f) p.set_alignment(PARA_ALIGN_CENTER) p.set_description(_("The style used for the year labels.")) default_style.add_paragraph_style("TLG-Label",p) f = FontStyle() f.set_size(14) f.set_type_face(FONT_SANS_SERIF) p = ParagraphStyle() 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("TLG-Title",p) """ 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. """ g = GraphicsStyle() g.set_line_width(0.5) g.set_color((0,0,0)) default_style.add_draw_style("TLG-line",g) g = GraphicsStyle() g.set_line_width(0.5) g.set_color((0,0,0)) g.set_fill_color((0,0,0)) default_style.add_draw_style("TLG-solid",g) g = GraphicsStyle() g.set_line_width(0.5) g.set_color((0,0,0)) g.set_fill_color((255,255,255)) default_style.add_draw_style("open",g) g = GraphicsStyle() g.set_line_width(0.5) g.set_line_style(DASHED) g.set_color((0,0,0)) default_style.add_draw_style("TLG-grid",g) g = GraphicsStyle() g.set_paragraph_style("TLG-Name") g.set_color((0,0,0)) g.set_fill_color((255,255,255)) g.set_line_width(0) default_style.add_draw_style("TLG-text",g) g = GraphicsStyle() g.set_paragraph_style("TLG-Title") g.set_color((0,0,0)) g.set_fill_color((255,255,255)) g.set_line_width(0) default_style.add_draw_style("TLG-title",g) g = GraphicsStyle() g.set_paragraph_style("TLG-Label") g.set_color((0,0,0)) g.set_fill_color((255,255,255)) g.set_line_width(0) default_style.add_draw_style("TLG-label",g)