本文整理汇总了Python中gramps.gen.proxy.CacheProxyDb类的典型用法代码示例。如果您正苦于以下问题:Python CacheProxyDb类的具体用法?Python CacheProxyDb怎么用?Python CacheProxyDb使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了CacheProxyDb类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
def __init__(self, database, options, user):
"""
Create the FanChart object that produces the report.
The arguments are:
database - the GRAMPS database instance
options - instance of the Options class for this report
user - a gen.user.User instance
This report needs the following parameters (class variables)
that come in the options class.
maxgen - Maximum number of generations to include.
circle - Draw a full circle, half circle, or quarter circle.
background - Background color is generation dependent or white.
radial - Print radial texts roundabout or as upright as possible.
draw_empty - draw background when there is no information
same_style - use the same style for all generation
incl_private - Whether to include private data
living_people - How to handle living people
years_past_death - Consider as living this many years after death
"""
Report.__init__(self, database, options, user)
menu = options.menu
lang = options.menu.get_option_by_name("trans").get_value()
rlocale = self.set_locale(lang)
stdoptions.run_private_data_option(self, menu)
stdoptions.run_living_people_option(self, menu, rlocale)
self.database = CacheProxyDb(self.database)
self.max_generations = menu.get_option_by_name("maxgen").get_value()
self.circle = menu.get_option_by_name("circle").get_value()
self.background = menu.get_option_by_name("background").get_value()
self.radial = menu.get_option_by_name("radial").get_value()
pid = menu.get_option_by_name("pid").get_value()
self.draw_empty = menu.get_option_by_name("draw_empty").get_value()
self.same_style = menu.get_option_by_name("same_style").get_value()
self.center_person = self.database.get_person_from_gramps_id(pid)
if self.center_person is None:
raise ReportError(_("Person %s is not in the Database") % pid)
self.graphic_style = []
self.text_style = []
for i in range(0, self.max_generations):
self.graphic_style.append("FC-Graphic" + "%02d" % i)
self.text_style.append("FC-Text" + "%02d" % i)
self.calendar = 0
self.height = 0
self.map = [None] * 2 ** self.max_generations
self.text = {}
示例2: __init__
def __init__(self, database, options, user):
"""
Create the DescendantReport object that produces the report.
The arguments are:
database - the GRAMPS database instance
options - instance of the Options class for this report
user - a gen.user.User() instance
This report needs the following parameters (class variables)
that come in the options class.
gen - Maximum number of generations to include.
name_format - Preferred format to display names
dups - Whether to include duplicate descendant trees
incl_private - Whether to include private data
living_people - How to handle living people
years_past_death - Consider as living this many years after death
"""
Report.__init__(self, database, options, user)
menu = options.menu
lang = menu.get_option_by_name('trans').get_value()
self._locale = self.set_locale(lang)
stdoptions.run_private_data_option(self, menu)
stdoptions.run_living_people_option(self, menu, self._locale)
self.database = CacheProxyDb(self.database)
self.max_generations = menu.get_option_by_name('gen').get_value()
pid = menu.get_option_by_name('pid').get_value()
self.center_person = self.database.get_person_from_gramps_id(pid)
if self.center_person is None:
raise ReportError(_("Person %s is not in the Database") % pid)
#Initialize the Printinfo class
self._showdups = menu.get_option_by_name('dups').get_value()
numbering = menu.get_option_by_name('numbering').get_value()
if numbering == "Simple":
obj = PrintSimple(self._showdups)
elif numbering == "de Villiers/Pama":
obj = PrintVilliers()
elif numbering == "Meurgey de Tupigny":
obj = PrintMeurgey()
else:
raise AttributeError("no such numbering: '%s'" % numbering)
marrs = menu.get_option_by_name('marrs').get_value()
divs = menu.get_option_by_name('divs').get_value()
stdoptions.run_name_format_option(self, menu)
self.obj_print = Printinfo(self.doc, self.database, obj, marrs, divs,
self._name_display, self._locale)
示例3: __init__
def __init__(self, database, options, user):
"""
Create the FamilyGroup object that produces the report.
The arguments are:
database - the Gramps database instance
options - instance of the Options class for this report
user - a gen.user.User() instance
This report needs the following parameters (class variables)
that come in the options class.
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.
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
years_past_death - Consider as living this many years after death
"""
Report.__init__(self, database, options, user)
self._user = user
menu = options.menu
self.set_locale(menu.get_option_by_name('trans').get_value())
self._ = self._locale.translation.sgettext # needed for English
stdoptions.run_date_format_option(self, menu)
stdoptions.run_private_data_option(self, menu)
stdoptions.run_living_people_option(self, menu, self._locale)
self.database = CacheProxyDb(self.database)
self.db = self.database
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('inc_id')
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)
self.place_format = menu.get_option_by_name("place_format").get_value()
示例4: __init__
def __init__(self, database, options, user):
"""
Create the KinshipReport object that produces the report.
The arguments are:
database - the Gramps database instance
options - instance of the Options class for this report
user - a gen.user.User() instance
This report needs the following parameters (class variables)
that come in the options class.
maxdescend - Maximum generations of descendants to include.
maxascend - Maximum generations of ancestors to include.
incspouses - Whether to include spouses.
inccousins - Whether to include cousins.
incaunts - Whether to include aunts/uncles/nephews/nieces.
pid - The Gramps ID of the center person for the report.
name_format - Preferred format to display names
incl_private - Whether to include private data
living_people - How to handle living people
years_past_death - Consider as living this many years after death
"""
Report.__init__(self, database, options, user)
menu = options.menu
self.set_locale(menu.get_option_by_name('trans').get_value())
stdoptions.run_date_format_option(self, menu)
stdoptions.run_private_data_option(self, menu)
stdoptions.run_living_people_option(self, menu, self._locale)
self.database = CacheProxyDb(self.database)
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.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.person = self.database.get_person_from_gramps_id(pid)
if self.person is None:
raise ReportError(_("Person %s is not in the Database") % pid)
stdoptions.run_name_format_option(self, menu)
self.rel_calc = get_relationship_calculator(reinit=True,
clocale=self._locale)
self.kinship_map = {}
self.spouse_map = {}
示例5: __init__
def __init__(self, database, options, user):
"""
Create the Timeline object that produces the report.
The arguments are:
database - the GRAMPS database instance
options - instance of the Options class for this report
user - instance of gen.user.User()
This report needs the following parameters (class variables)
that come in the options class.
filter - Filter to be applied to the people of the database.
The option class carries its number, and the function
returning the list of filters.
sortby - Sorting method to be used.
name_format - Preferred format to display names
incl_private - Whether to include private data
living_people - How to handle living people
years_past_death - Consider as living this many years after death
"""
Report.__init__(self, database, options, user)
self._user = user
menu = options.menu
lang = options.menu.get_option_by_name('trans').get_value()
rlocale = self.set_locale(lang)
stdoptions.run_private_data_option(self, menu)
living_opt = stdoptions.run_living_people_option(self, menu, rlocale)
self.database = CacheProxyDb(self.database)
self.filter = menu.get_option_by_name('filter').get_filter()
self.fil_name = "(%s)" % self.filter.get_name(rlocale)
living_value = menu.get_option_by_name('living_people').get_value()
for (value, description) in living_opt.get_items(xml_items=True):
if value == living_value:
living_desc = self._(description)
break
self.living_desc = self._(
"(Living people: %(option_name)s)") % {'option_name': living_desc}
stdoptions.run_name_format_option(self, menu)
sort_func_num = menu.get_option_by_name('sortby').get_value()
sort_functions = _get_sort_functions(Sort(self.database))
self.sort_name = self._(sort_functions[sort_func_num][0])
self.sort_func = sort_functions[sort_func_num][1]
self.calendar = config.get('preferences.calendar-format-report')
self.plist = []
self.header = 2.6
示例6: __init__
def __init__(self, database, options, user):
"""
Create the EndOfLineReport object that produces the report.
The arguments are:
database - the Gramps database instance
options - instance of the Options class for this report
user - a gen.user.User() instance
This report needs the following parameters (class variables)
that come in the options class.
name_format - Preferred format to display names
incl_private - Whether to include private data
living_people - How to handle living people
years_past_death - Consider as living this many years after death
"""
Report.__init__(self, database, options, user)
menu = options.menu
self.set_locale(menu.get_option_by_name('trans').get_value())
stdoptions.run_date_format_option(self, menu)
stdoptions.run_private_data_option(self, menu)
stdoptions.run_living_people_option(self, menu, self._locale)
self.database = CacheProxyDb(self.database)
pid = menu.get_option_by_name('pid').get_value()
self.center_person = self.database.get_person_from_gramps_id(pid)
if self.center_person is None:
raise ReportError(_("Person %s is not in the Database") % pid)
stdoptions.run_name_format_option(self, menu)
# eol_map is a map whose:
# keys are the generations of the people
# values are a map whose:
# keys are person handles
# values are an array whose:
# elements are an array of ancestor person handles that link
# the eol person handle to the person or interest
# eol_map[generation][person_handle][pedigree_idx][ancestor_handle_idx]
#
# There is an array of pedigrees because one person could show up twice
# in one generation (descendants marrying). Most people only have one
# pedigree.
#
# eol_map is populated by get_eol() which calls itself recursively.
self.eol_map = {}
self.get_eol(self.center_person, 1, [])
示例7: __init__
def __init__(self, database, options, user):
"""
Create the AncestorReport object that produces the Ahnentafel report.
The arguments are:
database - the Gramps database instance
options - instance of the Options class for this report
user - a gen.user.User() instance
This report needs the following parameters (class variables)
that come in the options class.
gen - Maximum number of generations to include.
pagebbg - Whether to include page breaks between generations.
name_format - Preferred format to display names
incl_private - Whether to include private data
namebrk - Whether a line break should follow the name
inc_id - Whether to include Gramps IDs
living_people - How to handle living people
years_past_death - Consider as living this many years after death
"""
Report.__init__(self, database, options, user)
self.map = {}
menu = options.menu
self.set_locale(menu.get_option_by_name('trans').get_value())
stdoptions.run_date_format_option(self, menu)
stdoptions.run_private_data_option(self, menu)
stdoptions.run_living_people_option(self, menu, self._locale)
self.database = CacheProxyDb(self.database)
self.max_generations = menu.get_option_by_name('maxgen').get_value()
self.pgbrk = menu.get_option_by_name('pagebbg').get_value()
self.opt_namebrk = menu.get_option_by_name('namebrk').get_value()
self.want_ids = menu.get_option_by_name('inc_id').get_value()
pid = menu.get_option_by_name('pid').get_value()
self.center_person = self.database.get_person_from_gramps_id(pid)
if self.center_person is None:
raise ReportError(_("Person %s is not in the Database") % pid)
stdoptions.run_name_format_option(self, menu)
self.__narrator = Narrator(self.database, use_fulldate=True,
nlocale=self._locale)
示例8: __init__
def __init__(self, database, options, user):
"""
Create the TagReport object that produces the report.
The arguments are:
database - the Gramps database instance
options - instance of the Options class for this report
user - a gen.user.User() instance
This report needs the following parameters (class variables)
that come in the options class.
tag - The tag each object must match to be included.
name_format - Preferred format to display names of people
incl_private - Whether to include private data
living_people - How to handle living people
years_past_death - Consider as living this many years after death
"""
Report.__init__(self, database, options, user)
menu = options.menu
self.set_locale(menu.get_option_by_name('trans').get_value())
stdoptions.run_date_format_option(self, menu)
stdoptions.run_private_data_option(self, menu)
living_opt = stdoptions.run_living_people_option(self, menu,
self._locale)
self.database = CacheProxyDb(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.tag = menu.get_option_by_name('tag').get_value()
if not self.tag:
raise ReportError(
_('Tag Report'),
_('You must first create a tag before running this report.'))
stdoptions.run_name_format_option(self, menu)
self.place_format = menu.get_option_by_name("place_format").get_value()
示例9: __init__
def __init__(self, database, options, user):
"""
This report needs the following parameters (class variables)
that come in the options class.
incl_private - Whether to include private data
living_people - How to handle living people
years_past_death - Consider as living this many years after death
"""
Report.__init__(self, database, options, user)
menu = options.menu
lang = options.menu.get_option_by_name('trans').get_value()
self._locale = self.set_locale(lang)
stdoptions.run_private_data_option(self, menu)
living_opt = stdoptions.run_living_people_option(self, menu,
self._locale)
self.database = CacheProxyDb(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}
filter_option = menu.get_option_by_name('filter')
self.filter = filter_option.get_filter()
self.top_size = menu.get_option_by_name('top_size').get_value()
self.callname = menu.get_option_by_name('callname').get_value()
self.footer = menu.get_option_by_name('footer').get_value()
self.include = {}
for (text, varname, default) in RECORDS:
self.include[varname] = menu.get_option_by_name(varname).get_value()
self._nf = stdoptions.run_name_format_option(self, menu)
示例10: __init__
def __init__(self, database, options, user):
"""
Create AncestorTree object that produces the report.
The arguments are:
database - the Gramps database instance
options - instance of the Options class for this report
user - a gen.user.User() instance
"""
Report.__init__(self, database, options, user)
self.options = options
self._user = user
self.set_locale(options.menu.get_option_by_name('trans').get_value())
stdoptions.run_date_format_option(self, options.menu)
stdoptions.run_private_data_option(self, options.menu)
stdoptions.run_living_people_option(self, options.menu, self._locale)
self.database = CacheProxyDb(self.database)
stdoptions.run_name_format_option(self, options.menu)
self._nd = self._name_display
示例11: EndOfLineReport
class EndOfLineReport(Report):
""" EndOfLine Report """
def __init__(self, database, options, user):
"""
Create the EndOfLineReport object that produces the report.
The arguments are:
database - the Gramps database instance
options - instance of the Options class for this report
user - a gen.user.User() instance
This report needs the following parameters (class variables)
that come in the options class.
name_format - Preferred format to display names
incl_private - Whether to include private data
living_people - How to handle living people
years_past_death - Consider as living this many years after death
"""
Report.__init__(self, database, options, user)
menu = options.menu
self.set_locale(menu.get_option_by_name('trans').get_value())
stdoptions.run_date_format_option(self, menu)
stdoptions.run_private_data_option(self, menu)
stdoptions.run_living_people_option(self, menu, self._locale)
self.database = CacheProxyDb(self.database)
pid = menu.get_option_by_name('pid').get_value()
self.center_person = self.database.get_person_from_gramps_id(pid)
if self.center_person is None:
raise ReportError(_("Person %s is not in the Database") % pid)
stdoptions.run_name_format_option(self, menu)
# eol_map is a map whose:
# keys are the generations of the people
# values are a map whose:
# keys are person handles
# values are an array whose:
# elements are an array of ancestor person handles that link
# the eol person handle to the person or interest
# eol_map[generation][person_handle][pedigree_idx][ancestor_handle_idx]
#
# There is an array of pedigrees because one person could show up twice
# in one generation (descendants marrying). Most people only have one
# pedigree.
#
# eol_map is populated by get_eol() which calls itself recursively.
self.eol_map = {}
self.get_eol(self.center_person, 1, [])
def get_eol(self, person, gen, pedigree):
"""
Recursively find the end of the line for each person
"""
person_handle = person.get_handle()
new_pedigree = list(pedigree) + [person_handle]
person_is_eol = False
families = person.get_parent_family_handle_list()
if person_handle in pedigree:
# This is a severe error!
# It indicates a loop in ancestry: A -> B -> A
person_is_eol = True
elif not families:
person_is_eol = True
else:
for family_handle in families:
family = self.database.get_family_from_handle(family_handle)
father_handle = family.get_father_handle()
mother_handle = family.get_mother_handle()
if father_handle:
father = self.database.get_person_from_handle(father_handle)
self.get_eol(father, gen+1, new_pedigree)
if mother_handle:
mother = self.database.get_person_from_handle(mother_handle)
self.get_eol(mother, gen+1, new_pedigree)
if not father_handle or not mother_handle:
person_is_eol = True
if person_is_eol:
# This person is the end of a line
if gen not in self.eol_map:
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)
def write_report(self):
"""
The routine that actually creates the report.
At this point, the document is opened and ready for writing.
"""
pname = self._name_display.display(self.center_person)
#.........这里部分代码省略.........
示例12: DescendantReport
class DescendantReport(Report):
""" Descendant report """
def __init__(self, database, options, user):
"""
Create the DescendantReport object that produces the report.
The arguments are:
database - the Gramps database instance
options - instance of the Options class for this report
user - a gen.user.User() instance
This report needs the following parameters (class variables)
that come in the options class.
gen - Maximum number of generations to include.
name_format - Preferred format to display names
dups - Whether to include duplicate descendant trees
incl_private - Whether to include private data
living_people - How to handle living people
years_past_death - Consider as living this many years after death
inc_id - Whether to include Gramps IDs
"""
Report.__init__(self, database, options, user)
menu = options.menu
self.set_locale(menu.get_option_by_name('trans').get_value())
stdoptions.run_date_format_option(self, menu)
stdoptions.run_private_data_option(self, menu)
stdoptions.run_living_people_option(self, menu, self._locale)
self.database = CacheProxyDb(self.database)
self.max_generations = menu.get_option_by_name('gen').get_value()
self.want_ids = menu.get_option_by_name('inc_id').get_value()
pid = menu.get_option_by_name('pid').get_value()
self.center_person = self.database.get_person_from_gramps_id(pid)
if self.center_person is None:
raise ReportError(_("Person %s is not in the Database") % pid)
#Initialize the Printinfo class
self._showdups = menu.get_option_by_name('dups').get_value()
numbering = menu.get_option_by_name('numbering').get_value()
if numbering == "Simple":
obj = PrintSimple(self._showdups)
elif numbering == "Henry":
obj = PrintHenry()
elif numbering == "Modified Henry":
obj = PrintHenry(modified=True)
elif numbering == "d'Aboville":
obj = PrintDAboville()
elif numbering == "de Villiers/Pama":
obj = PrintVilliers()
elif numbering == "Meurgey de Tupigny":
obj = PrintMeurgey()
else:
raise AttributeError("no such numbering: '%s'" % numbering)
marrs = menu.get_option_by_name('marrs').get_value()
divs = menu.get_option_by_name('divs').get_value()
stdoptions.run_name_format_option(self, menu)
self.obj_print = Printinfo(self.doc, self.database, obj, marrs, divs,
self._name_display, self._locale,
self.want_ids)
def write_report(self):
self.doc.start_paragraph("DR-Title")
name = self._name_display.display(self.center_person)
# feature request 2356: avoid genitive form
title = self._("Descendants of %s") % name
mark = IndexMark(title, INDEX_TYPE_TOC, 1)
self.doc.write_text(title, mark)
self.doc.end_paragraph()
recurse = RecurseDown(self.max_generations, self.database,
self.obj_print, self._showdups, self._locale)
recurse.recurse(1, self.center_person, None)
示例13: KinshipReport
class KinshipReport(Report):
""" Kinship Report """
def __init__(self, database, options, user):
"""
Create the KinshipReport object that produces the report.
The arguments are:
database - the GRAMPS database instance
options - instance of the Options class for this report
user - a gen.user.User() instance
This report needs the following parameters (class variables)
that come in the options class.
maxdescend - Maximum generations of descendants to include.
maxascend - Maximum generations of ancestors to include.
incspouses - Whether to include spouses.
inccousins - Whether to include cousins.
incaunts - Whether to include aunts/uncles/nephews/nieces.
pid - The Gramps ID of the center person for the report.
name_format - Preferred format to display names
incl_private - Whether to include private data
living_people - How to handle living people
years_past_death - Consider as living this many years after death
"""
Report.__init__(self, database, options, user)
menu = options.menu
lang = menu.get_option_by_name('trans').get_value()
rlocale = self.set_locale(lang)
stdoptions.run_private_data_option(self, menu)
stdoptions.run_living_people_option(self, menu, rlocale)
self.database = CacheProxyDb(self.database)
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.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.person = self.database.get_person_from_gramps_id(pid)
if self.person is None:
raise ReportError(_("Person %s is not in the Database") % pid)
stdoptions.run_name_format_option(self, menu)
self.rel_calc = get_relationship_calculator(reinit=True,
clocale=rlocale)
self.kinship_map = {}
self.spouse_map = {}
def write_report(self):
"""
The routine the actually creates the report. At this point, the document
is opened and ready for writing.
"""
pname = self._name_display.display(self.person)
self.doc.start_paragraph("KIN-Title")
# feature request 2356: avoid genitive form
title = self._("Kinship Report for %s") % pname
mark = IndexMark(title, INDEX_TYPE_TOC, 1)
self.doc.write_text(title, mark)
self.doc.end_paragraph()
if self.inc_spouses:
spouse_handles = self.get_spouse_handles(self.person.get_handle())
if spouse_handles:
self.write_people(self._("Spouses"), spouse_handles)
# Collect all descendants of the person
self.traverse_down(self.person.get_handle(), 0, 1)
# Collect all ancestors/aunts/uncles/nephews/cousins of the person
self.traverse_up(self.person.get_handle(), 1, 0)
# Write Kin
for Ga, Gbs in self.kinship_map.items():
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)
# Skip unrequested people
if _x_ == 1 and _y_ > 0 and not self.inc_aunts:
continue
elif _x_ > 1 and not self.inc_cousins:
continue
get_rel_str = self.rel_calc.get_plural_relationship_string
title = get_rel_str(Ga, Gb, in_law_b=False)
self.write_people(self._(title), self.kinship_map[Ga][Gb])
if (self.inc_spouses and
#.........这里部分代码省略.........
示例14: __init__
def __init__(self, database, options, user):
"""
Create the DetAncestorReport object that produces the report.
The arguments are:
database - the Gramps database instance
options - instance of the Options class for this report
user - a gen.user.User() instance
This report needs the following parameters (class variables)
that come in the options class.
gen - Maximum number of generations to include.
inc_id - Whether to include Gramps IDs
pagebgg - Whether to include page breaks between generations.
pageben - Whether to include page break before End Notes.
firstName - Whether to use first names instead of pronouns.
fulldate - Whether to use full dates instead of just year.
listchildren - Whether to list children.
list_children_spouses - Whether to list the spouses of the children
includenotes - Whether to include notes.
incattrs - Whether to include attributes
blankplace - Whether to replace missing Places with ___________.
blankDate - Whether to replace missing Dates with ___________.
calcageflag - Whether to compute age.
dupperson - Whether to omit duplicate ancestors
(e.g. when distant cousins marry).
verbose - Whether to use complete sentences
childref - Whether to add descendant references in child list.
addimages - Whether to include images.
pid - The Gramps ID of the center person for the report.
name_format - Preferred format to display names
other_events - Whether to include other events.
incl_private - Whether to include private data
living_people - How to handle living people
years_past_death - Consider as living this many years after death
"""
Report.__init__(self, database, options, user)
self.map = {}
self._user = user
menu = options.menu
get_option_by_name = menu.get_option_by_name
get_value = lambda name: get_option_by_name(name).get_value()
self.set_locale(menu.get_option_by_name('trans').get_value())
stdoptions.run_date_format_option(self, menu)
stdoptions.run_private_data_option(self, menu)
stdoptions.run_living_people_option(self, menu, self._locale)
self.database = CacheProxyDb(self.database)
self._db = self.database
self.max_generations = get_value('gen')
self.pgbrk = get_value('pagebbg')
self.pgbrkenotes = get_value('pageben')
self.fulldate = get_value('fulldates')
use_fulldate = self.fulldate
self.listchildren = get_value('listc')
self.list_children_spouses = get_value('listc_spouses')
self.includenotes = get_value('incnotes')
use_call = get_value('usecall')
blankplace = get_value('repplace')
blankdate = get_value('repdate')
self.calcageflag = get_value('computeage')
self.dupperson = get_value('omitda')
self.verbose = get_value('verbose')
self.childref = get_value('desref')
self.addimages = get_value('incphotos')
self.inc_names = get_value('incnames')
self.inc_events = get_value('incevents')
self.inc_addr = get_value('incaddresses')
self.inc_sources = get_value('incsources')
self.inc_srcnotes = get_value('incsrcnotes')
self.inc_attrs = get_value('incattrs')
self.initial_sosa = get_value('initial_sosa')
self.want_ids = get_value('inc_id')
pid = get_value('pid')
self.other_events = get_value('incotherevents')
self.center_person = self._db.get_person_from_gramps_id(pid)
if self.center_person is None:
raise ReportError(_("Person %s is not in the Database") % pid)
stdoptions.run_name_format_option(self, menu)
self._nd = self._name_display
self.gen_handles = {}
self.prev_gen_handles = {}
if blankdate:
empty_date = EMPTY_ENTRY
else:
empty_date = ""
if blankplace:
empty_place = EMPTY_ENTRY
#.........这里部分代码省略.........
示例15: DetAncestorReport
class DetAncestorReport(Report):
""" the Detailed Ancestor Report """
def __init__(self, database, options, user):
"""
Create the DetAncestorReport object that produces the report.
The arguments are:
database - the Gramps database instance
options - instance of the Options class for this report
user - a gen.user.User() instance
This report needs the following parameters (class variables)
that come in the options class.
gen - Maximum number of generations to include.
inc_id - Whether to include Gramps IDs
pagebgg - Whether to include page breaks between generations.
pageben - Whether to include page break before End Notes.
firstName - Whether to use first names instead of pronouns.
fulldate - Whether to use full dates instead of just year.
listchildren - Whether to list children.
list_children_spouses - Whether to list the spouses of the children
includenotes - Whether to include notes.
incattrs - Whether to include attributes
blankplace - Whether to replace missing Places with ___________.
blankDate - Whether to replace missing Dates with ___________.
calcageflag - Whether to compute age.
dupperson - Whether to omit duplicate ancestors
(e.g. when distant cousins marry).
verbose - Whether to use complete sentences
childref - Whether to add descendant references in child list.
addimages - Whether to include images.
pid - The Gramps ID of the center person for the report.
name_format - Preferred format to display names
other_events - Whether to include other events.
incl_private - Whether to include private data
living_people - How to handle living people
years_past_death - Consider as living this many years after death
"""
Report.__init__(self, database, options, user)
self.map = {}
self._user = user
menu = options.menu
get_option_by_name = menu.get_option_by_name
get_value = lambda name: get_option_by_name(name).get_value()
self.set_locale(menu.get_option_by_name('trans').get_value())
stdoptions.run_date_format_option(self, menu)
stdoptions.run_private_data_option(self, menu)
stdoptions.run_living_people_option(self, menu, self._locale)
self.database = CacheProxyDb(self.database)
self._db = self.database
self.max_generations = get_value('gen')
self.pgbrk = get_value('pagebbg')
self.pgbrkenotes = get_value('pageben')
self.fulldate = get_value('fulldates')
use_fulldate = self.fulldate
self.listchildren = get_value('listc')
self.list_children_spouses = get_value('listc_spouses')
self.includenotes = get_value('incnotes')
use_call = get_value('usecall')
blankplace = get_value('repplace')
blankdate = get_value('repdate')
self.calcageflag = get_value('computeage')
self.dupperson = get_value('omitda')
self.verbose = get_value('verbose')
self.childref = get_value('desref')
self.addimages = get_value('incphotos')
self.inc_names = get_value('incnames')
self.inc_events = get_value('incevents')
self.inc_addr = get_value('incaddresses')
self.inc_sources = get_value('incsources')
self.inc_srcnotes = get_value('incsrcnotes')
self.inc_attrs = get_value('incattrs')
self.initial_sosa = get_value('initial_sosa')
self.want_ids = get_value('inc_id')
pid = get_value('pid')
self.other_events = get_value('incotherevents')
self.center_person = self._db.get_person_from_gramps_id(pid)
if self.center_person is None:
raise ReportError(_("Person %s is not in the Database") % pid)
stdoptions.run_name_format_option(self, menu)
self._nd = self._name_display
self.gen_handles = {}
self.prev_gen_handles = {}
if blankdate:
empty_date = EMPTY_ENTRY
else:
empty_date = ""
#.........这里部分代码省略.........