5496: Option for text [DDR] to report by branch

This commit is contained in:
lcc 2016-08-08 15:32:31 -07:00 committed by Paul Franklin
parent 1a6752f9d9
commit a8b0037fab

View File

@ -12,6 +12,7 @@
# Copyright (C) 2010 Vlada Perić <vlada.peric@gmail.com> # Copyright (C) 2010 Vlada Perić <vlada.peric@gmail.com>
# Copyright (C) 2011 Matt Keenan <matt.keenan@gmail.com> # Copyright (C) 2011 Matt Keenan <matt.keenan@gmail.com>
# Copyright (C) 2011 Tim G L Lyons # Copyright (C) 2011 Tim G L Lyons
# Copyright (C) 2012 lcc <lcc@6zap.com>
# Copyright (C) 2013-2014 Paul Franklin # Copyright (C) 2013-2014 Paul Franklin
# Copyright (C) 2015 Craig J. Anderson # Copyright (C) 2015 Craig J. Anderson
# #
@ -126,6 +127,7 @@ class DetDescendantReport(Report):
incl_private - Whether to include private data incl_private - Whether to include private data
living_people - How to handle living people living_people - How to handle living people
years_past_death - Consider as living this many years after death years_past_death - Consider as living this many years after death
structure - How to structure the report
""" """
Report.__init__(self, database, options, user) Report.__init__(self, database, options, user)
@ -159,6 +161,7 @@ class DetDescendantReport(Report):
self.numbering = get_value('numbering') self.numbering = get_value('numbering')
self.childref = get_value('desref') self.childref = get_value('desref')
self.addimages = get_value('incphotos') self.addimages = get_value('incphotos')
self.structure = get_value('structure')
self.inc_names = get_value('incnames') self.inc_names = get_value('incnames')
self.inc_events = get_value('incevents') self.inc_events = get_value('incevents')
self.inc_addr = get_value('incaddresses') self.inc_addr = get_value('incaddresses')
@ -169,6 +172,7 @@ class DetDescendantReport(Report):
self.inc_paths = get_value('incpaths') self.inc_paths = get_value('incpaths')
self.inc_ssign = get_value('incssign') self.inc_ssign = get_value('incssign')
self.inc_materef = get_value('incmateref') self.inc_materef = get_value('incmateref')
pid = get_value('pid') pid = get_value('pid')
self.center_person = self._db.get_person_from_gramps_id(pid) self.center_person = self._db.get_person_from_gramps_id(pid)
if self.center_person is None: if self.center_person is None:
@ -333,9 +337,9 @@ class DetDescendantReport(Report):
self.doc.write_text(title, mark) self.doc.write_text(title, mark)
self.doc.end_paragraph() self.doc.end_paragraph()
generation = 0
self.numbers_printed = list() self.numbers_printed = list()
if self.structure == "by generation":
for generation in range(len(self.gen_keys)): for generation in range(len(self.gen_keys)):
if self.pgbrk and generation > 0: if self.pgbrk and generation > 0:
self.doc.page_break() self.doc.page_break()
@ -347,11 +351,15 @@ class DetDescendantReport(Report):
if self.childref: if self.childref:
self.prev_gen_handles = self.gen_handles.copy() self.prev_gen_handles = self.gen_handles.copy()
self.gen_handles.clear() self.gen_handles.clear()
for key in self.gen_keys[generation]: for key in self.gen_keys[generation]:
person_handle = self.map[key] person_handle = self.map[key]
self.gen_handles[person_handle] = key self.gen_handles[person_handle] = key
self.write_person(key) self.write_person(key)
elif self.structure == "by lineage":
for key in sorted(self.map):
self.write_person(key)
else:
raise AttributeError("no such structure: '%s'" % self.structure)
if self.inc_sources: if self.inc_sources:
if self.pgbrkenotes: if self.pgbrkenotes:
@ -987,21 +995,19 @@ class DetDescendantOptions(MenuReportOptions):
numbering.set_help(_("The numbering system to be used")) numbering.set_help(_("The numbering system to be used"))
add_option("numbering", numbering) add_option("numbering", numbering)
structure = EnumeratedListOption(_("Report structure"),
"by generation")
structure.set_items([
("by generation", _("show people by generations")),
("by lineage", _("show people by lineage"))])
structure.set_help(_("How people are organized in the report"))
add_option("structure", structure)
generations = NumberOption(_("Generations"), 10, 1, 100) generations = NumberOption(_("Generations"), 10, 1, 100)
generations.set_help( generations.set_help(
_("The number of generations to include in the report")) _("The number of generations to include in the report"))
add_option("gen", generations) add_option("gen", generations)
pagebbg = BooleanOption(_("Page break between generations"), False)
pagebbg.set_help(
_("Whether to start a new page after each generation."))
add_option("pagebbg", pagebbg)
pageben = BooleanOption(_("Page break before end notes"), False)
pageben.set_help(
_("Whether to start a new page before the end notes."))
add_option("pageben", pageben)
stdoptions.add_localization_option(menu, category) stdoptions.add_localization_option(menu, category)
# Content # Content
@ -1042,33 +1048,54 @@ class DetDescendantOptions(MenuReportOptions):
_("Whether to add descendant references in child list.")) _("Whether to add descendant references in child list."))
add_option("desref", desref) add_option("desref", desref)
add_option = partial(menu.add_option, _("Include")) pagebbg = BooleanOption(_("Page break between generations"), False)
pagebbg.set_help(
_("Whether to start a new page after each generation."))
add_option("pagebbg", pagebbg)
incnotes = BooleanOption(_("Include notes"), True) pageben = BooleanOption(_("Page break before end notes"), False)
incnotes.set_help(_("Whether to include notes.")) pageben.set_help(
add_option("incnotes", incnotes) _("Whether to start a new page before the end notes."))
add_option("pageben", pageben)
incattrs = BooleanOption(_("Include attributes"), False) add_option = partial(menu.add_option, _("Include") + " 1")
incattrs.set_help(_("Whether to include attributes."))
add_option("incattrs", incattrs)
incphotos = BooleanOption( incphotos = BooleanOption(
_("Include Photo/Images from Gallery"), False) _("Include Photo/Images from Gallery"), False)
incphotos.set_help(_("Whether to include images.")) incphotos.set_help(_("Whether to include images."))
add_option("incphotos", incphotos) add_option("incphotos", incphotos)
incnames = BooleanOption(_("Include alternative names"), False)
incnames.set_help(_("Whether to include other names."))
add_option("incnames", incnames)
incevents = BooleanOption(_("Include events"), False) incevents = BooleanOption(_("Include events"), False)
incevents.set_help(_("Whether to include events.")) incevents.set_help(_("Whether to include events."))
add_option("incevents", incevents) add_option("incevents", incevents)
incnotes = BooleanOption(_("Include notes"), True)
incnotes.set_help(_("Whether to include notes."))
add_option("incnotes", incnotes)
incmates = BooleanOption(_("Include spouses"), False)
incmates.set_help(
_("Whether to include detailed spouse information."))
add_option("incmates", incmates)
incmateref = BooleanOption(_("Include spouse reference"), False)
incmateref.set_help(_("Whether to include reference to spouse."))
add_option("incmateref", incmateref)
add_option = partial(menu.add_option, _("Include") + " 2")
incaddresses = BooleanOption(_("Include addresses"), False) incaddresses = BooleanOption(_("Include addresses"), False)
incaddresses.set_help(_("Whether to include addresses.")) incaddresses.set_help(_("Whether to include addresses."))
add_option("incaddresses", incaddresses) add_option("incaddresses", incaddresses)
incattrs = BooleanOption(_("Include attributes"), False)
incattrs.set_help(_("Whether to include attributes."))
add_option("incattrs", incattrs)
incnames = BooleanOption(_("Include alternative names"), False)
incnames.set_help(_("Whether to include other names."))
add_option("incnames", incnames)
incsources = BooleanOption(_("Include sources"), False) incsources = BooleanOption(_("Include sources"), False)
incsources.set_help(_("Whether to include source references.")) incsources.set_help(_("Whether to include source references."))
add_option("incsources", incsources) add_option("incsources", incsources)
@ -1079,15 +1106,6 @@ class DetDescendantOptions(MenuReportOptions):
"Endnotes section. Only works if Include sources is selected.")) "Endnotes section. Only works if Include sources is selected."))
add_option("incsrcnotes", incsrcnotes) add_option("incsrcnotes", incsrcnotes)
incmates = BooleanOption(_("Include spouses"), False)
incmates.set_help(
_("Whether to include detailed spouse information."))
add_option("incmates", incmates)
incmateref = BooleanOption(_("Include spouse reference"), False)
incmateref.set_help(_("Whether to include reference to spouse."))
add_option("incmateref", incmateref)
incssign = BooleanOption( incssign = BooleanOption(
_("Include sign of succession ('+') in child-list"), True) _("Include sign of succession ('+') in child-list"), True)
incssign.set_help(_("Whether to include a sign ('+') before the" incssign.set_help(_("Whether to include a sign ('+') before the"