5580: some Book Report subjects are missing or misleading

This commit is contained in:
Brian Matherly 2016-07-07 09:39:14 -07:00 committed by Paul Franklin
parent de382fdb0c
commit 337f6d9c7a
27 changed files with 281 additions and 137 deletions

View File

@ -5,6 +5,7 @@
# Copyright (C) 2008,2011 Gary Burton
# Copyright (C) 2010 Jakim Friant
# Copyright (C) 2011-2012 Paul Franklin
# Copyright (C) 2012 Brian G. Matherly
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
@ -34,10 +35,6 @@ Report option handling, including saving and parsing.
#-------------------------------------------------------------------------
import os
import copy
from xml.sax.saxutils import escape
def escxml(word):
return escape(word, {'"' : '"'})
#-------------------------------------------------------------------------
#
@ -45,6 +42,15 @@ def escxml(word):
#
#-------------------------------------------------------------------------
from xml.sax import make_parser, SAXParseException
from xml.sax.saxutils import escape
#------------------------------------------------------------------------
#
# Set up logging
#
#------------------------------------------------------------------------
import logging
LOG = logging.getLogger(".plug.report.options")
#-------------------------------------------------------------------------
#
@ -60,6 +66,9 @@ from .. import _options
from .. import MenuOptions
from gramps.gen.utils.cast import get_type_converter
def escxml(word):
return escape(word, {'"' : '"'})
#-------------------------------------------------------------------------
#
# List of options for a single report
@ -934,6 +943,15 @@ class MenuReportOptions(MenuOptions, ReportOptions):
if menu_option:
menu_option.set_value(self.options_dict[optname])
def get_subject(self):
"""
Return a string that describes the subject of the report.
This method MUST be overridden by subclasses.
"""
LOG.warning("get_subject not implemented for %s" % self.name)
return ""
#-------------------------------------------------------------------------
#
# DocOptionHandler class

View File

@ -2,7 +2,7 @@
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2003-2007 Donald N. Allingham
# Copyright (C) 2007-2008 Brian G. Matherly
# Copyright (C) 2007-2012 Brian G. Matherly
# Copyright (C) 2010 Jakim Friant
# Copyright (C) 2012 Nick Hall
# Copyright (C) 2011-2016 Paul Franklin
@ -61,7 +61,7 @@ from ...listmodel import ListModel
from gramps.gen.errors import FilterError, ReportError
from ...pluginmanager import GuiPluginManager
from ...dialog import WarningDialog, ErrorDialog, QuestionDialog2
from gramps.gen.plug.menu import PersonOption, FilterOption, FamilyOption
from gramps.gen.plug.menu import PersonOption, FamilyOption
from gramps.gen.plug.docgen import StyleSheet
from ...managedwindow import ManagedWindow, set_titles
from ...glade import Glade
@ -135,62 +135,6 @@ def _initialize_options(options, dbstate, uistate):
else:
print("No family specified for ", name)
def _get_subject(options, dbase):
"""
Attempts to determine the subject of a set of options. The subject would
likely be a person (using a PersonOption) or a filter (using a
FilterOption)
options: The ReportOptions class
dbase: the database for which it corresponds
"""
if not hasattr(options, "menu"):
return ""
menu = options.menu
option_names = menu.get_all_option_names()
if not option_names:
return _("Entire Database")
for name in option_names:
option = menu.get_option_by_name(name)
if isinstance(option, FilterOption):
return option.get_filter().get_name()
elif isinstance(option, PersonOption):
gid = option.get_value()
person = dbase.get_person_from_gramps_id(gid)
return _nd.display(person)
elif isinstance(option, FamilyOption):
family = dbase.get_family_from_gramps_id(option.get_value())
if not family:
return ""
family_id = family.get_gramps_id()
fhandle = family.get_father_handle()
mhandle = family.get_mother_handle()
if fhandle:
father = dbase.get_person_from_handle(fhandle)
father_name = _nd.display(father)
else:
father_name = _("unknown father")
if mhandle:
mother = dbase.get_person_from_handle(mhandle)
mother_name = _nd.display(mother)
else:
mother_name = _("unknown mother")
name = _("%(father_name)s and %(mother_name)s (%(family_id)s)"
) % {'father_name' : father_name,
'mother_name' : mother_name,
'family_id' : family_id}
return name
return ""
#------------------------------------------------------------------------
#
# BookList Display class
@ -526,7 +470,7 @@ class BookSelector(ManagedWindow):
data = [item.get_translated_name(),
item.get_category(), item.get_name()]
data[2] = _get_subject(item.option_class, self._db)
data[2] = item.option_class.get_subject()
self.book_model.add(data)
def on_add_clicked(self, obj):
@ -542,7 +486,7 @@ class BookSelector(ManagedWindow):
list(range(self.avail_nr_cols)))
item = BookItem(self._db, data[2])
_initialize_options(item.option_class, self.dbstate, self.uistate)
data[2] = _get_subject(item.option_class, self._db)
data[2] = item.option_class.get_subject()
self.book_model.add(data)
self.book.append_item(item)
@ -621,7 +565,7 @@ class BookSelector(ManagedWindow):
# rest of dialog is unresponsive, release when finished
style = option_class.handler.get_default_stylesheet_name()
item.set_style_name(style)
subject = _get_subject(option_class, self._db)
subject = option_class.get_subject()
self.book_model.model.set_value(the_iter, 2, subject)
self.book.set_item(row, item)
item_dialog.close()

View File

@ -1,7 +1,7 @@
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2007 Donald N. Allingham
# Copyright (C) 2007-2008 Brian G. Matherly
# Copyright (C) 2007-2012 Brian G. Matherly
# Copyright (C) 2010 Jakim Friant
# Copyright (C) 2014 Paul Franklin
# Copyright (C) 2010-2015 Craig J. Anderson
@ -48,6 +48,7 @@ from gramps.gen.plug.docgen import (FontStyle, ParagraphStyle, GraphicsStyle,
from gramps.plugins.lib.libtreebase import *
from gramps.plugins.lib.librecurse import AscendPerson
from gramps.gen.proxy import CacheProxyDb
from gramps.gen.display.name import displayer as _nd
PT2CM = utils.pt2cm
#cm2pt = utils.cm2pt
@ -767,18 +768,26 @@ class AncestorTreeOptions(MenuReportOptions):
"""
def __init__(self, name, dbase):
self.__db = dbase
self.__pid = None
self.box_Y_sf = None
self.box_shadow_sf = None
MenuReportOptions.__init__(self, name, dbase)
def get_subject(self):
""" Return a string that describes the subject of the report. """
gid = self.__pid.get_value()
person = self.__db.get_person_from_gramps_id(gid)
return _nd.display(person)
def add_menu_options(self, menu):
##################
category_name = _("Tree Options")
pid = PersonOption(_("Center Person"))
pid.set_help(_("The center person for the tree"))
menu.add_option(category_name, "pid", pid)
self.__pid = PersonOption(_("Center Person"))
self.__pid.set_help(_("The center person for the tree"))
menu.add_option(category_name, "pid", self.__pid)
stdoptions.add_name_format_option(menu, category_name)

View File

@ -1,7 +1,7 @@
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2007 Donald N. Allingham
# Copyright (C) 2008-2009 Brian G. Matherly
# Copyright (C) 2008-2012 Brian G. Matherly
# Copyright (C) 2010 Jakim Friant
# Copyright (C) 2012-2014 Paul Franklin
#
@ -457,6 +457,10 @@ class CalendarOptions(MenuReportOptions):
self.__filter = None
MenuReportOptions.__init__(self, name, dbase)
def get_subject(self):
""" Return a string that describes the subject of the report. """
return self.__filter.get_filter().get_name()
def add_menu_options(self, menu):
""" Add the options for the graphical calendar """

View File

@ -2,7 +2,7 @@
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2007 Donald N. Allingham
# Copyright (C) 2007-2008 Brian G. Matherly
# Copyright (C) 2007-2012 Brian G. Matherly
# Copyright (C) 2010 Jakim Friant
# Copyright (C) 2009-2010 Craig J. Anderson
# Copyright (C) 2014 Paul Franklin
@ -44,6 +44,8 @@ from gramps.gen.plug.docgen import (FontStyle, ParagraphStyle, GraphicsStyle,
FONT_SANS_SERIF, PARA_ALIGN_CENTER)
from gramps.plugins.lib.libtreebase import *
from gramps.gen.proxy import CacheProxyDb
from gramps.gen.display.name import displayer as _nd
from gramps.gen.utils.db import family_name
PT2CM = utils.pt2cm
@ -1497,6 +1499,19 @@ class DescendTreeOptions(MenuReportOptions):
self.box_shadow_sf = None
MenuReportOptions.__init__(self, name, dbase)
def get_subject(self):
""" Return a string that describes the subject of the report. """
gid = self.__pid.get_value()
if self.name.split(",")[0] == _RPT_NAME:
person = self.__db.get_person_from_gramps_id(gid)
if person:
return _nd.display(person)
else:
family = self.__db.get_family_from_gramps_id(gid)
if family:
return family_name(family, self.__db)
return ""
def add_menu_options(self, menu):
"""
Add options to the menu for the descendant report.

View File

@ -2,7 +2,7 @@
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2003-2006 Donald N. Allingham
# Copyright (C) 2007-2008 Brian G. Matherly
# Copyright (C) 2007-2012 Brian G. Matherly
# Copyright (C) 2010 Jakim Friant
# Copyright (C) 2012-2014 Paul Franklin
# Copyright (C) 2012 Nicolas Adenis-Lamarre
@ -59,6 +59,7 @@ from gramps.gen.config import config
from gramps.gen.utils.db import get_birth_or_fallback, get_death_or_fallback
from gramps.gen.lib import EventType
from gramps.gen.proxy import CacheProxyDb
from gramps.gen.display.name import displayer as _nd
#------------------------------------------------------------------------
#
@ -667,19 +668,26 @@ class FanChartOptions(MenuReportOptions):
""" options for fanchart report """
def __init__(self, name, dbase):
self.__db = dbase
self.__pid = None
self.max_generations = 11
MenuReportOptions.__init__(self, name, dbase)
def get_subject(self):
""" Return a string that describes the subject of the report. """
gid = self.__pid.get_value()
person = self.__db.get_person_from_gramps_id(gid)
return _nd.display(person)
def add_menu_options(self, menu):
"""
Add options to the menu for the fan chart.
"""
category_name = _("Report Options")
pid = PersonOption(_("Center Person"))
pid.set_help(_("The center person for the report"))
menu.add_option(category_name, "pid", pid)
self.__pid = PersonOption(_("Center Person"))
self.__pid.set_help(_("The center person for the report"))
menu.add_option(category_name, "pid", self.__pid)
stdoptions.add_private_data_option(menu, category_name)

View File

@ -3,7 +3,7 @@
#
# Copyright (C) 2003-2006 Donald N. Allingham
# Copyright (C) 2004-2005 Eero Tamminen
# Copyright (C) 2007-2008 Brian G. Matherly
# Copyright (C) 2007-2012 Brian G. Matherly
# Copyright (C) 2008 Peter Landgren
# Copyright (C) 2010 Jakim Friant
# Copyright (C) 2012-2016 Paul Franklin
@ -971,6 +971,10 @@ class StatisticsChartOptions(MenuReportOptions):
self._nf = None
MenuReportOptions.__init__(self, name, dbase)
def get_subject(self):
""" Return a string that describes the subject of the report. """
return self.__filter.get_filter().get_name()
def add_menu_options(self, menu):
"""
Add options to the menu for the statistics report.

View File

@ -2,7 +2,7 @@
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2003-2007 Donald N. Allingham
# Copyright (C) 2007-2008 Brian G. Matherly
# Copyright (C) 2007-2012 Brian G. Matherly
# Copyright (C) 2010 Jakim Friant
# Copyright (C) 2012-2016 Paul Franklin
#
@ -407,6 +407,10 @@ class TimeLineOptions(MenuReportOptions):
self._nf = None
MenuReportOptions.__init__(self, name, dbase)
def get_subject(self):
""" Return a string that describes the subject of the report. """
return self.__filter.get_filter().get_name()
def add_menu_options(self, menu):
category_name = _("Report Options")

View File

@ -1,6 +1,7 @@
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2012 Nick Hall
# Copyright (C) 2012 Brian G. Matherly
# Copyright (C) 2012-2014 Paul Franklin
#
# This program is free software; you can redistribute it and/or modify
@ -83,6 +84,10 @@ class AlphabeticalIndexOptions(MenuReportOptions):
self.__db = dbase
MenuReportOptions.__init__(self, name, dbase)
def get_subject(self):
""" Return a string that describes the subject of the report. """
return _('Entire Book')
def add_menu_options(self, menu):
""" Add the options for this report """
category_name = _("Report Options")

View File

@ -2,7 +2,7 @@
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2007 Donald N. Allingham
# Copyright (C) 2007-2009 Brian G. Matherly
# Copyright (C) 2007-2012 Brian G. Matherly
# Copyright (C) 2010 Jakim Friant
# Copyright (C) 2012-2014 Paul Franklin
#
@ -49,6 +49,7 @@ from gramps.gen.plug.report import MenuReportOptions
from gramps.gen.plug.report import stdoptions
from gramps.plugins.lib.libnarrate import Narrator
from gramps.gen.proxy import CacheProxyDb
from gramps.gen.display.name import displayer as _nd
#------------------------------------------------------------------------
#
@ -263,17 +264,25 @@ class AncestorOptions(MenuReportOptions):
"""
def __init__(self, name, dbase):
self.__db = dbase
self.__pid = None
MenuReportOptions.__init__(self, name, dbase)
def get_subject(self):
""" Return a string that describes the subject of the report. """
gid = self.__pid.get_value()
person = self.__db.get_person_from_gramps_id(gid)
return _nd.display(person)
def add_menu_options(self, menu):
"""
Add options to the menu for the ancestor report.
"""
category_name = _("Report Options")
pid = PersonOption(_("Center Person"))
pid.set_help(_("The center person for the report"))
menu.add_option(category_name, "pid", pid)
self.__pid = PersonOption(_("Center Person"))
self.__pid.set_help(_("The center person for the report"))
menu.add_option(category_name, "pid", self.__pid)
stdoptions.add_name_format_option(menu, category_name)

View File

@ -1,7 +1,7 @@
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2007 Donald N. Allingham
# Copyright (C) 2008-2009 Brian G. Matherly
# Copyright (C) 2008-2012 Brian G. Matherly
# Copyright (C) 2009 Rob G. Healey <robhealey1@gmail.com>
# Copyright (C) 2010 Jakim Friant
# Copyright (C) 2012-2014 Paul Franklin
@ -405,6 +405,10 @@ class BirthdayOptions(MenuReportOptions):
self.__pid = None
self.__filter = None
MenuReportOptions.__init__(self, name, dbase)
def get_subject(self):
""" Return a string that describes the subject of the report. """
return self.__filter.get_filter().get_name()
def add_menu_options(self, menu):
""" Add the options for the text birthday report """

View File

@ -1,7 +1,7 @@
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2003-2006 Donald N. Allingham
# Copyright (C) 2008 Brian G. Matherly
# Copyright (C) 2008,2012 Brian G. Matherly
# Copyright (C) 2010 Jakim Friant
# Copyright (C) 2012 Paul Franklin
#
@ -122,23 +122,36 @@ class CustomTextOptions(MenuReportOptions):
"""
def __init__(self, name, dbase):
self.__top = None
self.__mid = None
self.__bot = None
MenuReportOptions.__init__(self, name, dbase)
def add_menu_options(self, menu):
category_name = _("Text")
top = TextOption(_("Initial Text"), [""])
top.set_help(_("Text to display at the top."))
menu.add_option(category_name, "top", top)
self.__top = TextOption(_("Initial Text"), [""])
self.__top.set_help(_("Text to display at the top."))
menu.add_option(category_name, "top", self.__top)
mid = TextOption(_("Middle Text"), [""])
mid.set_help(_("Text to display in the middle"))
menu.add_option(category_name, "mid", mid)
self.__mid = TextOption(_("Middle Text"), [""])
self.__mid.set_help(_("Text to display in the middle"))
menu.add_option(category_name, "mid", self.__mid)
bot = TextOption(_("Final Text"), [""])
bot.set_help(_("Text to display last."))
menu.add_option(category_name, "bot", bot)
self.__bot = TextOption(_("Final Text"), [""])
self.__bot.set_help(_("Text to display last."))
menu.add_option(category_name, "bot", self.__bot)
def get_subject(self):
""" Return a string that describes the subject of the report. """
if len(self.__top.get_value()[0]) > 0:
return self.__top.get_value()[0]
if len(self.__mid.get_value()[0]) > 0:
return self.__mid.get_value()[0]
if len(self.__bot.get_value()[0]) > 0:
return self.__bot.get_value()[0]
return ""
def make_default_style(self, default_style):
"""Make the default output style for the Custom Text report."""

View File

@ -2,7 +2,7 @@
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2007 Donald N. Allingham
# Copyright (C) 2007-2008 Brian G. Matherly
# Copyright (C) 2007-2012 Brian G. Matherly
# Copyright (C) 2009 Gary Burton
# Copyright (C) 2010 Craig J. Anderson
# Copyright (C) 2010 Jakim Friant
@ -56,6 +56,7 @@ from gramps.gen.utils.db import (get_birth_or_fallback, get_death_or_fallback,
get_divorce_or_fallback)
from gramps.gen.proxy import CacheProxyDb
from gramps.gen.display.place import displayer as _pd
from gramps.gen.display.name import displayer as _nd
#------------------------------------------------------------------------
#
@ -412,14 +413,22 @@ class DescendantOptions(MenuReportOptions):
"""
def __init__(self, name, dbase):
self.__db = dbase
self.__pid = None
MenuReportOptions.__init__(self, name, dbase)
def get_subject(self):
""" Return a string that describes the subject of the report. """
gid = self.__pid.get_value()
person = self.__db.get_person_from_gramps_id(gid)
return _nd.display(person)
def add_menu_options(self, menu):
category_name = _("Report Options")
pid = PersonOption(_("Center Person"))
pid.set_help(_("The center person for the report"))
menu.add_option(category_name, "pid", pid)
self.__pid = PersonOption(_("Center Person"))
self.__pid.set_help(_("The center person for the report"))
menu.add_option(category_name, "pid", self.__pid)
stdoptions.add_name_format_option(menu, category_name)

View File

@ -4,7 +4,7 @@
#
# Copyright (C) 2000-2002 Bruce J. DeGrasse
# Copyright (C) 2000-2007 Donald N. Allingham
# Copyright (C) 2007-2009 Brian G. Matherly
# Copyright (C) 2007-2012 Brian G. Matherly
# Copyright (C) 2008 James Friedmann <jfriedmannj@gmail.com>
# Copyright (C) 2009 Benny Malengier <benny.malengier@gramps-project.org>
# Copyright (C) 2010 Jakim Friant
@ -60,6 +60,7 @@ from gramps.gen.plug.report import stdoptions
from gramps.plugins.lib.libnarrate import Narrator
from gramps.gen.display.place import displayer as _pd
from gramps.gen.proxy import CacheProxyDb
from gramps.gen.display.name import displayer as _nd
#------------------------------------------------------------------------
#
@ -761,8 +762,16 @@ class DetAncestorOptions(MenuReportOptions):
"""
def __init__(self, name, dbase):
self.__db = dbase
self.__pid = None
MenuReportOptions.__init__(self, name, dbase)
def get_subject(self):
""" Return a string that describes the subject of the report. """
gid = self.__pid.get_value()
person = self.__db.get_person_from_gramps_id(gid)
return _nd.display(person)
def add_menu_options(self, menu):
from functools import partial
@ -770,9 +779,9 @@ class DetAncestorOptions(MenuReportOptions):
category = _("Report Options")
addopt = partial(menu.add_option, category)
pid = PersonOption(_("Center Person"))
pid.set_help(_("The center person for the report"))
addopt("pid", pid)
self.__pid = PersonOption(_("Center Person"))
self.__pid.set_help(_("The center person for the report"))
addopt("pid", self.__pid)
start_number = NumberOption(_("Sosa-Stradonitz number"), 1, 1, 16384)
start_number.set_help(

View File

@ -4,7 +4,7 @@
#
# Copyright (C) 2000-2002 Bruce J. DeGrasse
# Copyright (C) 2000-2007 Donald N. Allingham
# Copyright (C) 2007-2009 Brian G. Matherly
# Copyright (C) 2007-2012 Brian G. Matherly
# Copyright (C) 2007 Robert Cawley <rjc@cawley.id.au>
# Copyright (C) 2008-2009 James Friedmann <jfriedmannj@gmail.com>
# Copyright (C) 2009 Benny Malengier <benny.malengier@gramps-project.org>
@ -59,6 +59,7 @@ from gramps.gen.plug.report import MenuReportOptions
from gramps.gen.plug.report import stdoptions
from gramps.plugins.lib.libnarrate import Narrator
from gramps.gen.display.place import displayer as _pd
from gramps.gen.display.name import displayer as _nd
from gramps.gen.proxy import CacheProxyDb
#------------------------------------------------------------------------
@ -911,8 +912,16 @@ class DetDescendantOptions(MenuReportOptions):
"""
def __init__(self, name, dbase):
self.__db = dbase
self.__pid = None
MenuReportOptions.__init__(self, name, dbase)
def get_subject(self):
""" Return a string that describes the subject of the report. """
gid = self.__pid.get_value()
person = self.__db.get_person_from_gramps_id(gid)
return _nd.display(person)
def add_menu_options(self, menu):
"""
Add options to the menu for the detailed descendant report.
@ -922,9 +931,9 @@ class DetDescendantOptions(MenuReportOptions):
category = _("Report Options")
add_option = partial(menu.add_option, category)
pid = PersonOption(_("Center Person"))
pid.set_help(_("The center person for the report"))
add_option("pid", pid)
self.__pid = PersonOption(_("Center Person"))
self.__pid.set_help(_("The center person for the report"))
add_option("pid", self.__pid)
stdoptions.add_name_format_option(menu, category)

View File

@ -1,7 +1,7 @@
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2007-2008 Brian G. Matherly
# Copyright (C) 2007-2012 Brian G. Matherly
# Copyright (C) 2010 Jakim Friant
# Copyright (C) 2013-2014 Paul Franklin
#
@ -46,6 +46,7 @@ from gramps.gen.plug.report import utils
from gramps.gen.plug.report import MenuReportOptions
from gramps.gen.plug.report import stdoptions
from gramps.gen.proxy import CacheProxyDb
from gramps.gen.display.name import displayer as _nd
#------------------------------------------------------------------------
#
@ -251,17 +252,25 @@ class EndOfLineOptions(MenuReportOptions):
"""
def __init__(self, name, dbase):
self.__db = dbase
self.__pid = None
MenuReportOptions.__init__(self, name, dbase)
def get_subject(self):
""" Return a string that describes the subject of the report. """
gid = self.__pid.get_value()
person = self.__db.get_person_from_gramps_id(gid)
return _nd.display(person)
def add_menu_options(self, menu):
"""
Add options to the menu for the End of Line report.
"""
category_name = _("Report Options")
pid = PersonOption(_("Center Person"))
pid.set_help(_("The center person for the report"))
menu.add_option(category_name, "pid", pid)
self.__pid = PersonOption(_("Center Person"))
self.__pid.set_help(_("The center person for the report"))
menu.add_option(category_name, "pid", self.__pid)
stdoptions.add_name_format_option(menu, category_name)

View File

@ -694,6 +694,10 @@ class FamilyGroupOptions(MenuReportOptions):
self._nf = None
MenuReportOptions.__init__(self, name, dbase)
def get_subject(self):
""" Return a string that describes the subject of the report. """
return self.__filter.get_filter().get_name()
def add_menu_options(self, menu):
##########################

View File

@ -2,7 +2,7 @@
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2007 Donald N. Allingham
# Copyright (C) 2007-2008 Brian G. Matherly
# Copyright (C) 2007-2012 Brian G. Matherly
# Copyright (C) 2009 Nick Hall
# Copyright (C) 2009 Benny Malengier
# Copyright (C) 2010 Jakim Friant
@ -980,6 +980,10 @@ class IndivCompleteOptions(MenuReportOptions):
self._nf = None
MenuReportOptions.__init__(self, name, dbase)
def get_subject(self):
""" Return a string that describes the subject of the report. """
return self.__filter.get_filter().get_name()
def add_menu_options(self, menu):
################################
category_name = _("Report Options")

View File

@ -1,7 +1,7 @@
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2007-2008 Brian G. Matherly
# Copyright (C) 2007-2012 Brian G. Matherly
# Copyright (C) 2009 Gary Burton
# Contribution 2009 by Reinhard Mueller <reinhard.mueller@bytewise.at>
# Copyright (C) 2010 Jakim Friant
@ -49,6 +49,7 @@ from gramps.gen.plug.report import MenuReportOptions
from gramps.gen.plug.report import stdoptions
from gramps.gen.utils.db import get_birth_or_fallback, get_death_or_fallback
from gramps.gen.proxy import CacheProxyDb
from gramps.gen.display.name import displayer as _nd
#------------------------------------------------------------------------
#
@ -337,17 +338,25 @@ class KinshipOptions(MenuReportOptions):
"""
def __init__(self, name, dbase):
self.__db = dbase
self.__pid = None
MenuReportOptions.__init__(self, name, dbase)
def get_subject(self):
""" Return a string that describes the subject of the report. """
gid = self.__pid.get_value()
person = self.__db.get_person_from_gramps_id(gid)
return _nd.display(person)
def add_menu_options(self, menu):
"""
Add options to the menu for the kinship report.
"""
category_name = _("Report Options")
pid = PersonOption(_("Center Person"))
pid.set_help(_("The center person for the report"))
menu.add_option(category_name, "pid", pid)
self.__pid = PersonOption(_("Center Person"))
self.__pid.set_help(_("The center person for the report"))
menu.add_option(category_name, "pid", self.__pid)
stdoptions.add_name_format_option(menu, category_name)

View File

@ -150,6 +150,11 @@ class NoteLinkReport(Report):
#
#------------------------------------------------------------------------
class NoteLinkOptions(MenuReportOptions):
def get_subject(self):
""" Return a string that describes the subject of the report. """
return _('Entire Database')
def add_menu_options(self, menu):
"""
Add options to the menu for the tag report.

View File

@ -4,7 +4,7 @@
# Copyright (C) 2001 Jesper Zedlitz
# Copyright (C) 2004-2006 Donald Allingham
# Copyright (C) 2007 Johan Gonqvist <johan.gronqvist@gmail.com>
# Copyright (C) 2008 Brian G. Matherly
# Copyright (C) 2008,2012 Brian G. Matherly
# Copyright (C) 2010 Jakim Friant
# Copyright (C) 2013-2014 Paul Franklin
#
@ -48,6 +48,7 @@ from gramps.gen.plug.report import Report
from gramps.gen.plug.report import utils
from gramps.gen.plug.report import MenuReportOptions
from gramps.gen.plug.report import stdoptions
from gramps.gen.display.name import displayer as _nd
#------------------------------------------------------------------------
#
@ -185,17 +186,25 @@ class NumberOfAncestorsOptions(MenuReportOptions):
Defines options for the NumberOfAncestorsReport.
"""
def __init__(self, name, dbase):
self.__db = dbase
self.__pid = None
MenuReportOptions.__init__(self, name, dbase)
def get_subject(self):
""" Return a string that describes the subject of the report. """
gid = self.__pid.get_value()
person = self.__db.get_person_from_gramps_id(gid)
return _nd.display(person)
def add_menu_options(self, menu):
"""
Add options to the menu for the Number of Ancestors report.
"""
category_name = _("Report Options")
pid = PersonOption(_("Center Person"))
pid.set_help(_("The center person for the report"))
menu.add_option(category_name, "pid", pid)
self.__pid = PersonOption(_("Center Person"))
self.__pid.set_help(_("The center person for the report"))
menu.add_option(category_name, "pid", self.__pid)
stdoptions.add_name_format_option(menu, category_name)

View File

@ -405,8 +405,26 @@ class PlaceOptions(MenuReportOptions):
"""
def __init__(self, name, dbase):
self.__db = dbase
self.__filter = None
self.__places = None
MenuReportOptions.__init__(self, name, dbase)
def get_subject(self):
""" Return a string that describes the subject of the report. """
subject = ""
if self.__filter.get_filter().get_name():
# Use the selected filter's name, if any
subject += self.__filter.get_filter().get_name()
if self.__places.get_value():
# Add places selected individually, if any
for place_id in self.__places.get_value().split():
if subject:
subject += " + "
place = self.__db.get_place_from_gramps_id(place_id)
subject += _pd.display(self.__db, place)
return subject
def add_menu_options(self, menu):
"""
Add options to the menu for the place report.
@ -417,17 +435,17 @@ class PlaceOptions(MenuReportOptions):
CustomFilters = None
from gramps.gen.filters import CustomFilters, GenericFilter
opt = FilterOption(_("Select using filter"), 0)
opt.set_help(_("Select places using a filter"))
self.__filter = FilterOption(_("Select using filter"), 0)
self.__filter.set_help(_("Select places using a filter"))
filter_list = []
filter_list.append(GenericFilter())
filter_list.extend(CustomFilters.get_filters('Place'))
opt.set_filters(filter_list)
menu.add_option(category_name, "filter", opt)
self.__filter.set_filters(filter_list)
menu.add_option(category_name, "filter", self.__filter)
places = PlaceListOption(_("Select places individually"))
places.set_help(_("List of places to report on"))
menu.add_option(category_name, "places", places)
self.__places = PlaceListOption(_("Select places individually"))
self.__places.set_help(_("List of places to report on"))
menu.add_option(category_name, "places", self.__places)
stdoptions.add_private_data_option(menu, category_name)

View File

@ -4,6 +4,7 @@
#
# Copyright (C) 2008-2011 Reinhard Müller
# Copyright (C) 2010 Jakim Friant
# Copyright (C) 2012 Brian G. Matherly
# Copyright (C) 2013-2016 Paul Franklin
#
# This program is free software; you can redistribute it and/or modify
@ -206,6 +207,10 @@ class RecordsReportOptions(MenuReportOptions):
MenuReportOptions.__init__(self, name, dbase)
def get_subject(self):
""" Return a string that describes the subject of the report. """
return self.__filter.get_filter().get_name()
def add_menu_options(self, menu):
category_name = _("Report Options")

View File

@ -1,7 +1,7 @@
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2003-2006 Donald N. Allingham
# Copyright (C) 2008 Brian G. Matherly
# Copyright (C) 2008,2012 Brian G. Matherly
# Copyright (C) 2010 Jakim Friant
# Copyright (C) 2011 Paul Franklin
#
@ -125,13 +125,17 @@ class SimpleBookTitleOptions(MenuReportOptions):
self.__db = dbase
MenuReportOptions.__init__(self, name, dbase)
def get_subject(self):
""" Return a string that describes the subject of the report. """
return self.__title.get_value()
def add_menu_options(self, menu):
""" Add the options for this report """
category_name = _("Report Options")
title = StringOption(_('book|Title'), _('Title of the Book'))
title.set_help(_("Title string for the book."))
menu.add_option(category_name, "title", title)
self.__title = StringOption(_('book|Title'), _('Title of the Book'))
self.__title.set_help(_("Title string for the book."))
menu.add_option(category_name, "title", self.__title)
subtitle = StringOption(_('Subtitle'), _('Subtitle of the Book'))
subtitle.set_help(_("Subtitle string for the book."))

View File

@ -2,7 +2,7 @@
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2000-2006 Donald N. Allingham
# Copyright (C) 2008 Brian G. Matherly
# Copyright (C) 2008,2012 Brian G. Matherly
# Copyright (C) 2010 Jakim Friant
# Copyright (C) 2013-2014 Paul Franklin
#
@ -276,6 +276,10 @@ class SummaryOptions(MenuReportOptions):
def __init__(self, name, dbase):
MenuReportOptions.__init__(self, name, dbase)
def get_subject(self):
""" Return a string that describes the subject of the report. """
return _('Entire Database')
def add_menu_options(self, menu):
"""
Add options to the menu for the summary report.

View File

@ -1,6 +1,7 @@
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2012 Nick Hall
# Copyright (C) 2012 Brian G. Matherly
# Copyright (C) 2012-2014 Paul Franklin
#
# This program is free software; you can redistribute it and/or modify
@ -82,6 +83,10 @@ class TableOfContentsOptions(MenuReportOptions):
self.__db = dbase
MenuReportOptions.__init__(self, name, dbase)
def get_subject(self):
""" Return a string that describes the subject of the report. """
return _('Entire Book')
def add_menu_options(self, menu):
""" Add the options for this report """
category_name = _("Report Options")

View File

@ -1,7 +1,7 @@
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2007-2008 Brian G. Matherly
# Copyright (C) 2007-2012 Brian G. Matherly
# Copyright (C) 2009 Gary Burton
# Copyright (C) 2010 Jakim Friant
# Copyright (C) 2010 Nick Hall
@ -883,6 +883,10 @@ class TagOptions(MenuReportOptions):
self.__db = dbase
MenuReportOptions.__init__(self, name, dbase)
def get_subject(self):
""" Return a string that describes the subject of the report. """
return self.__tag_option.get_value()
def add_menu_options(self, menu):
"""
Add options to the menu for the tag report.
@ -895,15 +899,15 @@ class TagOptions(MenuReportOptions):
all_tags.append(tag.get_name())
if len(all_tags) > 0:
tag_option = EnumeratedListOption(_('Tag'), all_tags[0])
self.__tag_option = EnumeratedListOption(_('Tag'), all_tags[0])
for tag_name in all_tags:
tag_option.add_item(tag_name, tag_name)
self.__tag_option.add_item(tag_name, tag_name)
else:
tag_option = EnumeratedListOption(_('Tag'), '')
tag_option.add_item('', '')
self.__tag_option = EnumeratedListOption(_('Tag'), '')
self.__tag_option.add_item('', '')
tag_option.set_help(_("The tag to use for the report"))
menu.add_option(category_name, "tag", tag_option)
self.__tag_option.set_help(_("The tag to use for the report"))
menu.add_option(category_name, "tag", self.__tag_option)
stdoptions.add_name_format_option(menu, category_name)