2707: Add markup notes to html output. Finished
svn: r12654
This commit is contained in:
parent
a3f59f2717
commit
f78db6f418
@ -58,7 +58,9 @@ from QuestionDialog import WarningDialog
|
||||
import logging
|
||||
LOG = logging.getLogger(".htmldoc")
|
||||
|
||||
_TEXTDOCSCREEN = 'grampstextdoc.css'
|
||||
_HTMLSCREEN = 'grampshtml.css'
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# HtmlDoc
|
||||
@ -76,6 +78,10 @@ class HtmlDoc(BaseDoc, TextDoc):
|
||||
paragraphs
|
||||
id="grampsnote" : start of part with a note. This id is normally not
|
||||
used
|
||||
|
||||
The styles as defined in the stylesheed of the textdoc, will be converted
|
||||
to css class. Color is removed to avoid conflicts with the css. Also
|
||||
Fontface is removed. Size, italic, bold, margins, borders are retained
|
||||
"""
|
||||
|
||||
def __init__(self, styles, paper_style):
|
||||
@ -83,7 +89,7 @@ class HtmlDoc(BaseDoc, TextDoc):
|
||||
self.style_declaration = ''
|
||||
self.htmllist = []
|
||||
self._backend = None
|
||||
self.css_filename = None
|
||||
self.css_filename = ''
|
||||
self.warn_dir = True
|
||||
self._col = 0
|
||||
self._tbl = None
|
||||
@ -96,7 +102,10 @@ class HtmlDoc(BaseDoc, TextDoc):
|
||||
Set the css file to use. The path must be included.
|
||||
Note: DocReportDialog sets this for html doc
|
||||
"""
|
||||
self.css_filename = css_filename
|
||||
if os.path.basename(css_filename):
|
||||
self.css_filename = css_filename
|
||||
else:
|
||||
self.css_filename = ''
|
||||
|
||||
def open(self, filename):
|
||||
"""
|
||||
@ -122,17 +131,21 @@ class HtmlDoc(BaseDoc, TextDoc):
|
||||
|
||||
#set styles of the report as inline css
|
||||
self.build_style_declaration()
|
||||
self._backend.html_header += self.style_declaration
|
||||
|
||||
|
||||
# GRAMPS favicon en css
|
||||
fname1 = '/'.join([self._backend.datadir(), 'favicon.ico'])
|
||||
fname2 = '/'.join([self._backend.datadir(), _HTMLSCREEN])
|
||||
fname1 = '/'.join([self._backend.datadir(), 'favicon.ico'])
|
||||
fname2 = '/'.join([self._backend.datadir(), _TEXTDOCSCREEN])
|
||||
fname3 = '/'.join([self._backend.datadir(), _HTMLSCREEN])
|
||||
|
||||
# links for GRAMPS favicon and stylesheets
|
||||
links = Html('link', rel='shortcut icon', href=fname1,
|
||||
type='image/x-icon') + (
|
||||
Html('link', rel='stylesheet', href=fname2, type='text/css',
|
||||
media='screen', indent=False)
|
||||
media='screen', indent=False),)
|
||||
if self.css_filename:
|
||||
links += (Html('link', rel='stylesheet', href=fname3,
|
||||
type='text/css', media='screen', indent=False),
|
||||
)
|
||||
self._backend.html_header += (meta, links)
|
||||
|
||||
@ -239,7 +252,8 @@ class HtmlDoc(BaseDoc, TextDoc):
|
||||
'to_dir' is the relative path name in the destination root. It will
|
||||
be prepended before 'to_fname'.
|
||||
"""
|
||||
dest = os.path.join(self._backend.datadir(), to_dir, to_fname)
|
||||
#build absolute path
|
||||
dest = os.path.join(self._backend.datadirfull(), to_dir, to_fname)
|
||||
|
||||
destdir = os.path.dirname(dest)
|
||||
if not os.path.isdir(destdir):
|
||||
@ -262,8 +276,14 @@ class HtmlDoc(BaseDoc, TextDoc):
|
||||
"""
|
||||
Copy support files to the datadir that needs to hold them
|
||||
"""
|
||||
#css of textdoc styles
|
||||
tdfile = open(os.path.join(self._backend.datadirfull(),
|
||||
_TEXTDOCSCREEN), 'w')
|
||||
tdfile.write(self.style_declaration)
|
||||
tdfile.close()
|
||||
#css file
|
||||
self.copy_file(os.path.join(const.DATA_DIR, self.css_filename),
|
||||
if self.css_filename:
|
||||
self.copy_file(os.path.join(const.DATA_DIR, self.css_filename),
|
||||
_HTMLSCREEN)
|
||||
#favicon
|
||||
self.copy_file(os.path.join(const.IMAGE_DIR, 'favicon.ico'),
|
||||
@ -310,8 +330,7 @@ class HtmlDoc(BaseDoc, TextDoc):
|
||||
Add title field to header
|
||||
"""
|
||||
self._backend.html_header += Html('title', self.title,
|
||||
inline=True, indent=True)
|
||||
|
||||
inline=True)
|
||||
|
||||
def start_table(self, name, style):
|
||||
"""
|
||||
@ -326,7 +345,6 @@ class HtmlDoc(BaseDoc, TextDoc):
|
||||
"""
|
||||
Overwrite base method
|
||||
"""
|
||||
self.write_text('\n')
|
||||
self.__reduce_list()
|
||||
|
||||
def start_row(self):
|
||||
@ -340,7 +358,6 @@ class HtmlDoc(BaseDoc, TextDoc):
|
||||
"""
|
||||
Overwrite base method
|
||||
"""
|
||||
self.write_text('\n')
|
||||
self.__reduce_list()
|
||||
|
||||
def start_cell(self, style_name, span=1):
|
||||
@ -348,23 +365,21 @@ class HtmlDoc(BaseDoc, TextDoc):
|
||||
Overwrite base method
|
||||
"""
|
||||
self._empty = 1
|
||||
#self.f.write('<td valign="top"')
|
||||
if span > 1:
|
||||
self.htmllist += [Html('td', colspan=str(span),
|
||||
class_=style_name)]
|
||||
self.htmllist += (Html('td', colspan=str(span),
|
||||
class_=style_name),)
|
||||
self._col += span
|
||||
else:
|
||||
self.htmllist += [Html('td', colspan=str(span),
|
||||
self.htmllist += (Html('td', colspan=str(span),
|
||||
width=str(self._tbl.get_column_width(
|
||||
self._col))+ '%%',
|
||||
class_=style_name)]
|
||||
class_=style_name),)
|
||||
self._col += 1
|
||||
|
||||
def end_cell(self):
|
||||
"""
|
||||
Overwrite base method
|
||||
"""
|
||||
self.write_text('\n')
|
||||
self.__reduce_list()
|
||||
|
||||
def start_paragraph(self, style_name, leader=None):
|
||||
@ -376,22 +391,22 @@ class HtmlDoc(BaseDoc, TextDoc):
|
||||
level = style.get_header_level()
|
||||
if level == 0:
|
||||
#a normal paragraph
|
||||
self.htmllist += [Html('p', class_=style_name)]
|
||||
self.htmllist += (Html('p', class_=style_name),)
|
||||
elif level == 1:
|
||||
if self.__title_written == -1 and \
|
||||
style_name.upper().find('TITLE') != -1:
|
||||
self.__title_written == 0
|
||||
self.htmllist += [Html('div', id="header")]
|
||||
self.htmllist += [Html('h1', id='SiteTitle')]
|
||||
self.__title_written = 0
|
||||
self.htmllist += (Html('div', id="header"),)
|
||||
self.htmllist += (Html('h1', id='SiteTitle'),)
|
||||
else:
|
||||
self.htmllist += [Html('h1', class_=style_name)]
|
||||
self.htmllist += (Html('h1', class_=style_name),)
|
||||
elif 2<= level <= 5:
|
||||
tag = 'h'+str(level+1)
|
||||
self.htmllist += [Html(tag, class_=style_name)]
|
||||
self.htmllist += (Html(tag, class_=style_name),)
|
||||
else:
|
||||
# a low level header
|
||||
self.htmllist += [Html('div', id='grampsheading',
|
||||
class_=style_name)]
|
||||
self.htmllist += (Html('div', id='grampsheading',
|
||||
class_=style_name),)
|
||||
if leader is not None:
|
||||
self.write_text(leader+' ')
|
||||
|
||||
@ -399,7 +414,6 @@ class HtmlDoc(BaseDoc, TextDoc):
|
||||
"""
|
||||
Overwrite base method
|
||||
"""
|
||||
self.write_text('\n')
|
||||
if self._empty == 1:
|
||||
self.__empty_char()
|
||||
self._empty = 0
|
||||
@ -444,7 +458,8 @@ class HtmlDoc(BaseDoc, TextDoc):
|
||||
# User should use write_styled_note for correct behavior, in this
|
||||
# more basic method we convert all to a monospace character
|
||||
self.htmllist += [Html('pre', class_=style_name,
|
||||
style = 'font-family: courier, monospace')]
|
||||
style = 'font-family: courier, monospace',
|
||||
indent=None, inline=True)]
|
||||
self.write_text(text)
|
||||
#end pre element
|
||||
self.__reduce_list()
|
||||
@ -476,7 +491,7 @@ class HtmlDoc(BaseDoc, TextDoc):
|
||||
#preformatted, retain whitespace.
|
||||
#so use \n\n for paragraph detection
|
||||
#FIXME: following split should be regex to match \n\s*\n instead?
|
||||
self.htmllist += [Html('pre')]
|
||||
self.htmllist += [Html('pre', indent=None, inline=True)]
|
||||
for line in markuptext.split('\n\n'):
|
||||
self.start_paragraph(style_name)
|
||||
for realline in line.split('\n'):
|
||||
@ -503,7 +518,7 @@ class HtmlDoc(BaseDoc, TextDoc):
|
||||
size = int(max(w_cm, h_cm) * float(150.0/2.54))
|
||||
refname = "is%s" % os.path.basename(name)
|
||||
|
||||
imdir = self._backend.datadir()
|
||||
imdir = self._backend.datadirfull()
|
||||
|
||||
try:
|
||||
ImgManip.resize_to_jpeg(name, imdir + os.sep + refname, size, size)
|
||||
|
@ -183,12 +183,13 @@ class Html(list):
|
||||
)
|
||||
#
|
||||
@staticmethod
|
||||
def head(title='Title', encoding='utf-8', *args, **keywargs):
|
||||
def head(title=_('Title'), encoding='utf-8', *args, **keywargs):
|
||||
"""
|
||||
Build and return a properly-formated <head> object
|
||||
|
||||
@type title: string
|
||||
@param title: title for HTML page. Default='Title'
|
||||
@type title: string or None
|
||||
@param title: title for HTML page. Default='Title'. If None no
|
||||
title tag is written
|
||||
@type encoding: string
|
||||
@param encoding: encoding to be used. Default = 'utf-8'
|
||||
@rtype reference to new Html instance
|
||||
@ -196,15 +197,17 @@ class Html(list):
|
||||
"""
|
||||
meta1 = 'http-equiv="content-type" content="text/html;charset=%s"'
|
||||
meta2 = 'http-equiv="Content-Style-Type" content="text/css"'
|
||||
head = Html('head', *args, **keywargs) + (
|
||||
Html('title', title, inline=True, indent=True),
|
||||
head = Html('head', *args, **keywargs)
|
||||
if title != None:
|
||||
head += (Html('title', title, inline=True, indent=True))
|
||||
head += (
|
||||
Html('meta', attr=meta1 % encoding, indent=True),
|
||||
Html('meta', attr=meta2, indent=True)
|
||||
)
|
||||
return head
|
||||
#
|
||||
@staticmethod
|
||||
def page(title='Title', encoding='utf-8', lang='en', *args, **keywargs):
|
||||
def page(title=_('Title'), encoding='utf-8', lang='en', *args, **keywargs):
|
||||
"""
|
||||
This function prepares a new Html class based page and returns
|
||||
|
||||
@ -242,9 +245,10 @@ class Html(list):
|
||||
@type args: optional positional parameters
|
||||
@param args: 0 more positional arguments to be inserted between
|
||||
opening and closing HTML tags.
|
||||
@type indent: boolean
|
||||
@type indent: boolean or None
|
||||
@param indent: True ==> indent this object with respect to its parent
|
||||
False ==> do not indent this object
|
||||
None ==> no indent for this object (use eg for pre tag)
|
||||
Defaults to False
|
||||
@type inline: boolean
|
||||
@param inline: True ==> instructs the write() method to output this
|
||||
@ -399,7 +403,7 @@ class Html(list):
|
||||
@type indent: string
|
||||
@param indenf: string to use for indentation. Default = '\t' (tab)
|
||||
@type tabs: string
|
||||
@oaram tabs: starting indentation
|
||||
@param tabs: starting indentation
|
||||
"""
|
||||
if self.indent is None:
|
||||
tabs = ''
|
||||
|
@ -67,7 +67,7 @@ class HtmlBackend(DocBackend):
|
||||
"""
|
||||
|
||||
STYLETAG_TO_PROPERTY = {
|
||||
DocBackend.FONTCOLOR : 'font-color:%s;',
|
||||
DocBackend.FONTCOLOR : 'color:%s;',
|
||||
DocBackend.HIGHLIGHT : 'background-color:%s;',
|
||||
DocBackend.FONTFACE : "font-family:'%s';",
|
||||
DocBackend.FONTSIZE : 'font-size:%spx;',
|
||||
@ -103,7 +103,7 @@ class HtmlBackend(DocBackend):
|
||||
self.html_header = None
|
||||
self.html_body = None
|
||||
self._subdir = None
|
||||
self.title = 'GRAMPS Html Document'
|
||||
self.title = None
|
||||
|
||||
def _create_xmltag(self, tagtype, value):
|
||||
"""
|
||||
@ -115,6 +115,9 @@ class HtmlBackend(DocBackend):
|
||||
if tagtype == DocBackend.FONTSIZE:
|
||||
#size is in points
|
||||
value = str(value)
|
||||
elif tagtype == DocBackend.FONTFACE:
|
||||
#fonts can have strange symbols in them, ' needs to be escaped
|
||||
value = value.replace("'", "\\'")
|
||||
|
||||
return ('<span style="%s">' % (self.STYLETAG_TO_PROPERTY[tagtype] %
|
||||
(value)),
|
||||
@ -128,7 +131,7 @@ class HtmlBackend(DocBackend):
|
||||
if not len(fparts) >= 2 and not (fparts[-1] == 'html' or
|
||||
fparts[-1] == 'htm' or fparts[-1] == 'php'):
|
||||
self._filename = self._filename + ".htm"
|
||||
fparts = self._filename.split('.')
|
||||
fparts = os.path.basename(self._filename).split('.')
|
||||
self._subdir = '.'.join(fparts[:-1])
|
||||
|
||||
def set_title(self, title):
|
||||
@ -143,15 +146,15 @@ class HtmlBackend(DocBackend):
|
||||
close
|
||||
"""
|
||||
DocBackend.open(self)
|
||||
if not os.path.isdir(self._subdir):
|
||||
os.mkdir(self._subdir)
|
||||
if not os.path.isdir(self.datadirfull()):
|
||||
os.mkdir(self.datadirfull())
|
||||
self.html_page, self.html_header, self.html_body = Html.page(
|
||||
lang=xml_lang(), title=self.title)
|
||||
|
||||
def __write(self, string):
|
||||
""" a write to the file
|
||||
"""
|
||||
DocBackend.write(self, string)
|
||||
DocBackend.write(self, string + '\n')
|
||||
|
||||
def write(self, obj):
|
||||
""" write to the html page. One can pass a html object, or a string
|
||||
@ -162,7 +165,7 @@ class HtmlBackend(DocBackend):
|
||||
"""
|
||||
write out the html to the page
|
||||
"""
|
||||
self.html_page.write(self.__write, indent='')
|
||||
self.html_page.write(self.__write, indent=' ')
|
||||
DocBackend.close(self)
|
||||
|
||||
def datadir(self):
|
||||
@ -170,6 +173,12 @@ class HtmlBackend(DocBackend):
|
||||
the directory where to save extra files
|
||||
"""
|
||||
return self._subdir
|
||||
|
||||
def datadirfull(self):
|
||||
"""
|
||||
full path of the datadir directory
|
||||
"""
|
||||
return os.path.join(os.path.dirname(self.getf()), self.datadir())
|
||||
|
||||
# ------------------------------------------
|
||||
#
|
||||
|
@ -129,29 +129,29 @@ class CustomTextOptions(MenuReportOptions):
|
||||
|
||||
def make_default_style(self,default_style):
|
||||
"""Make the default output style for the Custom Text report."""
|
||||
font = BaseDoc.FontStyle()
|
||||
font.set(face=BaseDoc.FONT_SANS_SERIF,size=12,bold=0,italic=0)
|
||||
para = BaseDoc.ParagraphStyle()
|
||||
font = FontStyle()
|
||||
font.set(face=FONT_SANS_SERIF,size=12,bold=0,italic=0)
|
||||
para = ParagraphStyle()
|
||||
para.set_font(font)
|
||||
para.set_alignment(BaseDoc.PARA_ALIGN_CENTER)
|
||||
para.set_alignment(PARA_ALIGN_CENTER)
|
||||
para.set(pad=0.5)
|
||||
para.set_description(_('The style used for the first portion of the custom text.'))
|
||||
default_style.add_paragraph_style("CBT-Initial",para)
|
||||
|
||||
font = BaseDoc.FontStyle()
|
||||
font.set(face=BaseDoc.FONT_SANS_SERIF,size=12,bold=0,italic=0)
|
||||
para = BaseDoc.ParagraphStyle()
|
||||
font = FontStyle()
|
||||
font.set(face=FONT_SANS_SERIF,size=12,bold=0,italic=0)
|
||||
para = ParagraphStyle()
|
||||
para.set_font(font)
|
||||
para.set(pad=0.5)
|
||||
para.set_alignment(BaseDoc.PARA_ALIGN_CENTER)
|
||||
para.set_alignment(PARA_ALIGN_CENTER)
|
||||
para.set_description(_('The style used for the middle portion of the custom text.'))
|
||||
default_style.add_paragraph_style("CBT-Middle",para)
|
||||
|
||||
font = BaseDoc.FontStyle()
|
||||
font.set(face=BaseDoc.FONT_SANS_SERIF,size=12,bold=0,italic=0)
|
||||
para = BaseDoc.ParagraphStyle()
|
||||
font = FontStyle()
|
||||
font.set(face=FONT_SANS_SERIF,size=12,bold=0,italic=0)
|
||||
para = ParagraphStyle()
|
||||
para.set_font(font)
|
||||
para.set_alignment(BaseDoc.PARA_ALIGN_CENTER)
|
||||
para.set_alignment(PARA_ALIGN_CENTER)
|
||||
para.set(pad=0.5)
|
||||
para.set_description(_('The style used for the last portion of the custom text.'))
|
||||
default_style.add_paragraph_style("CBT-Final",para)
|
||||
|
@ -127,7 +127,7 @@ class DescendantReport(Report):
|
||||
self.doc.start_paragraph("DR-Title")
|
||||
name = name_displayer.display(self.center_person)
|
||||
title = _("Descendants of %s") % name
|
||||
mark = BaseDoc.IndexMark(title,BaseDoc.INDEX_TYPE_TOC,1)
|
||||
mark = IndexMark(title,INDEX_TYPE_TOC,1)
|
||||
self.doc.write_text(title,mark)
|
||||
self.doc.end_paragraph()
|
||||
self.dump(1,self.center_person)
|
||||
@ -188,24 +188,24 @@ class DescendantOptions(MenuReportOptions):
|
||||
|
||||
def make_default_style(self,default_style):
|
||||
"""Make the default output style for the Descendant Report."""
|
||||
f = BaseDoc.FontStyle()
|
||||
f = FontStyle()
|
||||
f.set_size(12)
|
||||
f.set_type_face(BaseDoc.FONT_SANS_SERIF)
|
||||
f.set_type_face(FONT_SANS_SERIF)
|
||||
f.set_bold(1)
|
||||
p = BaseDoc.ParagraphStyle()
|
||||
p = ParagraphStyle()
|
||||
p.set_header_level(1)
|
||||
p.set_bottom_border(1)
|
||||
p.set_top_margin(ReportUtils.pt2cm(3))
|
||||
p.set_bottom_margin(ReportUtils.pt2cm(3))
|
||||
p.set_font(f)
|
||||
p.set_alignment(BaseDoc.PARA_ALIGN_CENTER)
|
||||
p.set_alignment(PARA_ALIGN_CENTER)
|
||||
p.set_description(_("The style used for the title of the page."))
|
||||
default_style.add_paragraph_style("DR-Title",p)
|
||||
|
||||
f = BaseDoc.FontStyle()
|
||||
f = FontStyle()
|
||||
f.set_size(10)
|
||||
for i in range(1,33):
|
||||
p = BaseDoc.ParagraphStyle()
|
||||
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))
|
||||
@ -215,7 +215,7 @@ class DescendantOptions(MenuReportOptions):
|
||||
"level %d display.") % i)
|
||||
default_style.add_paragraph_style("DR-Level%d" % min(i,32), p)
|
||||
|
||||
p = BaseDoc.ParagraphStyle()
|
||||
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))
|
||||
|
@ -134,7 +134,7 @@ class EndOfLineReport(Report):
|
||||
|
||||
self.doc.start_paragraph("EOL-Title")
|
||||
title = _("End of Line Report for %s") % pname
|
||||
mark = BaseDoc.IndexMark(title, BaseDoc.INDEX_TYPE_TOC, 1)
|
||||
mark = IndexMark(title, INDEX_TYPE_TOC, 1)
|
||||
self.doc.write_text(title, mark)
|
||||
self.doc.end_paragraph()
|
||||
|
||||
@ -243,49 +243,49 @@ class EndOfLineOptions(MenuReportOptions):
|
||||
def make_default_style(self, default_style):
|
||||
"""Make the default output style for the End of Line Report."""
|
||||
# Paragraph Styles
|
||||
f = BaseDoc.FontStyle()
|
||||
f = FontStyle()
|
||||
f.set_size(16)
|
||||
f.set_type_face(BaseDoc.FONT_SANS_SERIF)
|
||||
f.set_type_face(FONT_SANS_SERIF)
|
||||
f.set_bold(1)
|
||||
p = BaseDoc.ParagraphStyle()
|
||||
p = ParagraphStyle()
|
||||
p.set_header_level(1)
|
||||
p.set_bottom_border(1)
|
||||
p.set_bottom_margin(ReportUtils.pt2cm(8))
|
||||
p.set_font(f)
|
||||
p.set_alignment(BaseDoc.PARA_ALIGN_CENTER)
|
||||
p.set_alignment(PARA_ALIGN_CENTER)
|
||||
p.set_description(_("The style used for the title of the page."))
|
||||
default_style.add_paragraph_style("EOL-Title", p)
|
||||
|
||||
font = BaseDoc.FontStyle()
|
||||
font.set(face=BaseDoc.FONT_SANS_SERIF, size=12, italic=1)
|
||||
p = BaseDoc.ParagraphStyle()
|
||||
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(BaseDoc.PARA_ALIGN_CENTER)
|
||||
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 = BaseDoc.FontStyle()
|
||||
font = FontStyle()
|
||||
font.set_size(10)
|
||||
p = BaseDoc.ParagraphStyle()
|
||||
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 = BaseDoc.FontStyle()
|
||||
font = FontStyle()
|
||||
font.set_size(12)
|
||||
font.set_italic(True)
|
||||
p = BaseDoc.ParagraphStyle()
|
||||
p = ParagraphStyle()
|
||||
p.set_font(font)
|
||||
p.set_top_margin(ReportUtils.pt2cm(6))
|
||||
p.set_description(_('The basic style used for generation headings.'))
|
||||
default_style.add_paragraph_style("EOL-Generation", p)
|
||||
|
||||
font = BaseDoc.FontStyle()
|
||||
font = FontStyle()
|
||||
font.set_size(8)
|
||||
p = BaseDoc.ParagraphStyle()
|
||||
p = ParagraphStyle()
|
||||
p.set_font(font)
|
||||
p.set_top_margin(0)
|
||||
p.set_bottom_margin(ReportUtils.pt2cm(6))
|
||||
@ -293,14 +293,14 @@ class EndOfLineOptions(MenuReportOptions):
|
||||
default_style.add_paragraph_style("EOL-Pedigree", p)
|
||||
|
||||
#Table Styles
|
||||
cell = BaseDoc.TableCellStyle()
|
||||
cell = TableCellStyle()
|
||||
default_style.add_cell_style('EOL-TableCell', cell)
|
||||
|
||||
cell = BaseDoc.TableCellStyle()
|
||||
cell = TableCellStyle()
|
||||
cell.set_bottom_border(1)
|
||||
default_style.add_cell_style('EOL_GenerationCell', cell)
|
||||
|
||||
table = BaseDoc.TableStyle()
|
||||
table = TableStyle()
|
||||
table.set_width(100)
|
||||
table.set_columns(2)
|
||||
table.set_column_width(0, 10)
|
||||
|
@ -530,7 +530,7 @@ class FamilyGroup(Report):
|
||||
title=_("Family Group Report - Generation %d") % generation
|
||||
else:
|
||||
title=_("Family Group Report")
|
||||
mark = BaseDoc.IndexMark(title,BaseDoc.INDEX_TYPE_TOC,1)
|
||||
mark = IndexMark(title, INDEX_TYPE_TOC,1)
|
||||
self.doc.write_text( title, mark )
|
||||
self.doc.end_paragraph()
|
||||
|
||||
@ -668,35 +668,36 @@ class FamilyGroupOptions(MenuReportOptions):
|
||||
|
||||
def make_default_style(self,default_style):
|
||||
"""Make default output style for the Family Group Report."""
|
||||
para = BaseDoc.ParagraphStyle()
|
||||
para = ParagraphStyle()
|
||||
#Paragraph Styles
|
||||
font = BaseDoc.FontStyle()
|
||||
font = FontStyle()
|
||||
font.set_size(4)
|
||||
para.set_font(font)
|
||||
default_style.add_paragraph_style('FGR-blank',para)
|
||||
|
||||
font = BaseDoc.FontStyle()
|
||||
font.set_type_face(BaseDoc.FONT_SANS_SERIF)
|
||||
font = FontStyle()
|
||||
font.set_type_face(FONT_SANS_SERIF)
|
||||
font.set_size(16)
|
||||
font.set_bold(1)
|
||||
para = BaseDoc.ParagraphStyle()
|
||||
para = ParagraphStyle()
|
||||
para.set_font(font)
|
||||
para.set_alignment(BaseDoc.PARA_ALIGN_CENTER)
|
||||
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 = BaseDoc.FontStyle()
|
||||
font.set_type_face(BaseDoc.FONT_SERIF)
|
||||
font = FontStyle()
|
||||
font.set_type_face(FONT_SERIF)
|
||||
font.set_size(10)
|
||||
font.set_bold(0)
|
||||
para = BaseDoc.ParagraphStyle()
|
||||
para = ParagraphStyle()
|
||||
para.set_font(font)
|
||||
para.set_description(_('The basic style used for the text display.'))
|
||||
default_style.add_paragraph_style('FGR-Normal',para)
|
||||
|
||||
para = BaseDoc.ParagraphStyle()
|
||||
font = BaseDoc.FontStyle()
|
||||
font.set_type_face(BaseDoc.FONT_SERIF)
|
||||
para = ParagraphStyle()
|
||||
font = FontStyle()
|
||||
font.set_type_face(FONT_SERIF)
|
||||
font.set_size(10)
|
||||
font.set_bold(0)
|
||||
para.set_font(font)
|
||||
@ -706,26 +707,27 @@ class FamilyGroupOptions(MenuReportOptions):
|
||||
para.set_description(_('The basic style used for the note display.'))
|
||||
default_style.add_paragraph_style("FGR-Note",para)
|
||||
|
||||
font = BaseDoc.FontStyle()
|
||||
font.set_type_face(BaseDoc.FONT_SANS_SERIF)
|
||||
font = FontStyle()
|
||||
font.set_type_face(FONT_SANS_SERIF)
|
||||
font.set_size(10)
|
||||
font.set_bold(1)
|
||||
para = BaseDoc.ParagraphStyle()
|
||||
para = ParagraphStyle()
|
||||
para.set_font(font)
|
||||
para.set_description(_('The style used for the text related to the children.'))
|
||||
default_style.add_paragraph_style('FGR-ChildText',para)
|
||||
|
||||
font = BaseDoc.FontStyle()
|
||||
font.set_type_face(BaseDoc.FONT_SANS_SERIF)
|
||||
font = FontStyle()
|
||||
font.set_type_face(FONT_SANS_SERIF)
|
||||
font.set_size(12)
|
||||
font.set_bold(1)
|
||||
para = BaseDoc.ParagraphStyle()
|
||||
para = ParagraphStyle()
|
||||
para.set_font(font)
|
||||
para.set_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 = BaseDoc.TableCellStyle()
|
||||
cell = TableCellStyle()
|
||||
cell.set_padding(0.2)
|
||||
cell.set_top_border(1)
|
||||
cell.set_bottom_border(1)
|
||||
@ -733,41 +735,41 @@ class FamilyGroupOptions(MenuReportOptions):
|
||||
cell.set_left_border(1)
|
||||
default_style.add_cell_style('FGR-ParentHead',cell)
|
||||
|
||||
cell = BaseDoc.TableCellStyle()
|
||||
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 = BaseDoc.TableCellStyle()
|
||||
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 = BaseDoc.TableCellStyle()
|
||||
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 = BaseDoc.TableCellStyle()
|
||||
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 = BaseDoc.TableCellStyle()
|
||||
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 = BaseDoc.TableStyle()
|
||||
table = TableStyle()
|
||||
table.set_width(100)
|
||||
table.set_columns(3)
|
||||
table.set_column_width(0,20)
|
||||
@ -775,7 +777,7 @@ class FamilyGroupOptions(MenuReportOptions):
|
||||
table.set_column_width(2,40)
|
||||
default_style.add_table_style('FGR-ParentTable',table)
|
||||
|
||||
table = BaseDoc.TableStyle()
|
||||
table = TableStyle()
|
||||
table.set_width(100)
|
||||
table.set_columns(4)
|
||||
table.set_column_width(0,7)
|
||||
|
Loading…
Reference in New Issue
Block a user