more report pylint improvements
This commit is contained in:
parent
21d02ad22c
commit
042bb5e2c0
@ -40,10 +40,10 @@ import sys
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
try:
|
||||
from xml.sax import make_parser, handler,SAXParseException
|
||||
from xml.sax import make_parser, handler, SAXParseException
|
||||
from xml.sax.saxutils import quoteattr
|
||||
except:
|
||||
from _xmlplus.sax import make_parser, handler,SAXParseException
|
||||
from _xmlplus.sax import make_parser, handler, SAXParseException
|
||||
from _xmlplus.sax.saxutils import quoteattr
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
@ -88,7 +88,7 @@ class OptionList:
|
||||
"""
|
||||
return self.options
|
||||
|
||||
def set_option(self, name,value):
|
||||
def set_option(self, name, value):
|
||||
"""
|
||||
Set a particular option in the OptionList.
|
||||
|
||||
@ -118,7 +118,7 @@ class OptionList:
|
||||
:returns: value associated with the passed option
|
||||
:rtype: str
|
||||
"""
|
||||
return self.options.get(name,None)
|
||||
return self.options.get(name, None)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -130,7 +130,7 @@ class OptionListCollection:
|
||||
Implements a collection of option lists.
|
||||
"""
|
||||
|
||||
def __init__(self,filename):
|
||||
def __init__(self, filename):
|
||||
"""
|
||||
Create an OptionListCollection instance from the list defined
|
||||
in the specified file.
|
||||
@ -167,7 +167,7 @@ class OptionListCollection:
|
||||
or None of no such option exists
|
||||
:rtype: str
|
||||
"""
|
||||
return self.option_list_map.get(name,None)
|
||||
return self.option_list_map.get(name, None)
|
||||
|
||||
def get_module_names(self):
|
||||
"""
|
||||
@ -189,13 +189,13 @@ class OptionListCollection:
|
||||
"""
|
||||
self.option_list_map[name] = option_list
|
||||
|
||||
def write_common(self,f):
|
||||
def write_common(self, filename):
|
||||
"""
|
||||
Stub function for common options. Overridden by reports.
|
||||
"""
|
||||
pass
|
||||
|
||||
def write_module_common(self,f, option_list):
|
||||
def write_module_common(self, filename, option_list):
|
||||
"""
|
||||
Stub function for common options. Overridden by reports.
|
||||
"""
|
||||
@ -205,54 +205,55 @@ class OptionListCollection:
|
||||
"""
|
||||
Saves the current OptionListCollection to the associated file.
|
||||
"""
|
||||
f = io.open(self.filename,"w", encoding="utf-8")
|
||||
f.write("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n")
|
||||
f.write('<options>\n')
|
||||
file = io.open(self.filename, "w", encoding="utf-8")
|
||||
file.write("<?xml version=\"1.0\" encoding=\"utf-8\"?>\n")
|
||||
file.write('<options>\n')
|
||||
|
||||
self.write_common(f)
|
||||
self.write_common(file)
|
||||
|
||||
for module_name in sorted(self.get_module_names()): # enable a diff
|
||||
option_list = self.get_option_list(module_name)
|
||||
module_docgen_opts = {}
|
||||
for docgen_name in self.docgen_names:
|
||||
module_docgen_opts[docgen_name] = []
|
||||
f.write('<module name=%s>\n' % quoteattr(module_name))
|
||||
file.write('<module name=%s>\n' % quoteattr(module_name))
|
||||
options = option_list.get_options()
|
||||
for option_name in sorted(options.keys()): # enable a diff
|
||||
option_data = options[option_name]
|
||||
if isinstance(option_data, (list, tuple)):
|
||||
if option_data and option_data[0] in self.docgen_names:
|
||||
module_docgen_opts[option_data[0]].append(
|
||||
(option_name, option_data[1]))
|
||||
(option_name, option_data[1]))
|
||||
else:
|
||||
f.write(' <option name=%s '
|
||||
'value="" length="%d">\n' % (
|
||||
quoteattr(option_name),
|
||||
len(option_data) ) )
|
||||
file.write(' <option name=%s '
|
||||
'value="" length="%d">\n'
|
||||
% (quoteattr(option_name),
|
||||
len(option_data)))
|
||||
for list_index, list_data in enumerate(option_data):
|
||||
f.write(' <listitem '
|
||||
'number="%d" value=%s/>\n' % (
|
||||
list_index,
|
||||
quoteattr(str(list_data))) )
|
||||
f.write(' </option>\n')
|
||||
file.write(' <listitem '
|
||||
'number="%d" value=%s/>\n'
|
||||
% (list_index,
|
||||
quoteattr(str(list_data))))
|
||||
file.write(' </option>\n')
|
||||
else:
|
||||
f.write(' <option name=%s value=%s/>\n' % (
|
||||
quoteattr(option_name),
|
||||
quoteattr(str(option_data))) )
|
||||
file.write(' <option name=%s value=%s/>\n'
|
||||
% (quoteattr(option_name),
|
||||
quoteattr(str(option_data))))
|
||||
for docgen_name in self.docgen_names:
|
||||
if module_docgen_opts[docgen_name]:
|
||||
for ix, data in enumerate(module_docgen_opts[docgen_name]):
|
||||
f.write(' <docgen-option docgen=%s '
|
||||
'name=%s value=%s/>\n' %
|
||||
(quoteattr(docgen_name),
|
||||
quoteattr(data[0]),
|
||||
quoteattr(str(data[1])) ))
|
||||
self.write_module_common(f, option_list)
|
||||
for idx, data in enumerate(
|
||||
module_docgen_opts[docgen_name]):
|
||||
file.write(' <docgen-option docgen=%s '
|
||||
'name=%s value=%s/>\n'
|
||||
% (quoteattr(docgen_name),
|
||||
quoteattr(data[0]),
|
||||
quoteattr(str(data[1]))))
|
||||
self.write_module_common(file, option_list)
|
||||
|
||||
f.write('</module>\n')
|
||||
file.write('</module>\n')
|
||||
|
||||
f.write('</options>\n')
|
||||
f.close()
|
||||
file.write('</options>\n')
|
||||
file.close()
|
||||
|
||||
def parse(self):
|
||||
"""
|
||||
@ -260,10 +261,10 @@ class OptionListCollection:
|
||||
"""
|
||||
try:
|
||||
if os.path.isfile(self.filename):
|
||||
p = make_parser()
|
||||
p.setContentHandler(OptionParser(self))
|
||||
p.parse(self.filename)
|
||||
except (IOError,OSError,SAXParseException):
|
||||
parser = make_parser()
|
||||
parser.setContentHandler(OptionParser(self))
|
||||
parser.parse(self.filename)
|
||||
except (IOError, OSError, SAXParseException):
|
||||
pass
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
@ -276,7 +277,7 @@ class OptionParser(handler.ContentHandler):
|
||||
SAX parsing class for the OptionListCollection XML file.
|
||||
"""
|
||||
|
||||
def __init__(self,collection):
|
||||
def __init__(self, collection):
|
||||
"""
|
||||
Create a OptionParser class that populates the passed collection.
|
||||
|
||||
@ -288,18 +289,18 @@ class OptionParser(handler.ContentHandler):
|
||||
self.mname = None
|
||||
self.option_list = None
|
||||
self.oname = None
|
||||
self.o = None
|
||||
self.odict = None
|
||||
self.an_o = None
|
||||
self.list_class = OptionList
|
||||
|
||||
def startElement(self,tag,attrs):
|
||||
def startElement(self, tag, attrs):
|
||||
"""
|
||||
Overridden class that handles the start of a XML element
|
||||
"""
|
||||
if tag in ("report","module"):
|
||||
if tag in ("report", "module"):
|
||||
self.mname = attrs['name']
|
||||
self.option_list = self.list_class()
|
||||
self.o = {}
|
||||
self.odict = {}
|
||||
elif tag == "option":
|
||||
self.oname = attrs['name']
|
||||
if 'length' in attrs:
|
||||
@ -309,13 +310,13 @@ class OptionParser(handler.ContentHandler):
|
||||
elif tag == "listitem":
|
||||
self.an_o.append(attrs['value'])
|
||||
|
||||
def endElement(self,tag):
|
||||
def endElement(self, tag):
|
||||
"Overridden class that handles the end of a XML element"
|
||||
if tag == "option":
|
||||
self.o[self.oname] = self.an_o
|
||||
elif tag in ("report","module"):
|
||||
self.option_list.set_options(self.o)
|
||||
self.collection.set_option_list(self.mname,self.option_list)
|
||||
self.odict[self.oname] = self.an_o
|
||||
elif tag in ("report", "module"):
|
||||
self.option_list.set_options(self.odict)
|
||||
self.collection.set_option_list(self.mname, self.option_list)
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -327,7 +328,7 @@ class OptionHandler:
|
||||
Implements handling of the options for the plugins.
|
||||
"""
|
||||
|
||||
def __init__(self,module_name, options_dict,person_id=None):
|
||||
def __init__(self, module_name, options_dict, person_id=None):
|
||||
self.module_name = module_name
|
||||
self.default_options_dict = options_dict.copy()
|
||||
self.options_dict = options_dict
|
||||
@ -336,7 +337,8 @@ class OptionHandler:
|
||||
self.init_subclass()
|
||||
self.option_list_collection = self.collection_class(self.filename)
|
||||
self.init_common()
|
||||
self.saved_option_list = self.option_list_collection.get_option_list(module_name)
|
||||
self.saved_option_list = self.option_list_collection.get_option_list(
|
||||
module_name)
|
||||
self.person_id = person_id
|
||||
|
||||
# Whatever was found should override the defaults
|
||||
@ -383,14 +385,14 @@ class OptionHandler:
|
||||
docgen_names = self.option_list_collection.docgen_names
|
||||
for option_name in bad_opts:
|
||||
option_data = options[option_name]
|
||||
if not ( isinstance(option_data, list) and
|
||||
option_data and
|
||||
option_data[0] in docgen_names ):
|
||||
if not (isinstance(option_data, list)
|
||||
and option_data
|
||||
and option_data[0] in docgen_names):
|
||||
print(_("Option '%(opt_name)s' is present in %(file)s\n"
|
||||
" but is not known to the module. Ignoring...") %
|
||||
{ 'opt_name' : option_name,
|
||||
'file' : self.option_list_collection.filename },
|
||||
file=sys.stderr )
|
||||
" but is not known to the module. Ignoring..."
|
||||
% {'opt_name' : option_name,
|
||||
'file' : self.option_list_collection.filename}),
|
||||
file=sys.stderr)
|
||||
options.pop(option_name)
|
||||
|
||||
# Then we set common options from whatever was found
|
||||
@ -412,7 +414,8 @@ class OptionHandler:
|
||||
if option_data == self.default_options_dict[option_name]:
|
||||
self.saved_option_list.remove_option(option_name)
|
||||
else:
|
||||
self.saved_option_list.set_option(option_name,self.options_dict[option_name])
|
||||
self.saved_option_list.set_option(
|
||||
option_name, self.options_dict[option_name])
|
||||
|
||||
# Handle common options
|
||||
self.save_common_options()
|
||||
@ -426,7 +429,7 @@ class OptionHandler:
|
||||
def get_person_id(self):
|
||||
return self.person_id
|
||||
|
||||
def set_person_id(self,val):
|
||||
def set_person_id(self, val):
|
||||
self.person_id = val
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
@ -443,7 +446,7 @@ class Options:
|
||||
classes should derive from it.
|
||||
"""
|
||||
|
||||
def __init__(self, name,person_id=None):
|
||||
def __init__(self, name, person_id=None):
|
||||
"""
|
||||
Initialize the class, performing usual house-keeping tasks.
|
||||
Subclasses MUST call this in their __init__() method.
|
||||
@ -478,7 +481,8 @@ class Options:
|
||||
Modifies all options to have the value they were last used as.
|
||||
Call this function after all options have been added.
|
||||
"""
|
||||
self.handler = OptionHandler(self.name,self.options_dict,self.person_id)
|
||||
self.handler = OptionHandler(
|
||||
self.name, self.options_dict, self.person_id)
|
||||
|
||||
def add_user_options(self):
|
||||
"""
|
||||
@ -529,7 +533,7 @@ class MenuOptions:
|
||||
for name in self.menu.get_all_option_names():
|
||||
option = self.menu.get_option_by_name(name)
|
||||
self.options_dict[name] = option.get_value()
|
||||
self.options_help[name] = [ "", option.get_help() ]
|
||||
self.options_help[name] = ["", option.get_help()]
|
||||
|
||||
def make_default_style(self, default_style):
|
||||
"""
|
||||
@ -553,7 +557,7 @@ class MenuOptions:
|
||||
"""
|
||||
self.menu.add_option(category, name, option)
|
||||
self.options_dict[name] = option.get_value()
|
||||
self.options_help[name] = [ "", option.get_help() ]
|
||||
self.options_help[name] = ["", option.get_help()]
|
||||
|
||||
def add_user_options(self):
|
||||
"""
|
||||
|
@ -36,8 +36,8 @@ import os
|
||||
import copy
|
||||
from xml.sax.saxutils import escape
|
||||
|
||||
def escxml(d):
|
||||
return escape(d, { '"' : '"' } )
|
||||
def escxml(word):
|
||||
return escape(word, {'"' : '"'})
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
@ -445,56 +445,62 @@ class OptionListCollection(_options.OptionListCollection):
|
||||
"""
|
||||
return self.last_format_name
|
||||
|
||||
def write_common(self, f):
|
||||
f.write('<last-common>\n')
|
||||
def write_common(self, file):
|
||||
file.write('<last-common>\n')
|
||||
if self.get_last_paper_metric() != self.default_paper_metric:
|
||||
f.write(' <metric value="%d"/>\n' % self.get_last_paper_metric() )
|
||||
file.write(' <metric value="%d"/>\n'
|
||||
% self.get_last_paper_metric())
|
||||
if self.get_last_custom_paper_size() != self.default_custom_paper_size:
|
||||
size = self.get_last_custom_paper_size()
|
||||
f.write(' <size value="%f %f"/>\n' % (size[0], size[1]) )
|
||||
file.write(' <size value="%f %f"/>\n' % (size[0], size[1]))
|
||||
if self.get_last_paper_name() != self.default_paper_name:
|
||||
f.write(' <paper name="%s"/>\n' % escxml(self.get_last_paper_name()) )
|
||||
file.write(' <paper name="%s"/>\n'
|
||||
% escxml(self.get_last_paper_name()))
|
||||
if self.get_last_css_filename() != self.default_css_filename:
|
||||
f.write(' <css name="%s"/>\n' % escxml(self.get_last_css_filename()) )
|
||||
file.write(' <css name="%s"/>\n'
|
||||
% escxml(self.get_last_css_filename()))
|
||||
if self.get_last_format_name() != self.default_format_name:
|
||||
f.write(' <format name="%s"/>\n' % escxml(self.get_last_format_name()) )
|
||||
file.write(' <format name="%s"/>\n'
|
||||
% escxml(self.get_last_format_name()))
|
||||
if self.get_last_orientation() != self.default_orientation:
|
||||
f.write(' <orientation value="%d"/>\n' % self.get_last_orientation() )
|
||||
f.write('</last-common>\n')
|
||||
file.write(' <orientation value="%d"/>\n'
|
||||
% self.get_last_orientation())
|
||||
file.write('</last-common>\n')
|
||||
|
||||
def write_module_common(self, f, option_list):
|
||||
def write_module_common(self, file, option_list):
|
||||
if option_list.get_format_name():
|
||||
f.write(' <format name="%s"/>\n' %
|
||||
escxml(option_list.get_format_name()) )
|
||||
file.write(' <format name="%s"/>\n'
|
||||
% escxml(option_list.get_format_name()))
|
||||
if option_list.get_format_name() == 'html':
|
||||
if option_list.get_css_filename():
|
||||
f.write(' <css name="%s"/>\n' %
|
||||
escxml(option_list.get_css_filename()))
|
||||
file.write(' <css name="%s"/>\n'
|
||||
% escxml(option_list.get_css_filename()))
|
||||
else: # not HTML format, therefore it's paper
|
||||
if option_list.get_paper_name():
|
||||
f.write(' <paper name="%s"/>\n' %
|
||||
escxml(option_list.get_paper_name()) )
|
||||
file.write(' <paper name="%s"/>\n'
|
||||
% escxml(option_list.get_paper_name()))
|
||||
if option_list.get_orientation() is not None: # 0 is legal
|
||||
f.write(' <orientation value="%d"/>\n' %
|
||||
option_list.get_orientation() )
|
||||
file.write(' <orientation value="%d"/>\n'
|
||||
% option_list.get_orientation())
|
||||
if option_list.get_paper_metric() is not None: # 0 is legal
|
||||
f.write(' <metric value="%d"/>\n' %
|
||||
option_list.get_paper_metric() )
|
||||
file.write(' <metric value="%d"/>\n'
|
||||
% option_list.get_paper_metric())
|
||||
if option_list.get_custom_paper_size():
|
||||
size = option_list.get_custom_paper_size()
|
||||
f.write(' <size value="%f %f"/>\n' % (size[0], size[1]) )
|
||||
file.write(' <size value="%f %f"/>\n'
|
||||
% (size[0], size[1]))
|
||||
if option_list.get_margins():
|
||||
margins = option_list.get_margins()
|
||||
for pos in range(len(margins)):
|
||||
f.write(' <margin number="%s" value="%f"/>\n' %
|
||||
(pos, margins[pos]))
|
||||
file.write(' <margin number="%s" value="%f"/>\n'
|
||||
% (pos, margins[pos]))
|
||||
|
||||
if option_list.get_style_name():
|
||||
f.write(' <style name="%s"/>\n' %
|
||||
escxml(option_list.get_style_name()) )
|
||||
file.write(' <style name="%s"/>\n'
|
||||
% escxml(option_list.get_style_name()))
|
||||
if option_list.get_output():
|
||||
f.write(' <output name="%s"/>\n' %
|
||||
escxml(os.path.basename(option_list.get_output())) )
|
||||
file.write(' <output name="%s"/>\n'
|
||||
% escxml(os.path.basename(option_list.get_output())))
|
||||
|
||||
def parse(self):
|
||||
"""
|
||||
@ -502,10 +508,10 @@ class OptionListCollection(_options.OptionListCollection):
|
||||
"""
|
||||
try:
|
||||
if os.path.isfile(self.filename):
|
||||
p = make_parser()
|
||||
p.setContentHandler(OptionParser(self))
|
||||
parser = make_parser()
|
||||
parser.setContentHandler(OptionParser(self))
|
||||
with open(self.filename, encoding="utf-8") as the_file:
|
||||
p.parse(the_file)
|
||||
parser.parse(the_file)
|
||||
except (IOError, OSError, SAXParseException):
|
||||
pass
|
||||
|
||||
@ -595,7 +601,7 @@ class OptionParser(_options.OptionParser):
|
||||
if tag == "last-common":
|
||||
self.common = False
|
||||
elif tag == 'docgen-option':
|
||||
self.o[self.oname] = self.an_o
|
||||
self.odict[self.oname] = self.an_o
|
||||
else:
|
||||
# Tag is not report-specific, so we let the base class handle it.
|
||||
_options.OptionParser.endElement(self, tag)
|
||||
@ -651,7 +657,8 @@ class OptionHandler(_options.OptionHandler):
|
||||
self.paper_metric = self.option_list_collection.get_last_paper_metric()
|
||||
self.paper_name = self.option_list_collection.get_last_paper_name()
|
||||
self.orientation = self.option_list_collection.get_last_orientation()
|
||||
self.custom_paper_size = self.option_list_collection.get_last_custom_paper_size()
|
||||
self.custom_paper_size = \
|
||||
self.option_list_collection.get_last_custom_paper_size()
|
||||
self.css_filename = self.option_list_collection.get_last_css_filename()
|
||||
self.margins = self.option_list_collection.get_last_margins()
|
||||
self.format_name = self.option_list_collection.get_last_format_name()
|
||||
@ -662,7 +669,8 @@ class OptionHandler(_options.OptionHandler):
|
||||
if self.saved_option_list.get_orientation() is not None: # 0 is legal
|
||||
self.orientation = self.saved_option_list.get_orientation()
|
||||
if self.saved_option_list.get_custom_paper_size():
|
||||
self.custom_paper_size = self.saved_option_list.get_custom_paper_size()
|
||||
self.custom_paper_size = \
|
||||
self.saved_option_list.get_custom_paper_size()
|
||||
if self.saved_option_list.get_margins():
|
||||
self.margins = self.saved_option_list.get_margins()
|
||||
if self.saved_option_list.get_css_filename():
|
||||
@ -709,7 +717,8 @@ class OptionHandler(_options.OptionHandler):
|
||||
|
||||
# Then save last-common options from the current selection
|
||||
self.option_list_collection.set_last_orientation(self.orientation)
|
||||
self.option_list_collection.set_last_custom_paper_size(self.custom_paper_size)
|
||||
self.option_list_collection.set_last_custom_paper_size(
|
||||
self.custom_paper_size)
|
||||
self.option_list_collection.set_last_margins(self.margins)
|
||||
self.option_list_collection.set_last_paper_metric(self.paper_metric)
|
||||
self.option_list_collection.set_last_paper_name(self.paper_name)
|
||||
@ -724,27 +733,35 @@ class OptionHandler(_options.OptionHandler):
|
||||
return os.path.join(HOME_DIR, filename)
|
||||
|
||||
def get_default_stylesheet_name(self):
|
||||
""" get the default stylesheet name """
|
||||
return self.style_name
|
||||
|
||||
def set_default_stylesheet_name(self, style_name):
|
||||
""" set the default stylesheet name """
|
||||
self.style_name = style_name
|
||||
|
||||
def get_format_name(self):
|
||||
""" get the format name """
|
||||
return self.format_name
|
||||
|
||||
def set_format_name(self, format_name):
|
||||
""" set the format name """
|
||||
self.format_name = format_name
|
||||
|
||||
def get_paper_metric(self):
|
||||
""" get the paper metric """
|
||||
return self.paper_metric
|
||||
|
||||
def set_paper_metric(self, paper_metric):
|
||||
""" set the paper metric """
|
||||
self.paper_metric = paper_metric
|
||||
|
||||
def get_paper_name(self):
|
||||
""" get the paper name """
|
||||
return self.paper_name
|
||||
|
||||
def set_paper_name(self, paper_name):
|
||||
""" set the paper name """
|
||||
self.paper_name = paper_name
|
||||
|
||||
def get_paper(self):
|
||||
@ -760,27 +777,35 @@ class OptionHandler(_options.OptionHandler):
|
||||
self.paper = paper
|
||||
|
||||
def get_css_filename(self):
|
||||
""" get the CSS filename """
|
||||
return self.css_filename
|
||||
|
||||
def set_css_filename(self, css_filename):
|
||||
""" set the CSS filename """
|
||||
self.css_filename = css_filename
|
||||
|
||||
def get_orientation(self):
|
||||
""" get the paper's orientation """
|
||||
return self.orientation
|
||||
|
||||
def set_orientation(self, orientation):
|
||||
""" set the paper's orientation """
|
||||
self.orientation = orientation
|
||||
|
||||
def get_custom_paper_size(self):
|
||||
""" get the paper's custom paper size, if any """
|
||||
return copy.copy(self.custom_paper_size)
|
||||
|
||||
def set_custom_paper_size(self, custom_paper_size):
|
||||
""" set the paper's custom paper size """
|
||||
self.custom_paper_size = copy.copy(custom_paper_size)
|
||||
|
||||
def get_margins(self):
|
||||
""" get the paper's margin sizes """
|
||||
return copy.copy(self.margins)
|
||||
|
||||
def set_margins(self,margins):
|
||||
def set_margins(self, margins):
|
||||
""" set the paper's margin sizes """
|
||||
self.margins = copy.copy(margins)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
@ -943,13 +968,13 @@ class DocOptionHandler(_options.OptionHandler):
|
||||
options = self.saved_option_list.get_options()
|
||||
docgen_names = self.option_list_collection.docgen_names
|
||||
for option_name, option_data in options.items():
|
||||
if ( option_name in self.options_dict and
|
||||
isinstance(option_data, list) and
|
||||
option_data and
|
||||
option_data[0] in docgen_names ):
|
||||
if (option_name in self.options_dict
|
||||
and isinstance(option_data, list)
|
||||
and option_data
|
||||
and option_data[0] in docgen_names):
|
||||
try:
|
||||
converter = get_type_converter(
|
||||
self.options_dict[option_name])
|
||||
self.options_dict[option_name])
|
||||
self.options_dict[option_name] = converter(option_data[1])
|
||||
except (TypeError, ValueError):
|
||||
pass
|
||||
@ -997,10 +1022,10 @@ class DocOptionListCollection(_options.OptionListCollection):
|
||||
"""
|
||||
try:
|
||||
if os.path.isfile(self.filename):
|
||||
p = make_parser()
|
||||
p.setContentHandler(DocOptionParser(self))
|
||||
parser = make_parser()
|
||||
parser.setContentHandler(DocOptionParser(self))
|
||||
with open(self.filename, encoding="utf-8") as the_file:
|
||||
p.parse(the_file)
|
||||
parser.parse(the_file)
|
||||
except (IOError, OSError, SAXParseException):
|
||||
pass
|
||||
|
||||
@ -1034,6 +1059,6 @@ class DocOptionParser(_options.OptionParser):
|
||||
def endElement(self, tag):
|
||||
"Overridden class that handles the end of a XML element"
|
||||
if tag == 'docgen-option':
|
||||
self.o[self.oname] = self.an_o
|
||||
self.odict[self.oname] = self.an_o
|
||||
else:
|
||||
_options.OptionParser.endElement(self, tag)
|
||||
|
@ -68,6 +68,7 @@ from gramps.gen.proxy import CacheProxyDb
|
||||
#------------------------------------------------------------------------
|
||||
def draw_wedge(doc, style, centerx, centery, radius, start_angle,
|
||||
end_angle, short_radius=0):
|
||||
""" draw a wedge """
|
||||
from math import pi, cos, sin
|
||||
|
||||
while end_angle < start_angle:
|
||||
@ -92,24 +93,24 @@ def draw_wedge(doc, style, centerx, centery, radius, start_angle,
|
||||
path.append((origx, origy))
|
||||
|
||||
while angle < eangle:
|
||||
x = centerx + cos(angle) * radius
|
||||
y = centery + sin(angle) * radius
|
||||
path.append((x, y))
|
||||
_x_ = centerx + cos(angle) * radius
|
||||
_y_ = centery + sin(angle) * radius
|
||||
path.append((_x_, _y_))
|
||||
angle = angle + radiansdelta
|
||||
x = centerx + cos(eangle) * radius
|
||||
y = centery + sin(eangle) * radius
|
||||
path.append((x, y))
|
||||
_x_ = centerx + cos(eangle) * radius
|
||||
_y_ = centery + sin(eangle) * radius
|
||||
path.append((_x_, _y_))
|
||||
|
||||
if short_radius:
|
||||
x = centerx + cos(eangle) * short_radius
|
||||
y = centery + sin(eangle) * short_radius
|
||||
path.append((x, y))
|
||||
_x_ = centerx + cos(eangle) * short_radius
|
||||
_y_ = centery + sin(eangle) * short_radius
|
||||
path.append((_x_, _y_))
|
||||
|
||||
angle = eangle
|
||||
while angle >= sangle:
|
||||
x = centerx + cos(angle) * short_radius
|
||||
y = centery + sin(angle) * short_radius
|
||||
path.append((x, y))
|
||||
_x_ = centerx + cos(angle) * short_radius
|
||||
_y_ = centery + sin(angle) * short_radius
|
||||
path.append((_x_, _y_))
|
||||
angle -= radiansdelta
|
||||
doc.draw_path(style, path)
|
||||
|
||||
@ -198,8 +199,8 @@ def draw_legend(doc, start_x, start_y, data, title, label_style):
|
||||
start_x + (3*size), start_y - (size*0.25))
|
||||
start_y += size * 1.3
|
||||
|
||||
_t = time.localtime(time.time())
|
||||
_TODAY = parser.parse("%04d-%02d-%02d" % _t[:3])
|
||||
_TTT = time.localtime(time.time())
|
||||
_TODAY = parser.parse("%04d-%02d-%02d" % _TTT[:3])
|
||||
|
||||
def estimate_age(dbase, person,
|
||||
end_handle=None, start_handle=None, today=_TODAY):
|
||||
@ -322,6 +323,7 @@ def _T_(value): # enable deferred translations (see Python docs 22.1.3.4)
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
class Extract:
|
||||
""" Class for extracting statistical data from the database """
|
||||
|
||||
def __init__(self):
|
||||
"""Methods for extracting statistical data from the database"""
|
||||
@ -396,7 +398,7 @@ class Extract:
|
||||
def get_surname(self, person):
|
||||
"return surnames for given person"
|
||||
# TODO: return all surnames, not just primary ones...
|
||||
# TODO: have the surname fromatted according to the name_format too
|
||||
# TODO: have the surname formatted according to the name_format too
|
||||
surnames = person.get_primary_name().get_surname().strip()
|
||||
if surnames:
|
||||
return surnames.split()
|
||||
@ -720,6 +722,7 @@ _Extract = Extract()
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
class StatisticsChart(Report):
|
||||
""" StatisticsChart report """
|
||||
|
||||
def __init__(self, database, options, user):
|
||||
"""
|
||||
@ -765,8 +768,8 @@ class StatisticsChart(Report):
|
||||
if value == living_value:
|
||||
living_desc = self._(description)
|
||||
break
|
||||
self.living_desc = self._("(Living people: %(option_name)s)"
|
||||
% {'option_name': living_desc})
|
||||
self.living_desc = self._(
|
||||
"(Living people: %(option_name)s)") % {'option_name': living_desc}
|
||||
|
||||
# title needs both data extraction method name + gender name
|
||||
if gender == Person.MALE:
|
||||
@ -957,11 +960,13 @@ class StatisticsChart(Report):
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
class StatisticsChartOptions(MenuReportOptions):
|
||||
""" Options for StatisticsChart report """
|
||||
|
||||
def __init__(self, name, dbase):
|
||||
self.__pid = None
|
||||
self.__filter = None
|
||||
self.__db = dbase
|
||||
self._nf = None
|
||||
MenuReportOptions.__init__(self, name, dbase)
|
||||
|
||||
def add_menu_options(self, menu):
|
||||
|
@ -36,7 +36,6 @@ from gramps.gen.plug.menu import (PersonOption, FilterOption,
|
||||
EnumeratedListOption)
|
||||
from gramps.gen.plug.report import Report
|
||||
from gramps.gen.plug.report import utils as ReportUtils
|
||||
pt2cm = ReportUtils.pt2cm
|
||||
from gramps.gen.plug.report import MenuReportOptions
|
||||
from gramps.gen.plug.report import stdoptions
|
||||
from gramps.gen.plug.docgen import (FontStyle, ParagraphStyle, GraphicsStyle,
|
||||
@ -52,7 +51,6 @@ from gramps.gen.proxy import CacheProxyDb
|
||||
# private constants
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
cal = config.get('preferences.calendar-format-report')
|
||||
|
||||
# _T_ is a gramps-defined keyword -- see po/update_po.py and po/genpot.sh
|
||||
def _T_(value): # enable deferred translations (see Python docs 22.1.3.4)
|
||||
@ -73,6 +71,7 @@ def _get_sort_functions(sort):
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
class TimeLine(Report):
|
||||
""" TimeLine Report """
|
||||
|
||||
def __init__(self, database, options, user):
|
||||
"""
|
||||
@ -115,8 +114,8 @@ class TimeLine(Report):
|
||||
if value == living_value:
|
||||
living_desc = self._(description)
|
||||
break
|
||||
self.living_desc = self._("(Living people: %(option_name)s)"
|
||||
% {'option_name': living_desc})
|
||||
self.living_desc = self._(
|
||||
"(Living people: %(option_name)s)") % {'option_name': living_desc}
|
||||
|
||||
stdoptions.run_name_format_option(self, menu)
|
||||
|
||||
@ -148,7 +147,7 @@ class TimeLine(Report):
|
||||
st_size = self.name_size()
|
||||
style_sheet = self.doc.get_style_sheet()
|
||||
font = style_sheet.get_paragraph_style('TLG-Name').get_font()
|
||||
incr = pt2cm(font.get_size())
|
||||
incr = ReportUtils.pt2cm(font.get_size())
|
||||
pad = incr * 0.75
|
||||
_x1, _x2, _y1, _y2 = (0, 0, 0, 0)
|
||||
start = st_size + 0.5
|
||||
@ -285,9 +284,9 @@ class TimeLine(Report):
|
||||
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 - (pt2cm(title_font.get_size()) * 1.2)
|
||||
title_y = 1.2 - (ReportUtils.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 - (pt2cm(title_font.get_size()) * 1.2)
|
||||
title_y = 1.8 - (ReportUtils.pt2cm(title_font.get_size()) * 1.2)
|
||||
self.doc.center_text('TLG-title', title3, width / 2.0, title_y)
|
||||
|
||||
def draw_year_headings(self, year_low, year_high, start_pos, stop_pos):
|
||||
@ -296,7 +295,7 @@ class TimeLine(Report):
|
||||
"""
|
||||
style_sheet = self.doc.get_style_sheet()
|
||||
label_font = style_sheet.get_paragraph_style('TLG-Label').get_font()
|
||||
label_y = self.header - (pt2cm(label_font.get_size()) * 1.2)
|
||||
label_y = self.header - (ReportUtils.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):
|
||||
@ -311,7 +310,7 @@ class TimeLine(Report):
|
||||
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 - (pt2cm(label_font.get_size()) * 1.2)
|
||||
label_y = self.header - (ReportUtils.pt2cm(label_font.get_size()) * 1.2)
|
||||
self.doc.center_text('TLG-label', self._("No Date Information"),
|
||||
width / 2.0, label_y)
|
||||
|
||||
@ -391,7 +390,7 @@ class TimeLine(Report):
|
||||
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 pt2cm(size)
|
||||
return ReportUtils.pt2cm(size)
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
@ -399,6 +398,7 @@ class TimeLine(Report):
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
class TimeLineOptions(MenuReportOptions):
|
||||
""" Options for the TimeLine Report """
|
||||
|
||||
def __init__(self, name, dbase):
|
||||
self.__pid = None
|
||||
|
@ -46,7 +46,6 @@ from gramps.gen.plug.report import Report
|
||||
from gramps.gen.plug.report import utils as ReportUtils
|
||||
from gramps.gen.plug.report import MenuReportOptions
|
||||
from gramps.gen.plug.report import stdoptions
|
||||
from gramps.gen.datehandler import get_date
|
||||
from gramps.gen.utils.db import get_birth_or_fallback, get_death_or_fallback
|
||||
from gramps.gen.proxy import CacheProxyDb
|
||||
|
||||
@ -55,10 +54,9 @@ from gramps.gen.proxy import CacheProxyDb
|
||||
# Constant options items
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
_COLORS = [ { 'name' : _("B&W outline"), 'value' : "outline" },
|
||||
{ 'name' : _("Colored outline"), 'value' : "colored" },
|
||||
{ 'name' : _("Color fill"), 'value' : "filled" }]
|
||||
|
||||
_COLORS = [{'name' : _("B&W outline"), 'value' : "outline"},
|
||||
{'name' : _("Colored outline"), 'value' : "colored"},
|
||||
{'name' : _("Color fill"), 'value' : "filled"}]
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
@ -95,11 +93,11 @@ class HourGlassReport(Report):
|
||||
self.__family_mother = [] # links allocated from family to mother
|
||||
|
||||
self.max_descend = menu.get_option_by_name('maxdescend').get_value()
|
||||
self.max_ascend = menu.get_option_by_name('maxascend').get_value()
|
||||
self.max_ascend = menu.get_option_by_name('maxascend').get_value()
|
||||
pid = menu.get_option_by_name('pid').get_value()
|
||||
self.center_person = self.__db.get_person_from_gramps_id(pid)
|
||||
if (self.center_person == None) :
|
||||
raise ReportError(_("Person %s is not in the Database") % pid )
|
||||
if self.center_person is None:
|
||||
raise ReportError(_("Person %s is not in the Database") % pid)
|
||||
|
||||
# Would be nice to get rid of these 2 hard-coded arrays of colours
|
||||
# and instead allow the user to pick-and-choose whatever colour they
|
||||
@ -146,7 +144,7 @@ class HourGlassReport(Report):
|
||||
for family_handle in person.get_family_handle_list():
|
||||
family = self.__db.get_family_from_handle(family_handle)
|
||||
self.add_family(family)
|
||||
self.doc.add_link( person.get_gramps_id(), family.get_gramps_id() )
|
||||
self.doc.add_link(person.get_gramps_id(), family.get_gramps_id())
|
||||
for child_ref in family.get_child_ref_list():
|
||||
child_handle = child_ref.get_reference_handle()
|
||||
if child_handle not in self.__used_people:
|
||||
@ -155,7 +153,7 @@ class HourGlassReport(Report):
|
||||
child = self.__db.get_person_from_handle(child_handle)
|
||||
self.add_person(child)
|
||||
self.doc.add_link(family.get_gramps_id(),
|
||||
child.get_gramps_id() )
|
||||
child.get_gramps_id())
|
||||
self.traverse_down(child, gen+1)
|
||||
|
||||
def traverse_up(self, person, gen):
|
||||
@ -169,8 +167,8 @@ class HourGlassReport(Report):
|
||||
family = self.__db.get_family_from_handle(family_handle)
|
||||
family_id = family.get_gramps_id()
|
||||
self.add_family(family)
|
||||
self.doc.add_link( family_id, person.get_gramps_id(),
|
||||
head='none', tail='normal' )
|
||||
self.doc.add_link(family_id, person.get_gramps_id(),
|
||||
head='none', tail='normal')
|
||||
|
||||
# create link from family to father
|
||||
father_handle = family.get_father_handle()
|
||||
@ -179,8 +177,8 @@ class HourGlassReport(Report):
|
||||
self.__family_father.append(family_handle)
|
||||
father = self.__db.get_person_from_handle(father_handle)
|
||||
self.add_person(father)
|
||||
self.doc.add_link( father.get_gramps_id(), family_id,
|
||||
head='none', tail='normal' )
|
||||
self.doc.add_link(father.get_gramps_id(), family_id,
|
||||
head='none', tail='normal')
|
||||
# no need to go up if he is a father in another family
|
||||
if father_handle not in self.__used_people:
|
||||
self.__used_people.append(father_handle)
|
||||
@ -191,10 +189,10 @@ class HourGlassReport(Report):
|
||||
if mother_handle and family_handle not in self.__family_mother:
|
||||
# allocate only one mother per family
|
||||
self.__family_mother.append(family_handle)
|
||||
mother = self.__db.get_person_from_handle( mother_handle )
|
||||
self.add_person( mother )
|
||||
self.doc.add_link( mother.get_gramps_id(), family_id,
|
||||
head='none', tail='normal' )
|
||||
mother = self.__db.get_person_from_handle(mother_handle)
|
||||
self.add_person(mother)
|
||||
self.doc.add_link(mother.get_gramps_id(), family_id,
|
||||
head='none', tail='normal')
|
||||
# no need to go up if she is a mother in another family
|
||||
if mother_handle not in self.__used_people:
|
||||
self.__used_people.append(mother_handle)
|
||||
@ -341,16 +339,14 @@ class HourGlassOptions(MenuReportOptions):
|
||||
################################
|
||||
|
||||
color = EnumeratedListOption(_("Graph coloring"), "filled")
|
||||
for i in range( 0, len(_COLORS) ):
|
||||
for i in range(0, len(_COLORS)):
|
||||
color.add_item(_COLORS[i]["value"], _COLORS[i]["name"])
|
||||
color.set_help(_("Males will be shown with blue, females "
|
||||
"with red. If the sex of an individual "
|
||||
"is unknown it will be shown with gray."))
|
||||
menu.add_option(category_name, "color", color)
|
||||
|
||||
roundedcorners = BooleanOption( # see bug report #2180
|
||||
_("Use rounded corners"), False)
|
||||
roundedcorners = BooleanOption(_("Use rounded corners"), False) # 2180
|
||||
roundedcorners.set_help(
|
||||
_("Use rounded corners to differentiate "
|
||||
"between women and men."))
|
||||
_("Use rounded corners to differentiate between women and men."))
|
||||
menu.add_option(category_name, "roundcorners", roundedcorners)
|
||||
|
@ -20,6 +20,8 @@
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
|
||||
""" custom text for the book report """
|
||||
|
||||
# Written by Alex Roitman,
|
||||
# largely based on the SimpleBookTitle.py by Don Allingham
|
||||
|
||||
@ -55,6 +57,7 @@ from gramps.gen.plug.docgen import (FontStyle, ParagraphStyle,
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
class CustomText(Report):
|
||||
""" CustomText """
|
||||
|
||||
def __init__(self, database, options, user):
|
||||
"""
|
||||
@ -125,19 +128,19 @@ class CustomTextOptions(MenuReportOptions):
|
||||
|
||||
category_name = _("Text")
|
||||
|
||||
top = TextOption(_("Initial Text"), [""] )
|
||||
top = TextOption(_("Initial Text"), [""])
|
||||
top.set_help(_("Text to display at the top."))
|
||||
menu.add_option(category_name, "top", top)
|
||||
|
||||
mid = TextOption(_("Middle Text"), [""] )
|
||||
mid = TextOption(_("Middle Text"), [""])
|
||||
mid.set_help(_("Text to display in the middle"))
|
||||
menu.add_option(category_name, "mid", mid)
|
||||
|
||||
bot = TextOption(_("Final Text"), [""] )
|
||||
bot = TextOption(_("Final Text"), [""])
|
||||
bot.set_help(_("Text to display last."))
|
||||
menu.add_option(category_name, "bot", bot)
|
||||
|
||||
def make_default_style(self,default_style):
|
||||
def make_default_style(self, default_style):
|
||||
"""Make the default output style for the Custom Text report."""
|
||||
font = FontStyle()
|
||||
font.set(face=FONT_SANS_SERIF, size=12, bold=0, italic=0)
|
||||
@ -145,7 +148,8 @@ class CustomTextOptions(MenuReportOptions):
|
||||
para.set_font(font)
|
||||
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.'))
|
||||
para.set_description(
|
||||
_('The style used for the first portion of the custom text.'))
|
||||
default_style.add_paragraph_style("CBT-Initial", para)
|
||||
|
||||
font = FontStyle()
|
||||
@ -154,7 +158,8 @@ class CustomTextOptions(MenuReportOptions):
|
||||
para.set_font(font)
|
||||
para.set(pad=0.5)
|
||||
para.set_alignment(PARA_ALIGN_CENTER)
|
||||
para.set_description(_('The style used for the middle portion of the custom text.'))
|
||||
para.set_description(
|
||||
_('The style used for the middle portion of the custom text.'))
|
||||
default_style.add_paragraph_style("CBT-Middle", para)
|
||||
|
||||
font = FontStyle()
|
||||
@ -163,5 +168,6 @@ class CustomTextOptions(MenuReportOptions):
|
||||
para.set_font(font)
|
||||
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.'))
|
||||
para.set_description(
|
||||
_('The style used for the last portion of the custom text.'))
|
||||
default_style.add_paragraph_style("CBT-Final", para)
|
||||
|
@ -45,7 +45,6 @@ from gramps.gen.plug.report import Report
|
||||
from gramps.gen.plug.report import utils as ReportUtils
|
||||
from gramps.gen.plug.report import MenuReportOptions
|
||||
from gramps.gen.plug.report import stdoptions
|
||||
from gramps.gen.datehandler import get_date
|
||||
from gramps.gen.proxy import CacheProxyDb
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
@ -54,6 +53,7 @@ from gramps.gen.proxy import CacheProxyDb
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
class EndOfLineReport(Report):
|
||||
""" EndOfLine Report """
|
||||
|
||||
def __init__(self, database, options, user):
|
||||
"""
|
||||
@ -85,8 +85,8 @@ class EndOfLineReport(Report):
|
||||
|
||||
pid = menu.get_option_by_name('pid').get_value()
|
||||
self.center_person = self.database.get_person_from_gramps_id(pid)
|
||||
if (self.center_person == None) :
|
||||
raise ReportError(_("Person %s is not in the Database") % pid )
|
||||
if self.center_person is None:
|
||||
raise ReportError(_("Person %s is not in the Database") % pid)
|
||||
|
||||
stdoptions.run_name_format_option(self, menu)
|
||||
|
||||
@ -143,7 +143,7 @@ class EndOfLineReport(Report):
|
||||
self.eol_map[gen] = {}
|
||||
if person_handle not in self.eol_map[gen]:
|
||||
self.eol_map[gen][person_handle] = []
|
||||
self.eol_map[gen][person_handle].append( new_pedigree )
|
||||
self.eol_map[gen][person_handle].append(new_pedigree)
|
||||
|
||||
def write_report(self):
|
||||
"""
|
||||
@ -166,7 +166,7 @@ class EndOfLineReport(Report):
|
||||
self.doc.write_text(title)
|
||||
self.doc.end_paragraph()
|
||||
|
||||
self.doc.start_table('EolTable','EOL-Table')
|
||||
self.doc.start_table('EolTable', 'EOL-Table')
|
||||
for generation, handles in self.eol_map.items():
|
||||
self.write_generation_row(generation)
|
||||
for person_handle, pedigrees in handles.items():
|
||||
@ -206,9 +206,9 @@ class EndOfLineReport(Report):
|
||||
death_date = self._get_date(event.get_date_object())
|
||||
dates = ''
|
||||
if birth_date or death_date:
|
||||
dates = self._(" (%(birth_date)s - %(death_date)s)") % {
|
||||
'birth_date' : birth_date,
|
||||
'death_date' : death_date }
|
||||
dates = self._(" (%(birth_date)s - %(death_date)s)"
|
||||
% {'birth_date' : birth_date,
|
||||
'death_date' : death_date})
|
||||
|
||||
self.doc.start_row()
|
||||
self.doc.start_cell('EOL-TableCell', 2)
|
||||
@ -274,54 +274,55 @@ class EndOfLineOptions(MenuReportOptions):
|
||||
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_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("EOL-Title", para)
|
||||
|
||||
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)
|
||||
para = ParagraphStyle()
|
||||
para.set_bottom_margin(ReportUtils.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)
|
||||
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)
|
||||
para = ParagraphStyle()
|
||||
para.set_font(font)
|
||||
para.set_top_margin(ReportUtils.pt2cm(6))
|
||||
para.set_bottom_margin(ReportUtils.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)
|
||||
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)
|
||||
para = ParagraphStyle()
|
||||
para.set_font(font)
|
||||
para.set_top_margin(ReportUtils.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)
|
||||
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)
|
||||
para = ParagraphStyle()
|
||||
para.set_font(font)
|
||||
para.set_top_margin(0)
|
||||
para.set_bottom_margin(ReportUtils.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()
|
||||
|
@ -57,6 +57,7 @@ from gramps.gen.proxy import CacheProxyDb
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
class FamilyGroup(Report):
|
||||
""" Family Group Report """
|
||||
|
||||
def __init__(self, database, options, user):
|
||||
"""
|
||||
@ -74,7 +75,7 @@ class FamilyGroup(Report):
|
||||
filter - Filter to be applied to the families of the database.
|
||||
The option class carries its number, and the function
|
||||
returning the list of filters.
|
||||
includeAttrs - Whether to include attributes
|
||||
incattrs - Whether to include attributes
|
||||
name_format - Preferred format to display names
|
||||
incl_private - Whether to include private data
|
||||
living_people - How to handle living people
|
||||
@ -96,20 +97,20 @@ class FamilyGroup(Report):
|
||||
self.filter = menu.get_option_by_name('filter').get_filter()
|
||||
|
||||
get_option_by_name = menu.get_option_by_name
|
||||
get_value = lambda name:get_option_by_name(name).get_value()
|
||||
self.gramps_ids = get_value('gramps_ids')
|
||||
self.recursive = get_value('recursive')
|
||||
self.missingInfo = get_value('missinginfo')
|
||||
self.generations = get_value('generations')
|
||||
self.incFamNotes = get_value('incFamNotes')
|
||||
self.incParEvents = get_value('incParEvents')
|
||||
self.incParAddr = get_value('incParAddr')
|
||||
self.incParNotes = get_value('incParNotes')
|
||||
self.incParNames = get_value('incParNames')
|
||||
self.incParMar = get_value('incParMar')
|
||||
self.incRelDates = get_value('incRelDates')
|
||||
self.incChiMar = get_value('incChiMar')
|
||||
self.includeAttrs = get_value('incattrs')
|
||||
get_value = lambda name: get_option_by_name(name).get_value()
|
||||
self.gramps_ids = get_value('gramps_ids')
|
||||
self.recursive = get_value('recursive')
|
||||
self.missing_info = get_value('missinginfo')
|
||||
self.generations = get_value('generations')
|
||||
self.inc_fam_notes = get_value('incFamNotes')
|
||||
self.inc_par_events = get_value('incParEvents')
|
||||
self.inc_par_addr = get_value('incParAddr')
|
||||
self.inc_par_notes = get_value('incParNotes')
|
||||
self.inc_par_names = get_value('incParNames')
|
||||
self.inc_par_mar = get_value('incParMar')
|
||||
self.inc_rel_dates = get_value('incRelDates')
|
||||
self.inc_chi_mar = get_value('incChiMar')
|
||||
self.include_attrs = get_value('incattrs')
|
||||
|
||||
stdoptions.run_name_format_option(self, menu)
|
||||
|
||||
@ -124,16 +125,16 @@ class FamilyGroup(Report):
|
||||
place = ''
|
||||
descr = event.get_description()
|
||||
|
||||
if self.includeAttrs:
|
||||
if self.include_attrs:
|
||||
for attr in event.get_attribute_list():
|
||||
if descr:
|
||||
# translators: needed for Arabic, ignore otherwise
|
||||
descr += self._("; ")
|
||||
attr_type = self._get_type(attr.get_type())
|
||||
# translators: needed for French, ignore otherwise
|
||||
descr += self._("%(str1)s: %(str2)s") % {
|
||||
'str1' : self._(attr_type),
|
||||
'str2' : attr.get_value() }
|
||||
descr += self._("%(str1)s: %(str2)s"
|
||||
% {'str1' : self._(attr_type),
|
||||
'str2' : attr.get_value()})
|
||||
|
||||
self.doc.start_row()
|
||||
self.doc.start_cell("FGR-TextContents")
|
||||
@ -184,7 +185,7 @@ class FamilyGroup(Report):
|
||||
gid = father.get_gramps_id()
|
||||
if gid:
|
||||
father_name += " (%s)" % gid
|
||||
if self.incRelDates:
|
||||
if self.inc_rel_dates:
|
||||
birth_ref = father.get_birth_ref()
|
||||
birth = " "
|
||||
if birth_ref:
|
||||
@ -205,7 +206,7 @@ class FamilyGroup(Report):
|
||||
gid = mother.get_gramps_id()
|
||||
if gid:
|
||||
mother_name += " (%s)" % gid
|
||||
if self.incRelDates:
|
||||
if self.inc_rel_dates:
|
||||
birth_ref = mother.get_birth_ref()
|
||||
birth = " "
|
||||
if birth_ref:
|
||||
@ -233,7 +234,7 @@ class FamilyGroup(Report):
|
||||
self.doc.end_paragraph()
|
||||
self.doc.end_cell()
|
||||
self.doc.end_row()
|
||||
elif self.missingInfo:
|
||||
elif self.missing_info:
|
||||
self.dump_parent_line(self._("Father"), "")
|
||||
|
||||
if mother_name != "":
|
||||
@ -250,7 +251,7 @@ class FamilyGroup(Report):
|
||||
self.doc.end_paragraph()
|
||||
self.doc.end_cell()
|
||||
self.doc.end_row()
|
||||
elif self.missingInfo:
|
||||
elif self.missing_info:
|
||||
self.dump_parent_line(self._("Mother"), "")
|
||||
|
||||
def dump_parent_line(self, name, text):
|
||||
@ -275,17 +276,15 @@ class FamilyGroup(Report):
|
||||
self.doc.end_paragraph()
|
||||
self.doc.end_cell()
|
||||
self.doc.start_cell("FGR-TextContentsEnd", 2)
|
||||
self.doc.write_styled_note(note.get_styledtext(),
|
||||
note.get_format(), 'FGR-Note',
|
||||
contains_html=
|
||||
(note.get_type()==NoteType.HTML_CODE)
|
||||
)
|
||||
self.doc.write_styled_note(
|
||||
note.get_styledtext(), note.get_format(), 'FGR-Note',
|
||||
contains_html=(note.get_type() == NoteType.HTML_CODE))
|
||||
self.doc.end_cell()
|
||||
self.doc.end_row()
|
||||
|
||||
def dump_parent(self, title, person_handle):
|
||||
|
||||
if not person_handle and not self.missingInfo:
|
||||
if not person_handle and not self.missing_info:
|
||||
return
|
||||
elif not person_handle:
|
||||
person = Person()
|
||||
@ -299,9 +298,9 @@ class FamilyGroup(Report):
|
||||
self.doc.start_paragraph('FGR-ParentName')
|
||||
mark = ReportUtils.get_person_mark(self.db, person)
|
||||
# translators: needed for French, ignore otherwise
|
||||
self.doc.write_text(self._("%(str1)s: %(str2)s") % {
|
||||
'str1' : title,
|
||||
'str2' : name }, mark)
|
||||
self.doc.write_text(self._("%(str1)s: %(str2)s"
|
||||
% {'str1' : title,
|
||||
'str2' : name}), mark)
|
||||
if self.gramps_ids:
|
||||
gid = person.get_gramps_id()
|
||||
if gid:
|
||||
@ -312,30 +311,30 @@ class FamilyGroup(Report):
|
||||
|
||||
birth_ref = person.get_birth_ref()
|
||||
birth = None
|
||||
evtName = self._("Birth")
|
||||
ev_name = self._("Birth")
|
||||
if birth_ref:
|
||||
birth = self.db.get_event_from_handle(birth_ref.ref)
|
||||
if birth or self.missingInfo:
|
||||
self.dump_parent_event(evtName, birth)
|
||||
if birth or self.missing_info:
|
||||
self.dump_parent_event(ev_name, birth)
|
||||
|
||||
death_ref = person.get_death_ref()
|
||||
death = None
|
||||
evtName = self._("Death")
|
||||
ev_name = self._("Death")
|
||||
if death_ref:
|
||||
death = self.db.get_event_from_handle(death_ref.ref)
|
||||
if death or self.missingInfo:
|
||||
self.dump_parent_event(evtName, death)
|
||||
if death or self.missing_info:
|
||||
self.dump_parent_event(ev_name, death)
|
||||
|
||||
self.dump_parent_parents(person)
|
||||
|
||||
if self.incParEvents:
|
||||
if self.inc_par_events:
|
||||
for event_ref in person.get_primary_event_ref_list():
|
||||
if event_ref != birth_ref and event_ref != death_ref:
|
||||
event = self.db.get_event_from_handle(event_ref.ref)
|
||||
event_type = self._get_type(event.get_type())
|
||||
self.dump_parent_event(self._(event_type), event)
|
||||
|
||||
if self.incParAddr:
|
||||
if self.inc_par_addr:
|
||||
addrlist = person.get_address_list()[:]
|
||||
for addr in addrlist:
|
||||
location = ReportUtils.get_address_str(addr)
|
||||
@ -359,17 +358,17 @@ class FamilyGroup(Report):
|
||||
self.doc.end_cell()
|
||||
self.doc.end_row()
|
||||
|
||||
if self.incParNotes:
|
||||
if self.inc_par_notes:
|
||||
for notehandle in person.get_note_list():
|
||||
note = self.db.get_note_from_handle(notehandle)
|
||||
self.dump_parent_noteline(self._("Note"), note)
|
||||
|
||||
if self.includeAttrs:
|
||||
if self.include_attrs:
|
||||
for attr in person.get_attribute_list():
|
||||
attr_type = self._get_type(attr.get_type())
|
||||
self.dump_parent_line(self._(attr_type), attr.get_value())
|
||||
|
||||
if self.incParNames:
|
||||
if self.inc_par_names:
|
||||
for alt_name in person.get_alternate_names():
|
||||
name_type = self._get_type(alt_name.get_type())
|
||||
name = self._name_display.display_name(alt_name)
|
||||
@ -387,13 +386,13 @@ class FamilyGroup(Report):
|
||||
for event_ref in family_list:
|
||||
if event_ref:
|
||||
event = self.db.get_event_from_handle(event_ref.ref)
|
||||
if event.get_type() == EventType.MARRIAGE and \
|
||||
(event_ref.get_role() == EventRoleType.FAMILY or
|
||||
event_ref.get_role() == EventRoleType.PRIMARY):
|
||||
if (event.get_type() == EventType.MARRIAGE and
|
||||
(event_ref.get_role() == EventRoleType.FAMILY or
|
||||
event_ref.get_role() == EventRoleType.PRIMARY)):
|
||||
mrg = event
|
||||
break
|
||||
|
||||
if len(family_list) > 0 or self.missingInfo or self.includeAttrs:
|
||||
if len(family_list) > 0 or self.missing_info or self.include_attrs:
|
||||
self.doc.start_table("MarriageInfo", 'FGR-ParentTable')
|
||||
self.doc.start_row()
|
||||
self.doc.start_cell('FGR-ParentHead', 3)
|
||||
@ -416,12 +415,12 @@ class FamilyGroup(Report):
|
||||
event_type = self._get_type(event.get_type())
|
||||
self.dump_parent_event(self._(event_type), event)
|
||||
|
||||
if self.includeAttrs:
|
||||
if self.include_attrs:
|
||||
for attr in family.get_attribute_list():
|
||||
attr_type = self._get_type(attr.get_type())
|
||||
self.dump_parent_line(self._(attr_type), attr.get_value())
|
||||
|
||||
if self.incFamNotes:
|
||||
if self.inc_fam_notes:
|
||||
for notehandle in family.get_note_list():
|
||||
note = self.database.get_note_from_handle(notehandle)
|
||||
self.dump_parent_noteline(self._("Note"), note)
|
||||
@ -476,8 +475,8 @@ class FamilyGroup(Report):
|
||||
else:
|
||||
death = None
|
||||
|
||||
spouse_count = 0;
|
||||
if self.incChiMar:
|
||||
spouse_count = 0
|
||||
if self.inc_chi_mar:
|
||||
for family_handle in person.get_family_handle_list():
|
||||
family = self.db.get_family_from_handle(family_handle)
|
||||
spouse_id = None
|
||||
@ -489,9 +488,10 @@ class FamilyGroup(Report):
|
||||
spouse_count += 1
|
||||
|
||||
self.doc.start_row()
|
||||
if (spouse_count != 0 or self.missingInfo
|
||||
or death is not None
|
||||
or birth is not None):
|
||||
if (spouse_count != 0
|
||||
or self.missing_info
|
||||
or death is not None
|
||||
or birth is not None):
|
||||
self.doc.start_cell('FGR-TextChild1')
|
||||
else:
|
||||
self.doc.start_cell('FGR-TextChild2')
|
||||
@ -517,19 +517,19 @@ class FamilyGroup(Report):
|
||||
self.doc.end_cell()
|
||||
self.doc.end_row()
|
||||
|
||||
if self.missingInfo or birth is not None:
|
||||
if spouse_count != 0 or self.missingInfo or death is not None:
|
||||
if self.missing_info or birth is not None:
|
||||
if spouse_count != 0 or self.missing_info or death is not None:
|
||||
self.dump_child_event('FGR-TextChild1', self._('Birth'), birth)
|
||||
else:
|
||||
self.dump_child_event('FGR-TextChild2', self._('Birth'), birth)
|
||||
|
||||
if self.missingInfo or death is not None:
|
||||
if spouse_count == 0 or not self.incChiMar:
|
||||
if self.missing_info or death is not None:
|
||||
if spouse_count == 0 or not self.inc_chi_mar:
|
||||
self.dump_child_event('FGR-TextChild2', self._('Death'), death)
|
||||
else:
|
||||
self.dump_child_event('FGR-TextChild1', self._('Death'), death)
|
||||
|
||||
if self.incChiMar:
|
||||
if self.inc_chi_mar:
|
||||
index = 0
|
||||
for family_handle in person.get_family_handle_list():
|
||||
mrg = None
|
||||
@ -573,7 +573,7 @@ class FamilyGroup(Report):
|
||||
gid = spouse.get_gramps_id()
|
||||
if gid:
|
||||
spouse_name += " (%s)" % gid
|
||||
if self.incRelDates:
|
||||
if self.inc_rel_dates:
|
||||
birth = " "
|
||||
birth_ref = spouse.get_birth_ref()
|
||||
if birth_ref:
|
||||
@ -597,11 +597,11 @@ class FamilyGroup(Report):
|
||||
self.doc.end_row()
|
||||
|
||||
if mrg:
|
||||
evtName = self._("Marriage")
|
||||
ev_name = self._("Marriage")
|
||||
if index == families:
|
||||
self.dump_child_event('FGR-TextChild2', evtName, mrg)
|
||||
self.dump_child_event('FGR-TextChild2', ev_name, mrg)
|
||||
else:
|
||||
self.dump_child_event('FGR-TextChild1', evtName, mrg)
|
||||
self.dump_child_event('FGR-TextChild1', ev_name, mrg)
|
||||
|
||||
def dump_family(self, family_handle, generation):
|
||||
self.doc.start_paragraph('FGR-Title')
|
||||
@ -619,7 +619,7 @@ class FamilyGroup(Report):
|
||||
self.doc.start_paragraph("FGR-blank")
|
||||
self.doc.end_paragraph()
|
||||
|
||||
if self.incParMar:
|
||||
if self.inc_par_mar:
|
||||
self.dump_marriage(family)
|
||||
self.doc.start_paragraph("FGR-blank")
|
||||
self.doc.end_paragraph()
|
||||
@ -690,6 +690,7 @@ class FamilyGroupOptions(MenuReportOptions):
|
||||
self.__fid = None
|
||||
self.__filter = None
|
||||
self.__recursive = None
|
||||
self._nf = None
|
||||
MenuReportOptions.__init__(self, name, dbase)
|
||||
|
||||
def add_menu_options(self, menu):
|
||||
@ -740,45 +741,45 @@ class FamilyGroupOptions(MenuReportOptions):
|
||||
"report (recursive only)."))
|
||||
add_option("generations", generations)
|
||||
|
||||
incParEvents = BooleanOption(_("Parent Events"), False)
|
||||
incParEvents.set_help(_("Whether to include events for parents."))
|
||||
add_option("incParEvents", incParEvents)
|
||||
inc_par_events = BooleanOption(_("Parent Events"), False)
|
||||
inc_par_events.set_help(_("Whether to include events for parents."))
|
||||
add_option("incParEvents", inc_par_events)
|
||||
|
||||
incParAddr = BooleanOption(_("Parent Addresses"), False)
|
||||
incParAddr.set_help(_("Whether to include addresses for parents."))
|
||||
add_option("incParAddr", incParAddr)
|
||||
inc_par_addr = BooleanOption(_("Parent Addresses"), False)
|
||||
inc_par_addr.set_help(_("Whether to include addresses for parents."))
|
||||
add_option("incParAddr", inc_par_addr)
|
||||
|
||||
incParNotes = BooleanOption(_("Parent Notes"), False)
|
||||
incParNotes.set_help(_("Whether to include notes for parents."))
|
||||
add_option("incParNotes", incParNotes)
|
||||
inc_par_notes = BooleanOption(_("Parent Notes"), False)
|
||||
inc_par_notes.set_help(_("Whether to include notes for parents."))
|
||||
add_option("incParNotes", inc_par_notes)
|
||||
|
||||
incattrs = BooleanOption(_("Parent Attributes"), False)
|
||||
incattrs.set_help(_("Whether to include attributes."))
|
||||
add_option("incattrs", incattrs)
|
||||
|
||||
incParNames = BooleanOption(_("Alternate Parent Names"), False)
|
||||
incParNames.set_help(_("Whether to include alternate "
|
||||
"names for parents."))
|
||||
add_option("incParNames", incParNames)
|
||||
inc_par_names = BooleanOption(_("Alternate Parent Names"), False)
|
||||
inc_par_names.set_help(
|
||||
_("Whether to include alternate names for parents."))
|
||||
add_option("incParNames", inc_par_names)
|
||||
|
||||
incParMar = BooleanOption(_("Parent Marriage"), True)
|
||||
incParMar.set_help(_("Whether to include marriage information "
|
||||
"for parents."))
|
||||
add_option("incParMar", incParMar)
|
||||
inc_par_mar = BooleanOption(_("Parent Marriage"), True)
|
||||
inc_par_mar.set_help(
|
||||
_("Whether to include marriage information for parents."))
|
||||
add_option("incParMar", inc_par_mar)
|
||||
|
||||
incFamNotes = BooleanOption(_("Family Notes"), False)
|
||||
incFamNotes.set_help(_("Whether to include notes for families."))
|
||||
add_option("incFamNotes", incFamNotes)
|
||||
inc_fam_notes = BooleanOption(_("Family Notes"), False)
|
||||
inc_fam_notes.set_help(_("Whether to include notes for families."))
|
||||
add_option("incFamNotes", inc_fam_notes)
|
||||
|
||||
incRelDates = BooleanOption(_("Dates of Relatives"), False)
|
||||
incRelDates.set_help(_("Whether to include dates for relatives "
|
||||
"(father, mother, spouse)."))
|
||||
add_option("incRelDates", incRelDates)
|
||||
inc_rel_dates = BooleanOption(_("Dates of Relatives"), False)
|
||||
inc_rel_dates.set_help(_("Whether to include dates for relatives "
|
||||
"(father, mother, spouse)."))
|
||||
add_option("incRelDates", inc_rel_dates)
|
||||
|
||||
incChiMar = BooleanOption(_("Children Marriages"), True)
|
||||
incChiMar.set_help(_("Whether to include marriage information "
|
||||
"for children."))
|
||||
add_option("incChiMar", incChiMar)
|
||||
inc_chi_mar = BooleanOption(_("Children Marriages"), True)
|
||||
inc_chi_mar.set_help(
|
||||
_("Whether to include marriage information for children."))
|
||||
add_option("incChiMar", inc_chi_mar)
|
||||
|
||||
##########################
|
||||
add_option = partial(menu.add_option, _("Missing Information"))
|
||||
@ -812,6 +813,7 @@ class FamilyGroupOptions(MenuReportOptions):
|
||||
self.__fid.set_available(True)
|
||||
else: # filters that don't
|
||||
self.__fid.set_available(False)
|
||||
|
||||
# only allow recursion if the center family is the only family
|
||||
if self.__recursive and filter_value == 0:
|
||||
self.__recursive.set_available(True)
|
||||
|
@ -56,6 +56,7 @@ from gramps.gen.proxy import CacheProxyDb
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
class KinshipReport(Report):
|
||||
""" Kinship Report """
|
||||
|
||||
def __init__(self, database, options, user):
|
||||
"""
|
||||
@ -93,14 +94,14 @@ class KinshipReport(Report):
|
||||
self.__db = self.database
|
||||
|
||||
self.max_descend = menu.get_option_by_name('maxdescend').get_value()
|
||||
self.max_ascend = menu.get_option_by_name('maxascend').get_value()
|
||||
self.max_ascend = menu.get_option_by_name('maxascend').get_value()
|
||||
self.inc_spouses = menu.get_option_by_name('incspouses').get_value()
|
||||
self.inc_cousins = menu.get_option_by_name('inccousins').get_value()
|
||||
self.inc_aunts = menu.get_option_by_name('incaunts').get_value()
|
||||
pid = menu.get_option_by_name('pid').get_value()
|
||||
self.inc_aunts = menu.get_option_by_name('incaunts').get_value()
|
||||
pid = menu.get_option_by_name('pid').get_value()
|
||||
self.person = self.database.get_person_from_gramps_id(pid)
|
||||
if self.person is None:
|
||||
raise ReportError(_("Person %s is not in the Database") % pid )
|
||||
raise ReportError(_("Person %s is not in the Database") % pid)
|
||||
|
||||
stdoptions.run_name_format_option(self, menu)
|
||||
|
||||
@ -140,12 +141,12 @@ class KinshipReport(Report):
|
||||
for Gb in Gbs:
|
||||
# To understand these calculations, see:
|
||||
# http://en.wikipedia.org/wiki/Cousin#Mathematical_definitions
|
||||
x = min (Ga, Gb)
|
||||
y = abs(Ga-Gb)
|
||||
_x_ = min(Ga, Gb)
|
||||
_y_ = abs(Ga - Gb)
|
||||
# Skip unrequested people
|
||||
if x == 1 and y > 0 and not self.inc_aunts:
|
||||
if _x_ == 1 and _y_ > 0 and not self.inc_aunts:
|
||||
continue
|
||||
elif x > 1 and not self.inc_cousins:
|
||||
elif _x_ > 1 and not self.inc_cousins:
|
||||
continue
|
||||
|
||||
get_rel_str = self.rel_calc.get_plural_relationship_string
|
||||
@ -154,8 +155,8 @@ class KinshipReport(Report):
|
||||
self.write_people(self._(title), self.kinship_map[Ga][Gb])
|
||||
|
||||
if (self.inc_spouses and
|
||||
Ga in self.spouse_map and
|
||||
Gb in self.spouse_map[Ga]):
|
||||
Ga in self.spouse_map and
|
||||
Gb in self.spouse_map[Ga]):
|
||||
title = get_rel_str(Ga, Gb, in_law_b=True)
|
||||
self.write_people(self._(title), self.spouse_map[Ga][Gb])
|
||||
|
||||
@ -315,9 +316,9 @@ class KinshipReport(Report):
|
||||
death_date = self._get_date(death.get_date_object())
|
||||
dates = ''
|
||||
if birth_date or death_date:
|
||||
dates = self._(" (%(birth_date)s - %(death_date)s)") % {
|
||||
'birth_date' : birth_date,
|
||||
'death_date' : death_date }
|
||||
dates = self._(" (%(birth_date)s - %(death_date)s)"
|
||||
% {'birth_date' : birth_date,
|
||||
'death_date' : death_date})
|
||||
|
||||
self.doc.start_paragraph('KIN-Normal')
|
||||
self.doc.write_text(name, mark)
|
||||
@ -378,33 +379,33 @@ class KinshipOptions(MenuReportOptions):
|
||||
|
||||
def make_default_style(self, default_style):
|
||||
"""Make the default output style for the Kinship Report."""
|
||||
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("KIN-Title", p)
|
||||
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("KIN-Title", para)
|
||||
|
||||
font = FontStyle()
|
||||
font.set_size(12)
|
||||
font.set_bold(True)
|
||||
p = ParagraphStyle()
|
||||
p.set_header_level(3)
|
||||
p.set_font(font)
|
||||
p.set_top_margin(ReportUtils.pt2cm(6))
|
||||
p.set_description(_('The basic style used for sub-headings.'))
|
||||
default_style.add_paragraph_style("KIN-Subtitle", p)
|
||||
para = ParagraphStyle()
|
||||
para.set_header_level(3)
|
||||
para.set_font(font)
|
||||
para.set_top_margin(ReportUtils.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)
|
||||
p = ParagraphStyle()
|
||||
p.set_font(font)
|
||||
p.set_left_margin(0.5)
|
||||
p.set_description(_('The basic style used for the text display.'))
|
||||
default_style.add_paragraph_style("KIN-Normal", p)
|
||||
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)
|
||||
|
@ -79,8 +79,8 @@ class NumberOfAncestorsReport(Report):
|
||||
|
||||
pid = options.menu.get_option_by_name('pid').get_value()
|
||||
self.__person = self.__db.get_person_from_gramps_id(pid)
|
||||
if (self.__person == None) :
|
||||
raise ReportError(_("Person %s is not in the Database") % pid )
|
||||
if self.__person is None:
|
||||
raise ReportError(_("Person %s is not in the Database") % pid)
|
||||
|
||||
lang = options.menu.get_option_by_name('trans').get_value()
|
||||
self._locale = self.set_locale(lang)
|
||||
@ -95,7 +95,7 @@ class NumberOfAncestorsReport(Report):
|
||||
thisgen = {}
|
||||
all_people = {}
|
||||
total_theoretical = 0
|
||||
thisgen[self.__person.get_handle()]=1
|
||||
thisgen[self.__person.get_handle()] = 1
|
||||
ngettext = self._locale.translation.ngettext # to see "nearby" comments
|
||||
|
||||
self.doc.start_paragraph("NOA-Title")
|
||||
@ -113,10 +113,10 @@ class NumberOfAncestorsReport(Report):
|
||||
if thisgen != {}:
|
||||
thisgensize = len(thisgen)
|
||||
gen += 1
|
||||
theoretical = math.pow(2, ( gen - 1 ) )
|
||||
theoretical = math.pow(2, (gen - 1))
|
||||
total_theoretical += theoretical
|
||||
percent = '(%s%%)' % self._locale.format('%3.2f',
|
||||
((sum(thisgen.values()) / theoretical ) * 100))
|
||||
percent = '(%s%%)' % self._locale.format(
|
||||
'%3.2f', ((sum(thisgen.values()) / theoretical) * 100))
|
||||
|
||||
# TC # English return something like:
|
||||
# Generation 3 has 2 individuals. (50.00%)
|
||||
@ -156,21 +156,20 @@ class NumberOfAncestorsReport(Report):
|
||||
all_people.get(mother_handle, 0) + person_data
|
||||
)
|
||||
|
||||
if( total_theoretical != 1 ):
|
||||
percent = '(%3.2f%%)' % (( sum(all_people.values())
|
||||
/ (total_theoretical-1) ) * 100)
|
||||
if total_theoretical != 1:
|
||||
percent = '(%3.2f%%)' % (
|
||||
(sum(all_people.values()) / (total_theoretical-1)) * 100)
|
||||
else:
|
||||
percent = 0
|
||||
|
||||
# TC # English return something like:
|
||||
# Total ancestors in generations 2 to 3 is 4. (66.67%)
|
||||
text = self._("Total ancestors in generations %(second_generation)d to "
|
||||
"%(last_generation)d is %(count)d. %(percent)s") % {
|
||||
'second_generation': 2,
|
||||
'last_generation' : gen,
|
||||
'count' : len(all_people),
|
||||
'percent' : percent
|
||||
}
|
||||
text = self._("Total ancestors in generations %(second_generation)d "
|
||||
"to %(last_generation)d is %(count)d. %(percent)s") % {
|
||||
'second_generation': 2,
|
||||
'last_generation' : gen,
|
||||
'count' : len(all_people),
|
||||
'percent' : percent}
|
||||
|
||||
self.doc.start_paragraph('NOA-Normal')
|
||||
self.doc.write_text(text)
|
||||
|
@ -37,7 +37,7 @@
|
||||
from gramps.gen.const import GRAMPS_LOCALE as glocale
|
||||
_ = glocale.translation.sgettext
|
||||
from gramps.gen.plug.menu import (FilterOption, PlaceListOption,
|
||||
EnumeratedListOption, BooleanOption)
|
||||
EnumeratedListOption)
|
||||
from gramps.gen.plug.report import Report
|
||||
from gramps.gen.plug.report import MenuReportOptions
|
||||
from gramps.gen.plug.report import stdoptions
|
||||
@ -48,7 +48,6 @@ from gramps.gen.plug.docgen import (IndexMark, FontStyle, ParagraphStyle,
|
||||
from gramps.gen.sort import Sort
|
||||
from gramps.gen.utils.location import get_location_list
|
||||
from gramps.gen.display.place import displayer as place_displayer
|
||||
from gramps.gen.lib import PlaceType
|
||||
from gramps.gen.errors import ReportError
|
||||
from gramps.gen.proxy import LivingProxyDb, CacheProxyDb
|
||||
|
||||
@ -88,17 +87,18 @@ class PlaceReport(Report):
|
||||
stdoptions.run_private_data_option(self, menu)
|
||||
living_opt = stdoptions.run_living_people_option(self, menu, rlocale)
|
||||
self.database = CacheProxyDb(self.database)
|
||||
self._db = self.database
|
||||
|
||||
self._lv = menu.get_option_by_name('living_people').get_value()
|
||||
for (value, description) in living_opt.get_items(xml_items=True):
|
||||
if value == self._lv:
|
||||
living_desc = self._(description)
|
||||
break
|
||||
self.living_desc = self._("(Living people: %(option_name)s)"
|
||||
% {'option_name': living_desc})
|
||||
self.living_desc = self._(
|
||||
"(Living people: %(option_name)s)") % {'option_name': living_desc}
|
||||
|
||||
places = menu.get_option_by_name('places').get_value()
|
||||
self.center = menu.get_option_by_name('center').get_value()
|
||||
self.center = menu.get_option_by_name('center').get_value()
|
||||
|
||||
stdoptions.run_name_format_option(self, menu)
|
||||
self._nd = self._name_display
|
||||
@ -106,20 +106,21 @@ class PlaceReport(Report):
|
||||
filter_option = menu.get_option_by_name('filter')
|
||||
self.filter = filter_option.get_filter()
|
||||
|
||||
self.sort = Sort(self.database)
|
||||
self.sort = Sort(self._db)
|
||||
|
||||
self.place_handles = []
|
||||
if self.filter.get_name() != '':
|
||||
# Use the selected filter to provide a list of place handles
|
||||
plist = self.database.iter_place_handles()
|
||||
self.place_handles = self.filter.apply(self.database, plist)
|
||||
plist = self._db.iter_place_handles()
|
||||
self.place_handles = self.filter.apply(self._db, plist)
|
||||
|
||||
if places:
|
||||
# Add places selected individually
|
||||
self.place_handles += self.__get_place_handles(places)
|
||||
|
||||
if not self.place_handles:
|
||||
raise ReportError(_('Place Report'),
|
||||
raise ReportError(
|
||||
_('Place Report'),
|
||||
_('Please select at least one place before running this.'))
|
||||
|
||||
self.place_handles.sort(key=self.sort.by_place_title_key)
|
||||
@ -151,8 +152,8 @@ class PlaceReport(Report):
|
||||
place_nbr = 1
|
||||
|
||||
with self._user.progress(_("Place Report"),
|
||||
_("Generating report"),
|
||||
len(self.place_handles)) as step:
|
||||
_("Generating report"),
|
||||
len(self.place_handles)) as step:
|
||||
|
||||
for handle in self.place_handles:
|
||||
self.__write_place(handle, place_nbr)
|
||||
@ -161,7 +162,7 @@ class PlaceReport(Report):
|
||||
elif self.center == "Person":
|
||||
self.__write_referenced_persons(handle)
|
||||
else:
|
||||
raise AttributeError("no such center: '%s'" % self.center)
|
||||
raise AttributeError("no such center: '%s'" % self.center)
|
||||
place_nbr += 1
|
||||
# increment progress bar
|
||||
step()
|
||||
@ -171,13 +172,14 @@ class PlaceReport(Report):
|
||||
"""
|
||||
This procedure writes out the details of a single place
|
||||
"""
|
||||
place = self.database.get_place_from_handle(handle)
|
||||
place = self._db.get_place_from_handle(handle)
|
||||
|
||||
place_details = [self._("Gramps ID: %s ") % place.get_gramps_id()]
|
||||
for level in get_location_list(self.database, place):
|
||||
place_details.append("%(type)s: %(name)s " %
|
||||
{'type': self._(level[1].xml_str()),
|
||||
'name': level[0]})
|
||||
for level in get_location_list(self._db, place):
|
||||
# translators: needed for French, ignore otherwise
|
||||
place_details.append(self._(
|
||||
"%(str1)s: %(str2)s") % {'str1': self._(level[1].xml_str()),
|
||||
'str2': level[0]})
|
||||
|
||||
place_names = ''
|
||||
all_names = place.get_all_names()
|
||||
@ -191,10 +193,9 @@ class PlaceReport(Report):
|
||||
place_names += ' (%s)' % place_name.get_language()
|
||||
place_details += [self._("places|All Names: %s") % place_names,]
|
||||
self.doc.start_paragraph("PLC-PlaceTitle")
|
||||
place_title = place_displayer.display(self.database, place)
|
||||
self.doc.write_text(("%(nbr)s. %(place)s") %
|
||||
{'nbr' : place_nbr,
|
||||
'place' : place_title})
|
||||
place_title = place_displayer.display(self._db, place)
|
||||
self.doc.write_text(("%(nbr)s. %(place)s") % {'nbr' : place_nbr,
|
||||
'place' : place_title})
|
||||
self.doc.end_paragraph()
|
||||
|
||||
for item in place_details:
|
||||
@ -207,7 +208,7 @@ class PlaceReport(Report):
|
||||
This procedure writes out each of the events related to the place
|
||||
"""
|
||||
event_handles = [event_handle for (object_type, event_handle) in
|
||||
self.database.find_backlink_handles(handle, ['Event'])]
|
||||
self._db.find_backlink_handles(handle, ['Event'])]
|
||||
event_handles.sort(key=self.sort.by_date_key)
|
||||
|
||||
if event_handles:
|
||||
@ -228,7 +229,7 @@ class PlaceReport(Report):
|
||||
self.doc.end_row()
|
||||
|
||||
for evt_handle in event_handles:
|
||||
event = self.database.get_event_from_handle(evt_handle)
|
||||
event = self._db.get_event_from_handle(evt_handle)
|
||||
if event: # will be None if marked private
|
||||
date = self._get_date(event.get_date_object())
|
||||
descr = event.get_description()
|
||||
@ -236,14 +237,14 @@ class PlaceReport(Report):
|
||||
|
||||
person_list = []
|
||||
ref_handles = [x for x in
|
||||
self.database.find_backlink_handles(evt_handle)]
|
||||
self._db.find_backlink_handles(evt_handle)]
|
||||
if not ref_handles: # since the backlink may point to private
|
||||
continue # data, ignore an event with no backlinks
|
||||
for (ref_type, ref_handle) in ref_handles:
|
||||
if ref_type == 'Person':
|
||||
person_list.append(ref_handle)
|
||||
else:
|
||||
family = self.database.get_family_from_handle(ref_handle)
|
||||
family = self._db.get_family_from_handle(ref_handle)
|
||||
father = family.get_father_handle()
|
||||
if father:
|
||||
person_list.append(father)
|
||||
@ -254,7 +255,7 @@ class PlaceReport(Report):
|
||||
people = ""
|
||||
person_list = list(set(person_list))
|
||||
for p_handle in person_list:
|
||||
person = self.database.get_person_from_handle(p_handle)
|
||||
person = self._db.get_person_from_handle(p_handle)
|
||||
if person:
|
||||
if people == "":
|
||||
people = "%(name)s (%(id)s)" \
|
||||
@ -285,7 +286,7 @@ class PlaceReport(Report):
|
||||
This procedure writes out each of the people related to the place
|
||||
"""
|
||||
event_handles = [event_handle for (object_type, event_handle) in
|
||||
self.database.find_backlink_handles(handle, ['Event'])]
|
||||
self._db.find_backlink_handles(handle, ['Event'])]
|
||||
|
||||
if event_handles:
|
||||
self.doc.start_paragraph("PLC-Section")
|
||||
@ -307,44 +308,44 @@ class PlaceReport(Report):
|
||||
person_dict = {}
|
||||
for evt_handle in event_handles:
|
||||
ref_handles = [x for x in
|
||||
self.database.find_backlink_handles(evt_handle)]
|
||||
self._db.find_backlink_handles(evt_handle)]
|
||||
for (ref_type, ref_handle) in ref_handles:
|
||||
if ref_type == 'Person':
|
||||
person = self.database.get_person_from_handle(ref_handle)
|
||||
nameEntry = "%s (%s)" % (self._nd.display(person),
|
||||
person.get_gramps_id())
|
||||
person = self._db.get_person_from_handle(ref_handle)
|
||||
name_entry = "%s (%s)" % (self._nd.display(person),
|
||||
person.get_gramps_id())
|
||||
else:
|
||||
family = self.database.get_family_from_handle(ref_handle)
|
||||
family = self._db.get_family_from_handle(ref_handle)
|
||||
f_handle = family.get_father_handle()
|
||||
m_handle = family.get_mother_handle()
|
||||
if f_handle and m_handle:
|
||||
father = self.database.get_person_from_handle(f_handle)
|
||||
mother = self.database.get_person_from_handle(m_handle)
|
||||
nameEntry = self._("%(father)s (%(father_id)s) and "
|
||||
"%(mother)s (%(mother_id)s)") % \
|
||||
{ 'father' : self._nd.display(father),
|
||||
'father_id' : father.get_gramps_id(),
|
||||
'mother' : self._nd.display(mother),
|
||||
'mother_id' : mother.get_gramps_id()}
|
||||
father = self._db.get_person_from_handle(f_handle)
|
||||
mother = self._db.get_person_from_handle(m_handle)
|
||||
name_entry = self._(
|
||||
"%(father)s (%(father_id)s) and "
|
||||
"%(mother)s (%(mother_id)s)") % {
|
||||
'father' : self._nd.display(father),
|
||||
'father_id' : father.get_gramps_id(),
|
||||
'mother' : self._nd.display(mother),
|
||||
'mother_id' : mother.get_gramps_id()}
|
||||
elif f_handle or m_handle:
|
||||
if f_handle:
|
||||
p_handle = f_handle
|
||||
else:
|
||||
p_handle = m_handle
|
||||
person = self.database.get_person_from_handle(p_handle)
|
||||
person = self._db.get_person_from_handle(p_handle)
|
||||
|
||||
nameEntry = "%s (%s)" % \
|
||||
(self._nd.display(person),
|
||||
person.get_gramps_id())
|
||||
name_entry = "%s (%s)" % (self._nd.display(person),
|
||||
person.get_gramps_id())
|
||||
else:
|
||||
# No parents - bug #7299
|
||||
continue
|
||||
|
||||
if nameEntry in person_dict:
|
||||
person_dict[nameEntry].append(evt_handle)
|
||||
if name_entry in person_dict:
|
||||
person_dict[name_entry].append(evt_handle)
|
||||
else:
|
||||
person_dict[nameEntry] = []
|
||||
person_dict[nameEntry].append(evt_handle)
|
||||
person_dict[name_entry] = []
|
||||
person_dict[name_entry].append(evt_handle)
|
||||
|
||||
keys = list(person_dict.keys())
|
||||
keys.sort()
|
||||
@ -353,7 +354,7 @@ class PlaceReport(Report):
|
||||
people = entry
|
||||
person_dict[entry].sort(key=self.sort.by_date_key)
|
||||
for evt_handle in person_dict[entry]:
|
||||
event = self.database.get_event_from_handle(evt_handle)
|
||||
event = self._db.get_event_from_handle(evt_handle)
|
||||
if event:
|
||||
date = self._get_date(event.get_date_object())
|
||||
descr = event.get_description()
|
||||
@ -382,7 +383,7 @@ class PlaceReport(Report):
|
||||
"""
|
||||
place_handles = []
|
||||
for place_gid in places.split():
|
||||
place = self.database.get_place_from_gramps_id(place_gid)
|
||||
place = self._db.get_place_from_gramps_id(place_gid)
|
||||
if place is not None:
|
||||
#place can be None if option is gid of other fam tree
|
||||
place_handles.append(place.get_handle())
|
||||
@ -432,9 +433,7 @@ class PlaceOptions(MenuReportOptions):
|
||||
stdoptions.add_name_format_option(menu, category_name)
|
||||
|
||||
center = EnumeratedListOption(_("Center on"), "Event")
|
||||
center.set_items([
|
||||
("Event", _("Event")),
|
||||
("Person", _("Person"))])
|
||||
center.set_items([("Event", _("Event")), ("Person", _("Person"))])
|
||||
center.set_help(_("If report is event or person centered"))
|
||||
menu.add_option(category_name, "center", center)
|
||||
|
||||
|
@ -21,6 +21,8 @@
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
|
||||
""" Records Report """
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# Standard Python modules
|
||||
@ -57,6 +59,7 @@ from gramps.gen.proxy import LivingProxyDb, CacheProxyDb
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
class RecordsReport(Report):
|
||||
""" Records Report """
|
||||
|
||||
def __init__(self, database, options, user):
|
||||
"""
|
||||
@ -84,8 +87,8 @@ class RecordsReport(Report):
|
||||
if value == self._lv:
|
||||
living_desc = self._(description)
|
||||
break
|
||||
self.living_desc = self._("(Living people: %(option_name)s)"
|
||||
% {'option_name': living_desc})
|
||||
self.living_desc = self._(
|
||||
"(Living people: %(option_name)s)") % {'option_name': living_desc}
|
||||
|
||||
filter_option = menu.get_option_by_name('filter')
|
||||
self.filter = filter_option.get_filter()
|
||||
@ -155,18 +158,19 @@ class RecordsReport(Report):
|
||||
mom = self.database.get_person_from_handle(m_handle)
|
||||
m_mark = ReportUtils.get_person_mark(self.database, mom)
|
||||
else:
|
||||
raise ReportError(_("Option '%(opt_name)s' is present "
|
||||
"in %(file)s\n but is not known to "
|
||||
"the module. Ignoring...") %
|
||||
{'opt_name': handletype,
|
||||
'file': 'libnarrate.py'})
|
||||
raise ReportError(_(
|
||||
"Option '%(opt_name)s' is present "
|
||||
"in %(file)s\n but is not known to "
|
||||
"the module. Ignoring...")
|
||||
% {'opt_name': handletype,
|
||||
'file': 'libnarrate.py'})
|
||||
# since the error is very unlikely I reused the string
|
||||
if value != last_value:
|
||||
last_value = value
|
||||
rank = number
|
||||
self.doc.start_paragraph('REC-Normal')
|
||||
self.doc.write_text(self._("%(number)s. ")
|
||||
% {'number': rank+1})
|
||||
self.doc.write_text(
|
||||
self._("%(number)s. ") % {'number': rank+1})
|
||||
self.doc.write_markup(str(name), name.get_tags(), mark)
|
||||
if handletype == 'Family':
|
||||
self.doc.write_text('', f_mark)
|
||||
@ -198,6 +202,7 @@ class RecordsReportOptions(MenuReportOptions):
|
||||
self.__pid = None
|
||||
self.__filter = None
|
||||
self.__db = dbase
|
||||
self._nf = None
|
||||
MenuReportOptions.__init__(self, name, dbase)
|
||||
|
||||
|
||||
@ -207,7 +212,7 @@ class RecordsReportOptions(MenuReportOptions):
|
||||
|
||||
self.__filter = FilterOption(_("Filter"), 0)
|
||||
self.__filter.set_help(
|
||||
_("Determines what people are included in the report."))
|
||||
_("Determines what people are included in the report."))
|
||||
menu.add_option(category_name, "filter", self.__filter)
|
||||
self.__filter.connect('value-changed', self.__filter_changed)
|
||||
|
||||
@ -232,7 +237,9 @@ class RecordsReportOptions(MenuReportOptions):
|
||||
callname.set_items([
|
||||
(CALLNAME_DONTUSE, _("Don't use call name")),
|
||||
(CALLNAME_REPLACE, _("Replace first names with call name")),
|
||||
(CALLNAME_UNDERLINE_ADD, _("Underline call name in first names / add call name to first name"))])
|
||||
(CALLNAME_UNDERLINE_ADD,
|
||||
_("Underline call name in first names / "
|
||||
"add call name to first name"))])
|
||||
menu.add_option(category_name, "callname", callname)
|
||||
|
||||
footer = StringOption(_("Footer text"), "")
|
||||
|
@ -20,6 +20,8 @@
|
||||
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
||||
#
|
||||
|
||||
""" Simple Book Title for the book report """
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# python modules
|
||||
@ -49,6 +51,7 @@ from gramps.gen.plug.docgen import (FontStyle, ParagraphStyle,
|
||||
#------------------------------------------------------------------------
|
||||
class SimpleBookTitle(Report):
|
||||
""" This report class generates a title page for a book. """
|
||||
|
||||
def __init__(self, database, options, user):
|
||||
"""
|
||||
Create SimpleBookTitle object that produces the report.
|
||||
@ -95,11 +98,10 @@ class SimpleBookTitle(Report):
|
||||
if self.image_size:
|
||||
image_size = self.image_size
|
||||
else:
|
||||
image_size = min(
|
||||
0.8 * self.doc.get_usable_width(),
|
||||
0.7 * self.doc.get_usable_height() )
|
||||
image_size = min(0.8 * self.doc.get_usable_width(),
|
||||
0.7 * self.doc.get_usable_height())
|
||||
self.doc.add_media(filename, 'center',
|
||||
image_size, image_size)
|
||||
image_size, image_size)
|
||||
else:
|
||||
self._user.warn(_('Could not add photo to page'),
|
||||
_('File %s does not exist') % filename)
|
||||
@ -127,24 +129,25 @@ class SimpleBookTitleOptions(MenuReportOptions):
|
||||
""" Add the options for this report """
|
||||
category_name = _("Report Options")
|
||||
|
||||
title = StringOption(_('book|Title'), _('Title of the Book') )
|
||||
title = StringOption(_('book|Title'), _('Title of the Book'))
|
||||
title.set_help(_("Title string for the book."))
|
||||
menu.add_option(category_name, "title", title)
|
||||
|
||||
subtitle = StringOption(_('Subtitle'), _('Subtitle of the Book') )
|
||||
subtitle = StringOption(_('Subtitle'), _('Subtitle of the Book'))
|
||||
subtitle.set_help(_("Subtitle string for the book."))
|
||||
menu.add_option(category_name, "subtitle", subtitle)
|
||||
|
||||
dateinfo = time.localtime(time.time())
|
||||
rname = self.__db.get_researcher().get_name()
|
||||
footer_string = _('Copyright %(year)d %(name)s') % {
|
||||
'year' : dateinfo[0], 'name' : rname }
|
||||
footer = StringOption(_('Footer'), footer_string )
|
||||
'year' : dateinfo[0], 'name' : rname}
|
||||
footer = StringOption(_('Footer'), footer_string)
|
||||
footer.set_help(_("Footer string for the page."))
|
||||
menu.add_option(category_name, "footer", footer)
|
||||
|
||||
imgid = MediaOption(_('Image'))
|
||||
imgid.set_help( _("Gramps ID of the media object to use as an image."))
|
||||
imgid.set_help(
|
||||
_("Gramps ID of the media object to use as an image."))
|
||||
menu.add_option(category_name, "imgid", imgid)
|
||||
|
||||
imgsize = NumberOption(_('Image Size'), 0, 0, 20, 0.1)
|
||||
|
@ -60,6 +60,7 @@ from gramps.gen.proxy import LivingProxyDb, CacheProxyDb
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
class TagReport(Report):
|
||||
""" Tag Report """
|
||||
|
||||
def __init__(self, database, options, user):
|
||||
"""
|
||||
@ -95,12 +96,13 @@ class TagReport(Report):
|
||||
if value == self._lv:
|
||||
living_desc = self._(description)
|
||||
break
|
||||
self.living_desc = self._("(Living people: %(option_name)s)"
|
||||
% {'option_name': living_desc})
|
||||
self.living_desc = self._(
|
||||
"(Living people: %(option_name)s)") % {'option_name': living_desc}
|
||||
|
||||
self.tag = menu.get_option_by_name('tag').get_value()
|
||||
if not self.tag:
|
||||
raise ReportError(_('Tag Report'),
|
||||
raise ReportError(
|
||||
_('Tag Report'),
|
||||
_('You must first create a tag before running this report.'))
|
||||
|
||||
stdoptions.run_name_format_option(self, menu)
|
||||
@ -128,11 +130,12 @@ class TagReport(Report):
|
||||
self.write_citations()
|
||||
|
||||
def write_people(self):
|
||||
""" write the people associated with the tag """
|
||||
plist = self.database.iter_person_handles()
|
||||
FilterClass = GenericFilterFactory('Person')
|
||||
filter = FilterClass()
|
||||
filter.add_rule(rules.person.HasTag([self.tag]))
|
||||
ind_list = filter.apply(self.database, plist)
|
||||
filter_class = GenericFilterFactory('Person')
|
||||
a_filter = filter_class()
|
||||
a_filter.add_rule(rules.person.HasTag([self.tag]))
|
||||
ind_list = a_filter.apply(self.database, plist)
|
||||
|
||||
if not ind_list:
|
||||
return
|
||||
@ -143,7 +146,7 @@ class TagReport(Report):
|
||||
self.doc.write_text(header, mark)
|
||||
self.doc.end_paragraph()
|
||||
|
||||
self.doc.start_table('PeopleTable','TR-Table')
|
||||
self.doc.start_table('PeopleTable', 'TR-Table')
|
||||
|
||||
self.doc.start_row()
|
||||
|
||||
@ -197,7 +200,7 @@ class TagReport(Report):
|
||||
birth_ref = person.get_birth_ref()
|
||||
if birth_ref:
|
||||
event = self.database.get_event_from_handle(birth_ref.ref)
|
||||
self.doc.write_text(get_date( event ))
|
||||
self.doc.write_text(get_date(event))
|
||||
self.doc.end_paragraph()
|
||||
self.doc.end_cell()
|
||||
|
||||
@ -206,7 +209,7 @@ class TagReport(Report):
|
||||
death_ref = person.get_death_ref()
|
||||
if death_ref:
|
||||
event = self.database.get_event_from_handle(death_ref.ref)
|
||||
self.doc.write_text(get_date( event ))
|
||||
self.doc.write_text(get_date(event))
|
||||
self.doc.end_paragraph()
|
||||
self.doc.end_cell()
|
||||
|
||||
@ -215,22 +218,23 @@ class TagReport(Report):
|
||||
self.doc.end_table()
|
||||
|
||||
def write_families(self):
|
||||
""" write the families associated with the tag """
|
||||
flist = self.database.iter_family_handles()
|
||||
FilterClass = GenericFilterFactory('Family')
|
||||
filter = FilterClass()
|
||||
filter.add_rule(rules.family.HasTag([self.tag]))
|
||||
fam_list = filter.apply(self.database, flist)
|
||||
filter_class = GenericFilterFactory('Family')
|
||||
a_filter = filter_class()
|
||||
a_filter.add_rule(rules.family.HasTag([self.tag]))
|
||||
fam_list = a_filter.apply(self.database, flist)
|
||||
|
||||
if not fam_list:
|
||||
return
|
||||
|
||||
self.doc.start_paragraph("TR-Heading")
|
||||
header = self._("Families")
|
||||
mark = IndexMark(header,INDEX_TYPE_TOC, 2)
|
||||
mark = IndexMark(header, INDEX_TYPE_TOC, 2)
|
||||
self.doc.write_text(header, mark)
|
||||
self.doc.end_paragraph()
|
||||
|
||||
self.doc.start_table('FamilyTable','TR-Table')
|
||||
self.doc.start_table('FamilyTable', 'TR-Table')
|
||||
|
||||
self.doc.start_row()
|
||||
|
||||
@ -294,7 +298,7 @@ class TagReport(Report):
|
||||
self.doc.start_cell('TR-TableCell')
|
||||
self.doc.start_paragraph('TR-Normal')
|
||||
relation = family.get_relationship()
|
||||
self.doc.write_text(str(relation) )
|
||||
self.doc.write_text(str(relation))
|
||||
self.doc.end_paragraph()
|
||||
self.doc.end_cell()
|
||||
|
||||
@ -303,11 +307,12 @@ class TagReport(Report):
|
||||
self.doc.end_table()
|
||||
|
||||
def write_events(self):
|
||||
""" write the events associated with the tag """
|
||||
elist = self.database.get_event_handles()
|
||||
FilterClass = GenericFilterFactory('Event')
|
||||
filter = FilterClass()
|
||||
filter.add_rule(rules.event.HasTag([self.tag]))
|
||||
event_list = filter.apply(self.database, elist)
|
||||
filter_class = GenericFilterFactory('Event')
|
||||
a_filter = filter_class()
|
||||
a_filter.add_rule(rules.event.HasTag([self.tag]))
|
||||
event_list = a_filter.apply(self.database, elist)
|
||||
|
||||
if not event_list:
|
||||
return
|
||||
@ -318,7 +323,7 @@ class TagReport(Report):
|
||||
self.doc.write_text(header, mark)
|
||||
self.doc.end_paragraph()
|
||||
|
||||
self.doc.start_table('EventTable','TR-Table')
|
||||
self.doc.start_table('EventTable', 'TR-Table')
|
||||
|
||||
self.doc.start_row()
|
||||
|
||||
@ -385,11 +390,12 @@ class TagReport(Report):
|
||||
self.doc.end_table()
|
||||
|
||||
def write_places(self):
|
||||
""" write the places associated with the tag """
|
||||
plist = self.database.get_place_handles()
|
||||
FilterClass = GenericFilterFactory('Place')
|
||||
filter = FilterClass()
|
||||
filter.add_rule(rules.place.HasTag([self.tag]))
|
||||
place_list = filter.apply(self.database, plist)
|
||||
filter_class = GenericFilterFactory('Place')
|
||||
a_filter = filter_class()
|
||||
a_filter.add_rule(rules.place.HasTag([self.tag]))
|
||||
place_list = a_filter.apply(self.database, plist)
|
||||
|
||||
if not place_list:
|
||||
return
|
||||
@ -400,7 +406,7 @@ class TagReport(Report):
|
||||
self.doc.write_text(header, mark)
|
||||
self.doc.end_paragraph()
|
||||
|
||||
self.doc.start_table('PlaceTable','TR-Table')
|
||||
self.doc.start_table('PlaceTable', 'TR-Table')
|
||||
|
||||
self.doc.start_row()
|
||||
|
||||
@ -465,11 +471,12 @@ class TagReport(Report):
|
||||
self.doc.end_table()
|
||||
|
||||
def write_notes(self):
|
||||
""" write the notes associated with the tag """
|
||||
nlist = self.database.get_note_handles()
|
||||
FilterClass = GenericFilterFactory('Note')
|
||||
filter = FilterClass()
|
||||
filter.add_rule(rules.note.HasTag([self.tag]))
|
||||
note_list = filter.apply(self.database, nlist)
|
||||
filter_class = GenericFilterFactory('Note')
|
||||
a_filter = filter_class()
|
||||
a_filter.add_rule(rules.note.HasTag([self.tag]))
|
||||
note_list = a_filter.apply(self.database, nlist)
|
||||
|
||||
if not note_list:
|
||||
return
|
||||
@ -477,10 +484,10 @@ class TagReport(Report):
|
||||
self.doc.start_paragraph("TR-Heading")
|
||||
header = self._("Notes")
|
||||
mark = IndexMark(header, INDEX_TYPE_TOC, 2)
|
||||
self.doc.write_text(header ,mark)
|
||||
self.doc.write_text(header, mark)
|
||||
self.doc.end_paragraph()
|
||||
|
||||
self.doc.start_table('NoteTable','TR-Table')
|
||||
self.doc.start_table('NoteTable', 'TR-Table')
|
||||
|
||||
self.doc.start_row()
|
||||
|
||||
@ -517,17 +524,15 @@ class TagReport(Report):
|
||||
|
||||
self.doc.start_cell('TR-TableCell')
|
||||
self.doc.start_paragraph('TR-Normal')
|
||||
type = note.get_type()
|
||||
self.doc.write_text(str(type))
|
||||
note_type = note.get_type()
|
||||
self.doc.write_text(str(note_type))
|
||||
self.doc.end_paragraph()
|
||||
self.doc.end_cell()
|
||||
|
||||
self.doc.start_cell('TR-TableCell', 2)
|
||||
self.doc.write_styled_note(note.get_styledtext(),
|
||||
note.get_format(), 'TR-Note',
|
||||
contains_html = (note.get_type()
|
||||
== NoteType.HTML_CODE)
|
||||
)
|
||||
self.doc.write_styled_note(
|
||||
note.get_styledtext(), note.get_format(), 'TR-Note',
|
||||
contains_html=((note.get_type() == NoteType.HTML_CODE)))
|
||||
self.doc.end_cell()
|
||||
|
||||
self.doc.end_row()
|
||||
@ -535,11 +540,12 @@ class TagReport(Report):
|
||||
self.doc.end_table()
|
||||
|
||||
def write_media(self):
|
||||
""" write the media associated with the tag """
|
||||
mlist = self.database.get_media_handles(sort_handles=True)
|
||||
FilterClass = GenericFilterFactory('Media')
|
||||
filter = FilterClass()
|
||||
filter.add_rule(rules.media.HasTag([self.tag]))
|
||||
media_list = filter.apply(self.database, mlist)
|
||||
filter_class = GenericFilterFactory('Media')
|
||||
a_filter = filter_class()
|
||||
a_filter.add_rule(rules.media.HasTag([self.tag]))
|
||||
media_list = a_filter.apply(self.database, mlist)
|
||||
|
||||
if not media_list:
|
||||
return
|
||||
@ -547,10 +553,10 @@ class TagReport(Report):
|
||||
self.doc.start_paragraph("TR-Heading")
|
||||
header = self._("Media")
|
||||
mark = IndexMark(header, INDEX_TYPE_TOC, 2)
|
||||
self.doc.write_text(header ,mark)
|
||||
self.doc.write_text(header, mark)
|
||||
self.doc.end_paragraph()
|
||||
|
||||
self.doc.start_table('MediaTable','TR-Table')
|
||||
self.doc.start_table('MediaTable', 'TR-Table')
|
||||
|
||||
self.doc.start_row()
|
||||
|
||||
@ -618,11 +624,12 @@ class TagReport(Report):
|
||||
self.doc.end_table()
|
||||
|
||||
def write_repositories(self):
|
||||
""" write the repositories associated with the tag """
|
||||
rlist = self.database.get_repository_handles()
|
||||
FilterClass = GenericFilterFactory('Repository')
|
||||
filter = FilterClass()
|
||||
filter.add_rule(rules.repository.HasTag([self.tag]))
|
||||
repo_list = filter.apply(self.database, rlist)
|
||||
filter_class = GenericFilterFactory('Repository')
|
||||
a_filter = filter_class()
|
||||
a_filter.add_rule(rules.repository.HasTag([self.tag]))
|
||||
repo_list = a_filter.apply(self.database, rlist)
|
||||
|
||||
if not repo_list:
|
||||
return
|
||||
@ -630,10 +637,10 @@ class TagReport(Report):
|
||||
self.doc.start_paragraph("TR-Heading")
|
||||
header = self._("Repositories")
|
||||
mark = IndexMark(header, INDEX_TYPE_TOC, 2)
|
||||
self.doc.write_text(header ,mark)
|
||||
self.doc.write_text(header, mark)
|
||||
self.doc.end_paragraph()
|
||||
|
||||
self.doc.start_table('ReopTable','TR-Table')
|
||||
self.doc.start_table('ReopTable', 'TR-Table')
|
||||
|
||||
self.doc.start_row()
|
||||
|
||||
@ -702,11 +709,12 @@ class TagReport(Report):
|
||||
self.doc.end_table()
|
||||
|
||||
def write_sources(self):
|
||||
""" write the sources associated with the tag """
|
||||
slist = self.database.get_source_handles(sort_handles=True)
|
||||
FilterClass = GenericFilterFactory('Source')
|
||||
filter = FilterClass()
|
||||
filter.add_rule(rules.source.HasTag([self.tag]))
|
||||
source_list = filter.apply(self.database, slist)
|
||||
filter_class = GenericFilterFactory('Source')
|
||||
a_filter = filter_class()
|
||||
a_filter.add_rule(rules.source.HasTag([self.tag]))
|
||||
source_list = a_filter.apply(self.database, slist)
|
||||
|
||||
if not source_list:
|
||||
return
|
||||
@ -714,10 +722,10 @@ class TagReport(Report):
|
||||
self.doc.start_paragraph("TR-Heading")
|
||||
header = self._("Source")
|
||||
mark = IndexMark(header, INDEX_TYPE_TOC, 2)
|
||||
self.doc.write_text(header ,mark)
|
||||
self.doc.write_text(header, mark)
|
||||
self.doc.end_paragraph()
|
||||
|
||||
self.doc.start_table('SourceTable','TR-Table')
|
||||
self.doc.start_table('SourceTable', 'TR-Table')
|
||||
|
||||
self.doc.start_row()
|
||||
|
||||
@ -781,11 +789,12 @@ class TagReport(Report):
|
||||
self.doc.end_table()
|
||||
|
||||
def write_citations(self):
|
||||
""" write the citations associated with the tag """
|
||||
clist = self.database.get_citation_handles(sort_handles=True)
|
||||
FilterClass = GenericFilterFactory('Citation')
|
||||
filter = FilterClass()
|
||||
filter.add_rule(rules.citation.HasTag([self.tag]))
|
||||
citation_list = filter.apply(self.database, clist)
|
||||
filter_class = GenericFilterFactory('Citation')
|
||||
a_filter = filter_class()
|
||||
a_filter.add_rule(rules.citation.HasTag([self.tag]))
|
||||
citation_list = a_filter.apply(self.database, clist)
|
||||
|
||||
if not citation_list:
|
||||
return
|
||||
@ -793,10 +802,10 @@ class TagReport(Report):
|
||||
self.doc.start_paragraph("TR-Heading")
|
||||
header = self._("Citations")
|
||||
mark = IndexMark(header, INDEX_TYPE_TOC, 2)
|
||||
self.doc.write_text(header ,mark)
|
||||
self.doc.write_text(header, mark)
|
||||
self.doc.end_paragraph()
|
||||
|
||||
self.doc.start_table('CitationTable','TR-Table')
|
||||
self.doc.start_table('CitationTable', 'TR-Table')
|
||||
|
||||
self.doc.start_row()
|
||||
|
||||
@ -869,6 +878,7 @@ class TagReport(Report):
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
class TagOptions(MenuReportOptions):
|
||||
""" Options for the Tag Report """
|
||||
|
||||
def __init__(self, name, dbase):
|
||||
self.__db = dbase
|
||||
@ -893,7 +903,7 @@ class TagOptions(MenuReportOptions):
|
||||
tag_option = EnumeratedListOption(_('Tag'), '')
|
||||
tag_option.add_item('', '')
|
||||
|
||||
tag_option.set_help( _("The tag to use for the report"))
|
||||
tag_option.set_help(_("The tag to use for the report"))
|
||||
menu.add_option(category_name, "tag", tag_option)
|
||||
|
||||
stdoptions.add_name_format_option(menu, category_name)
|
||||
@ -904,21 +914,21 @@ class TagOptions(MenuReportOptions):
|
||||
|
||||
stdoptions.add_localization_option(menu, category_name)
|
||||
|
||||
def make_default_style(self,default_style):
|
||||
def make_default_style(self, default_style):
|
||||
"""Make the default output style for the Tag 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_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("TR-Title", p)
|
||||
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_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("TR-Title", para)
|
||||
|
||||
font = FontStyle()
|
||||
font.set(face=FONT_SANS_SERIF, size=12, bold=1)
|
||||
@ -943,31 +953,31 @@ class TagOptions(MenuReportOptions):
|
||||
|
||||
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("TR-Normal", p)
|
||||
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("TR-Normal", para)
|
||||
|
||||
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("TR-Normal-Bold", p)
|
||||
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 table headings.'))
|
||||
default_style.add_paragraph_style("TR-Normal-Bold", para)
|
||||
|
||||
para = ParagraphStyle()
|
||||
p.set(first_indent=-0.75, lmargin=.75)
|
||||
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)
|
||||
default_style.add_paragraph_style("TR-Note", para)
|
||||
|
||||
#Table Styles
|
||||
cell = TableCellStyle()
|
||||
@ -980,4 +990,4 @@ class TagOptions(MenuReportOptions):
|
||||
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)
|
||||
default_style.add_table_style('TR-Table', table)
|
||||
|
Loading…
Reference in New Issue
Block a user