More refactoring in the report system. Book report should work again.
svn: r9916
This commit is contained in:
parent
f01bbb3bc9
commit
2f0d587bec
25
ChangeLog
25
ChangeLog
@ -1,3 +1,28 @@
|
||||
2008-01-22 Brian Matherly <brian@gramps-project.org>
|
||||
* src/plugins/KinshipReport.py:
|
||||
* src/plugins/DetDescendantReport.py:
|
||||
* src/plugins/DescendReport.py:
|
||||
* src/plugins/IndivComplete.py:
|
||||
* src/plugins/CalculateEstimatedDates.py:
|
||||
* src/plugins/BookReport.py:
|
||||
* src/plugins/TimeLine.py:
|
||||
* src/plugins/Calendar.py:
|
||||
* src/plugins/AncestorReport.py:
|
||||
* src/plugins/MarkerReport.py:
|
||||
* src/plugins/DescendChart.py:
|
||||
* src/plugins/EndOfLineReport.py:
|
||||
* src/plugins/AncestorChart.py:
|
||||
* src/plugins/DetAncestralReport.py:
|
||||
* src/plugins/CustomBookText.py:
|
||||
* src/plugins/FamilyGroup.py:
|
||||
* src/plugins/GVRelGraph.py:
|
||||
* src/plugins/GVHourGlass.py:
|
||||
* src/plugins/StatisticsChart.py:
|
||||
* src/plugins/FanChart.py:
|
||||
* src/PluginUtils/__init__.py:
|
||||
* src/PluginUtils/_MenuOptions.py:
|
||||
More refactoring in the report system. Book report should work again.
|
||||
|
||||
2008-01-22 Raphael Ackermann <raphael.ackermann@gmail.com>
|
||||
* src/ReportBase/_Bibliography.py
|
||||
* src/ReportBase/_Endnotes.py
|
||||
|
@ -357,10 +357,10 @@ class EnumeratedListOption(Option):
|
||||
|
||||
#-------------------------------------------------------------------------
|
||||
#
|
||||
# PersonFilterOption class
|
||||
# FilterOption class
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
class PersonFilterOption(EnumeratedListOption):
|
||||
class FilterOption(EnumeratedListOption):
|
||||
"""
|
||||
This class describes an option that provides a list of person filters.
|
||||
Each possible value represents one of the possible filters.
|
||||
|
@ -30,7 +30,7 @@
|
||||
# of the list.
|
||||
from _MenuOptions import \
|
||||
NumberOption, BooleanOption, TextOption, \
|
||||
EnumeratedListOption, PersonFilterOption, StringOption, ColourOption, \
|
||||
EnumeratedListOption, FilterOption, StringOption, ColourOption, \
|
||||
PersonOption, PersonListOption, SurnameColourOption, FamilyOption
|
||||
from _GuiOptions import GuiMenuOptions
|
||||
from _PluginMgr import \
|
||||
|
@ -180,13 +180,14 @@ class AncestorChart(Report):
|
||||
"""
|
||||
Report.__init__(self,database,person,options_class)
|
||||
|
||||
self.display = options_class.handler.options_dict['dispf']
|
||||
self.max_generations = options_class.handler.options_dict['maxgen']
|
||||
self.force_fit = options_class.handler.options_dict['singlep']
|
||||
self.incblank = options_class.handler.options_dict['incblank']
|
||||
self.compress = options_class.handler.options_dict['compress']
|
||||
menu = options_class.menu
|
||||
self.display = menu.get_option_by_name('dispf').get_value()
|
||||
self.max_generations = menu.get_option_by_name('maxgen').get_value()
|
||||
self.force_fit = menu.get_option_by_name('singlep').get_value()
|
||||
self.incblank = menu.get_option_by_name('incblank').get_value()
|
||||
self.compress = menu.get_option_by_name('compress').get_value()
|
||||
|
||||
pid = options_class.handler.options_dict['pid']
|
||||
pid = menu.get_option_by_name('pid').get_value()
|
||||
center_person = database.get_person_from_gramps_id(pid)
|
||||
|
||||
name = name_displayer.display_formal(center_person)
|
||||
|
@ -28,7 +28,6 @@
|
||||
# python modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
import gtk
|
||||
import math
|
||||
from gettext import gettext as _
|
||||
|
||||
@ -52,10 +51,15 @@ from gen.lib import ChildRefType
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def log2(val):
|
||||
"""
|
||||
Calculate the log base 2 of a number
|
||||
"""
|
||||
return int(math.log10(val)/math.log10(2))
|
||||
|
||||
class AncestorReport(Report):
|
||||
|
||||
"""
|
||||
Ancestor Report class
|
||||
"""
|
||||
def __init__(self, database, person, options_class):
|
||||
"""
|
||||
Creates the AncestorReport object that produces the Ahnentafel report.
|
||||
@ -77,10 +81,12 @@ class AncestorReport(Report):
|
||||
Report.__init__(self, database, person, options_class)
|
||||
|
||||
self.map = {}
|
||||
self.max_generations = options_class.handler.options_dict['maxgen']
|
||||
self.pgbrk = options_class.handler.options_dict['pagebbg']
|
||||
self.opt_namebrk = options_class.handler.options_dict['namebrk']
|
||||
pid = options_class.handler.options_dict['pid']
|
||||
|
||||
menu = options_class.menu
|
||||
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()
|
||||
pid = menu.get_option_by_name('pid').get_value()
|
||||
self.center_person = database.get_person_from_gramps_id(pid)
|
||||
|
||||
def apply_filter(self, person_handle, index, generation=1):
|
||||
@ -125,25 +131,27 @@ class AncestorReport(Report):
|
||||
# people defined as the birth parents, we will select based on
|
||||
# priority in the list
|
||||
|
||||
if not father_handle and ref[0].get_father_relation() == ChildRefType.BIRTH:
|
||||
if not father_handle and \
|
||||
ref[0].get_father_relation() == ChildRefType.BIRTH:
|
||||
father_handle = family.get_father_handle()
|
||||
if not mother_handle and ref[0].get_mother_relation() == ChildRefType.BIRTH:
|
||||
if not mother_handle and \
|
||||
ref[0].get_mother_relation() == ChildRefType.BIRTH:
|
||||
mother_handle = family.get_mother_handle()
|
||||
|
||||
# Recursively call the function. It is okay if the handle is None, since
|
||||
# routine handles a handle of None
|
||||
# Recursively call the function. It is okay if the handle is None,
|
||||
# since routine handles a handle of None
|
||||
|
||||
self.apply_filter(father_handle, index*2, generation+1)
|
||||
self.apply_filter(mother_handle, (index*2)+1, generation+1)
|
||||
|
||||
def write_report(self):
|
||||
"""
|
||||
The routine the actually creates the report. At this point, the document is
|
||||
opened and ready for writing.
|
||||
The routine the actually creates the report. At this point, the document
|
||||
is opened and ready for writing.
|
||||
"""
|
||||
|
||||
# Call apply_filter to build the self.map array of people in the database that
|
||||
# match the ancestry.
|
||||
# Call apply_filter to build the self.map array of people in the
|
||||
# database that match the ancestry.
|
||||
|
||||
self.apply_filter(self.center_person.get_handle(), 1)
|
||||
|
||||
@ -191,8 +199,8 @@ class AncestorReport(Report):
|
||||
self.doc.write_text(name.strip(), mark)
|
||||
self.doc.end_bold()
|
||||
|
||||
# terminate with a period if it is not already terminated. This can happen
|
||||
# if the person's name ends with something 'Jr.'
|
||||
# terminate with a period if it is not already terminated.
|
||||
# This can happen if the person's name ends with something 'Jr.'
|
||||
if name[-1:] == '.':
|
||||
self.doc.write_text(" ")
|
||||
else:
|
||||
@ -208,9 +216,12 @@ class AncestorReport(Report):
|
||||
primary_name = person.get_primary_name()
|
||||
first = primary_name.get_first_name()
|
||||
|
||||
self.doc.write_text(ReportUtils.born_str(self.database,person,first))
|
||||
self.doc.write_text(ReportUtils.died_str(self.database,person,0))
|
||||
self.doc.write_text(ReportUtils.buried_str(self.database,person,0))
|
||||
self.doc.write_text(
|
||||
ReportUtils.born_str(self.database, person, first))
|
||||
self.doc.write_text(
|
||||
ReportUtils.died_str(self.database, person, 0))
|
||||
self.doc.write_text(
|
||||
ReportUtils.buried_str(self.database, person, 0))
|
||||
|
||||
self.doc.end_paragraph()
|
||||
|
||||
@ -243,7 +254,8 @@ class AncestorOptions(MenuReportOptions):
|
||||
menu.add_option(category_name, "maxgen", maxgen)
|
||||
|
||||
pagebbg = BooleanOption(_("Page break between generations"), False)
|
||||
pagebbg.set_help(_("Whether to start a new page after each generation."))
|
||||
pagebbg.set_help(
|
||||
_("Whether to start a new page after each generation."))
|
||||
menu.add_option(category_name, "pagebbg", pagebbg)
|
||||
|
||||
namebrk = BooleanOption(_("Add linebreak after each name"), False)
|
||||
|
@ -63,7 +63,6 @@ import gtk.glade
|
||||
# gramps modules
|
||||
#
|
||||
#-------------------------------------------------------------------------
|
||||
from gen.lib import Person
|
||||
import const
|
||||
import Utils
|
||||
import ListModel
|
||||
@ -71,14 +70,13 @@ import Errors
|
||||
import BaseDoc
|
||||
from QuestionDialog import WarningDialog, ErrorDialog
|
||||
from PluginUtils import bkitems_list, register_report, Plugins
|
||||
from PluginUtils import PersonOption, PersonFilterOption
|
||||
from PluginUtils import PersonOption, FilterOption, FamilyOption
|
||||
import ManagedWindow
|
||||
|
||||
# Import from specific modules in ReportBase
|
||||
from ReportBase._Constants import CATEGORY_BOOK, MODE_GUI, MODE_CLI
|
||||
from ReportBase._BookFormatComboBox import BookFormatComboBox
|
||||
from ReportBase._BareReportDialog import BareReportDialog
|
||||
from ReportBase._ReportDialog import ReportDialog
|
||||
from ReportBase._DocReportDialog import DocReportDialog
|
||||
from ReportBase._CommandLineReport import CommandLineReport
|
||||
from ReportBase._ReportOptions import ReportOptions
|
||||
@ -90,28 +88,83 @@ from BasicUtils import name_displayer as _nd
|
||||
# Private Functions
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
def _get_subject(options,db):
|
||||
def _initialize_options(options, dbstate):
|
||||
"""
|
||||
Validates all options by making sure that their values are consistent with
|
||||
the database.
|
||||
|
||||
menu: The Menu class
|
||||
dbase: the database the options will be applied to
|
||||
"""
|
||||
dbase = dbstate.get_database()
|
||||
if not hasattr(options, "menu"):
|
||||
return
|
||||
menu = options.menu
|
||||
|
||||
for name in menu.get_all_option_names():
|
||||
option = menu.get_option_by_name(name)
|
||||
|
||||
if isinstance(option, PersonOption):
|
||||
person = dbstate.get_active_person()
|
||||
option.set_value(person.get_gramps_id())
|
||||
|
||||
elif isinstance(option, FamilyOption):
|
||||
person = dbstate.get_active_person()
|
||||
family_list = person.get_family_handle_list()
|
||||
if family_list:
|
||||
family_handle = family_list[0]
|
||||
else:
|
||||
family_handle = dbase.get_family_handles()[0]
|
||||
family = dbase.get_family_from_handle(family_handle)
|
||||
option.set_value(family.get_gramps_id())
|
||||
|
||||
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
|
||||
PersonFilterOption)
|
||||
FilterOption)
|
||||
|
||||
options: The ReportOptions class
|
||||
db: the database for which it corresponds
|
||||
dbase: the database for which it corresponds
|
||||
"""
|
||||
if not hasattr(options, "menu"):
|
||||
return _("Not Applicable")
|
||||
menu = options.menu
|
||||
|
||||
option_names = menu.get_all_option_names()
|
||||
|
||||
for name in option_names:
|
||||
option = menu.get_option_by_name(name)
|
||||
if isinstance(option, PersonFilterOption):
|
||||
|
||||
if isinstance(option, FilterOption):
|
||||
return option.get_filter().get_name()
|
||||
|
||||
elif isinstance(option, PersonOption):
|
||||
gid = option.get_value()
|
||||
person = db.get_person_from_gramps_id(gid)
|
||||
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())
|
||||
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 = _("%s and %s (%s)") % (father_name, mother_name, family_id)
|
||||
return name
|
||||
|
||||
return _("Not Applicable")
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
@ -686,8 +739,13 @@ class BookReportSelector(ManagedWindow.ManagedWindow):
|
||||
book_label.set_use_underline(True)
|
||||
book_label.set_use_markup(True)
|
||||
|
||||
av_titles = [(_('Name'),0,150),(_('Type'),1,50),('',-1,0)]
|
||||
bk_titles = [(_('Item name'),-1,150),(_('Type'),-1,50),('',-1,0),
|
||||
av_titles = [ (_('Name'), 0, 150),
|
||||
(_('Type'), 1, 50 ),
|
||||
( '' , -1, 0 ) ]
|
||||
|
||||
bk_titles = [ (_('Item name'), -1, 150),
|
||||
(_('Type'), -1, 50 ),
|
||||
( '', -1, 0 ),
|
||||
(_('Subject'), -1, 50 ) ]
|
||||
|
||||
self.av_ncols = len(av_titles)
|
||||
@ -753,6 +811,7 @@ class BookReportSelector(ManagedWindow.ManagedWindow):
|
||||
name = saved_item.get_name()
|
||||
item = BookItem(self.dbstate, name)
|
||||
item.option_class = saved_item.option_class
|
||||
_initialize_options(item.option_class, self.dbstate)
|
||||
item.set_style_name(saved_item.get_style_name())
|
||||
self.book.append_item(item)
|
||||
|
||||
@ -773,6 +832,7 @@ class BookReportSelector(ManagedWindow.ManagedWindow):
|
||||
return
|
||||
data = self.av_model.get_data(the_iter, range(self.av_ncols))
|
||||
item = BookItem(self.dbstate, data[2])
|
||||
_initialize_options(item.option_class, self.dbstate)
|
||||
data[2] = _get_subject(item.option_class, self.db)
|
||||
self.bk_model.add(data)
|
||||
self.book.append_item(item)
|
||||
@ -840,6 +900,7 @@ class BookReportSelector(ManagedWindow.ManagedWindow):
|
||||
self.track)
|
||||
response = item_dialog.window.run()
|
||||
if response == RESPONSE_OK:
|
||||
_initialize_options(option_class, self.dbstate)
|
||||
subject = _get_subject(option_class, self.db)
|
||||
self.bk_model.model.set_value(the_iter, 2, subject)
|
||||
self.book.set_item(row, item)
|
||||
@ -932,7 +993,7 @@ class BookReportSelector(ManagedWindow.ManagedWindow):
|
||||
"""
|
||||
Save the current book in the xml booklist file.
|
||||
"""
|
||||
self.book_list = BookList(self.file,dbstate)
|
||||
self.book_list = BookList(self.file, self.dbstate)
|
||||
name = unicode(self.name_entry.get_text())
|
||||
self.book.set_name(name)
|
||||
self.book.set_dbname(self.db.get_save_path())
|
||||
@ -1138,9 +1199,10 @@ def cl_report(database,name,category,options_str_dict):
|
||||
style_name = item.option_class.handler.get_default_stylesheet_name()
|
||||
style_sheet = style_list.get_style_sheet(style_name)
|
||||
|
||||
for this_style_name in style_sheet.get_names():
|
||||
selected_style.add_style(
|
||||
this_style_name,style_sheet.get_style(this_style_name))
|
||||
for this_style_name in style_sheet.get_paragraph_style_names():
|
||||
selected_style.add_paragraph_style(
|
||||
this_style_name,
|
||||
style_sheet.get_paragraph_style(this_style_name))
|
||||
|
||||
# write report
|
||||
doc = clr.format(selected_style, clr.paper, clr.template_name, clr.orien)
|
||||
|
@ -37,7 +37,7 @@ import time
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
from PluginUtils import Tool, register_tool, PluginWindows, \
|
||||
MenuToolOptions, BooleanOption, PersonFilterOption, StringOption, \
|
||||
MenuToolOptions, BooleanOption, FilterOption, StringOption, \
|
||||
NumberOption, PersonOption
|
||||
import gen.lib
|
||||
import Config
|
||||
@ -59,16 +59,17 @@ class CalcEstDateOptions(MenuToolOptions):
|
||||
""" Adds the options """
|
||||
category_name = _("Options")
|
||||
|
||||
self.__filter = FilterOption(_("Filter"), 0)
|
||||
self.__filter.set_help(_("Select filter to restrict people"))
|
||||
menu.add_option(category_name, "filter", self.__filter)
|
||||
self.__filter.connect('value-changed', self.__filter_changed)
|
||||
|
||||
self.__pid = PersonOption(_("Filter Person"))
|
||||
self.__pid.set_help(_("The center person for the filter"))
|
||||
menu.add_option(category_name, "pid", self.__pid)
|
||||
self.__pid.connect('value-changed', self.__update_filters)
|
||||
|
||||
self.__filter = PersonFilterOption(_("Filter"), 0)
|
||||
self.__filter.set_help(_("Select filter to restrict people"))
|
||||
self.__update_filters()
|
||||
menu.add_option(category_name, "filter", self.__filter)
|
||||
self.__filter.connect('value-changed', self.__filter_changed)
|
||||
|
||||
source_text = StringOption(_("Source text"),
|
||||
_("Calculated Date Estimates"))
|
||||
|
@ -46,7 +46,7 @@ from ReportBase import Report, ReportUtils, MenuReportOptions, \
|
||||
CATEGORY_DRAW, CATEGORY_TEXT, \
|
||||
MODE_GUI, MODE_BKI, MODE_CLI
|
||||
from PluginUtils import NumberOption, BooleanOption, StringOption, \
|
||||
PersonFilterOption, EnumeratedListOption, PersonOption
|
||||
FilterOption, EnumeratedListOption, PersonOption
|
||||
import GrampsLocale
|
||||
import gen.lib
|
||||
from Utils import probably_alive, ProgressMeter
|
||||
@ -122,30 +122,32 @@ class Calendar(Report):
|
||||
"""
|
||||
def __init__(self, database, person, options_class):
|
||||
Report.__init__(self, database, person, options_class)
|
||||
if 'titletext' in options_class.handler.options_dict.keys():
|
||||
menu = options_class.menu
|
||||
if 'titletext' in menu.get_all_option_names():
|
||||
# report and graphic share most of the same code
|
||||
# but calendar doesn't have a title
|
||||
self.titletext = options_class.handler.options_dict['titletext']
|
||||
if 'relationships' in options_class.handler.options_dict.keys():
|
||||
self.titletext = menu.get_option_by_name('titletext').get_value()
|
||||
if 'relationships' in menu.get_all_option_names():
|
||||
# report and graphic share most of the same code
|
||||
# but calendar doesn't show relationships
|
||||
self.relationships = options_class.handler.options_dict['relationships']
|
||||
self.relationships = \
|
||||
menu.get_option_by_name('relationships').get_value()
|
||||
else:
|
||||
self.relationships = False
|
||||
self.year = options_class.handler.options_dict['year']
|
||||
self.name_format = options_class.handler.options_dict['name_format']
|
||||
self.country = options_class.handler.options_dict['country']
|
||||
self.anniversaries = options_class.handler.options_dict['anniversaries']
|
||||
self.start_dow = options_class.handler.options_dict['start_dow']
|
||||
self.maiden_name = options_class.handler.options_dict['maiden_name']
|
||||
self.alive = options_class.handler.options_dict['alive']
|
||||
self.birthdays = options_class.handler.options_dict['birthdays']
|
||||
self.text1 = options_class.handler.options_dict['text1']
|
||||
self.text2 = options_class.handler.options_dict['text2']
|
||||
self.text3 = options_class.handler.options_dict['text3']
|
||||
self.filter_option = options_class.menu.get_option_by_name('filter')
|
||||
self.year = menu.get_option_by_name('year').get_value()
|
||||
self.name_format = menu.get_option_by_name('name_format').get_value()
|
||||
self.country = menu.get_option_by_name('country').get_value()
|
||||
self.anniversaries = menu.get_option_by_name('anniversaries').get_value()
|
||||
self.start_dow = menu.get_option_by_name('start_dow').get_value()
|
||||
self.maiden_name = menu.get_option_by_name('maiden_name').get_value()
|
||||
self.alive = menu.get_option_by_name('alive').get_value()
|
||||
self.birthdays = menu.get_option_by_name('birthdays').get_value()
|
||||
self.text1 = menu.get_option_by_name('text1').get_value()
|
||||
self.text2 = menu.get_option_by_name('text2').get_value()
|
||||
self.text3 = menu.get_option_by_name('text3').get_value()
|
||||
self.filter_option = menu.get_option_by_name('filter')
|
||||
self.filter = self.filter_option.get_filter()
|
||||
self.pid = options_class.handler.options_dict['pid']
|
||||
self.pid = menu.get_option_by_name('pid').get_value()
|
||||
|
||||
self.title = _("Calendar Report") #% name
|
||||
|
||||
@ -488,17 +490,18 @@ class CalendarOptions(MenuReportOptions):
|
||||
year.set_help(_("Year of calendar"))
|
||||
menu.add_option(category_name,"year", year)
|
||||
|
||||
self.__filter = FilterOption(_("Filter"), 0)
|
||||
self.__filter.set_help(
|
||||
_("Select filter to restrict people that appear on calendar"))
|
||||
menu.add_option(category_name, "filter", self.__filter)
|
||||
self.__filter.connect('value-changed', self.__filter_changed)
|
||||
|
||||
self.__pid = PersonOption(_("Filter Person"))
|
||||
self.__pid.set_help(_("The center person for the filter"))
|
||||
menu.add_option(category_name, "pid", self.__pid)
|
||||
self.__pid.connect('value-changed', self.__update_filters)
|
||||
|
||||
self.__filter = PersonFilterOption(_("Filter"), 0)
|
||||
self.__filter.set_help(
|
||||
_("Select filter to restrict people that appear on calendar"))
|
||||
self.__update_filters()
|
||||
menu.add_option(category_name, "filter", self.__filter)
|
||||
self.__filter.connect('value-changed', self.__filter_changed)
|
||||
|
||||
name_format = EnumeratedListOption(_("Name format"), -1)
|
||||
for num, name, fmt_str, act in name_displayer.get_name_format():
|
||||
|
@ -71,9 +71,10 @@ class CustomText(Report):
|
||||
"""
|
||||
Report.__init__(self, database, person, options_class)
|
||||
|
||||
self.top_text = options_class.handler.options_dict['top']
|
||||
self.middle_text = options_class.handler.options_dict['mid']
|
||||
self.bottom_text = options_class.handler.options_dict['bot']
|
||||
menu = options_class.menu
|
||||
self.top_text = menu.get_option_by_name('top').get_value()
|
||||
self.middle_text = menu.get_option_by_name('mid').get_value()
|
||||
self.bottom_text = menu.get_option_by_name('bot').get_value()
|
||||
|
||||
def write_report(self):
|
||||
self.doc.start_paragraph('CBT-Initial')
|
||||
|
@ -36,7 +36,6 @@ from ReportBase import Report, MenuReportOptions, \
|
||||
from SubstKeywords import SubstKeywords
|
||||
from gettext import gettext as _
|
||||
import BaseDoc
|
||||
import math
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
@ -121,11 +120,12 @@ class DescendChart(Report):
|
||||
"""
|
||||
Report.__init__(self, database, person, options_class)
|
||||
|
||||
self.display = options_class.handler.options_dict['dispf']
|
||||
self.max_generations = options_class.handler.options_dict['maxgen']
|
||||
self.force_fit = options_class.handler.options_dict['singlep']
|
||||
self.incblank = options_class.handler.options_dict['incblank']
|
||||
pid = options_class.handler.options_dict['pid']
|
||||
menu = options_class.menu
|
||||
self.display = menu.get_option_by_name('dispf').get_value()
|
||||
self.max_generations = menu.get_option_by_name('maxgen').get_value()
|
||||
self.force_fit = menu.get_option_by_name('singlep').get_value()
|
||||
self.incblank = menu.get_option_by_name('incblank').get_value()
|
||||
pid = menu.get_option_by_name('pid').get_value()
|
||||
center_person = database.get_person_from_gramps_id(pid)
|
||||
|
||||
name = name_displayer.display_formal(center_person)
|
||||
|
@ -28,7 +28,6 @@
|
||||
# standard python modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
import os
|
||||
from gettext import gettext as _
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
@ -40,19 +39,10 @@ from PluginUtils import register_report, NumberOption, PersonOption
|
||||
from ReportBase import Report, ReportUtils, MenuReportOptions, \
|
||||
CATEGORY_TEXT, MODE_GUI, MODE_BKI, MODE_CLI
|
||||
import BaseDoc
|
||||
import Errors
|
||||
import Sort
|
||||
from QuestionDialog import ErrorDialog
|
||||
from BasicUtils import name_displayer
|
||||
import DateHandler
|
||||
|
||||
#------------------------------------------------------------------------
|
||||
#
|
||||
# GTK/GNOME modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
import gtk
|
||||
|
||||
_BORN = _('b.')
|
||||
_DIED = _('d.')
|
||||
|
||||
@ -82,8 +72,9 @@ class DescendantReport(Report):
|
||||
|
||||
Report.__init__(self, database, person, options_class)
|
||||
|
||||
self.max_generations = options_class.handler.options_dict['gen']
|
||||
pid = options_class.handler.options_dict['pid']
|
||||
menu = options_class.menu
|
||||
self.max_generations = menu.get_option_by_name('gen').get_value()
|
||||
pid = menu.get_option_by_name('pid').get_value()
|
||||
self.center_person = database.get_person_from_gramps_id(pid)
|
||||
sort = Sort.Sort(self.database)
|
||||
self.by_birthdate = sort.by_birthdate
|
||||
|
@ -76,53 +76,54 @@ class DetAncestorReport(Report):
|
||||
gen - Maximum number of generations to include.
|
||||
pagebgg - Whether to include page breaks between generations.
|
||||
firstName - Whether to use first names instead of pronouns.
|
||||
fullDate - Whether to use full dates instead of just year.
|
||||
listChildren - Whether to list children.
|
||||
includeNotes - Whether to include notes.
|
||||
includeAttrs - Whether to include attributes
|
||||
blankPlace - Whether to replace missing Places with ___________.
|
||||
fulldate - Whether to use full dates instead of just year.
|
||||
listchildren - Whether to list 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 mary).
|
||||
calcageflag - Whether to compute age.
|
||||
dupperson - Whether to omit duplicate ancestors (e.g. when distant cousins mary).
|
||||
verbose - Whether to use complete sentences
|
||||
childRef - Whether to add descendant references in child list.
|
||||
addImages - Whether to include images.
|
||||
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.
|
||||
"""
|
||||
Report.__init__(self, database, person, options_class)
|
||||
|
||||
self.map = {}
|
||||
|
||||
self.max_generations = options_class.handler.options_dict['gen']
|
||||
self.pgbrk = options_class.handler.options_dict['pagebbg']
|
||||
self.fullDate = options_class.handler.options_dict['fulldates']
|
||||
self.listChildren = options_class.handler.options_dict['listc']
|
||||
self.includeNotes = options_class.handler.options_dict['incnotes']
|
||||
self.usecall = options_class.handler.options_dict['usecall']
|
||||
self.blankPlace = options_class.handler.options_dict['repplace']
|
||||
self.blankDate = options_class.handler.options_dict['repdate']
|
||||
self.calcAgeFlag = options_class.handler.options_dict['computeage']
|
||||
self.dupPerson = options_class.handler.options_dict['omitda']
|
||||
self.verbose = options_class.handler.options_dict['verbose']
|
||||
self.childRef = options_class.handler.options_dict['desref']
|
||||
self.addImages = options_class.handler.options_dict['incphotos']
|
||||
self.includeNames = options_class.handler.options_dict['incnames']
|
||||
self.includeEvents = options_class.handler.options_dict['incevents']
|
||||
self.includeAddr = options_class.handler.options_dict['incaddresses']
|
||||
self.includeSources= options_class.handler.options_dict['incsources']
|
||||
self.includeAttrs = options_class.handler.options_dict['incattrs']
|
||||
pid = options_class.handler.options_dict['pid']
|
||||
menu = options_class.menu
|
||||
self.max_generations = menu.get_option_by_name('gen').get_value()
|
||||
self.pgbrk = menu.get_option_by_name('pagebbg').get_value()
|
||||
self.fulldate = menu.get_option_by_name('fulldates').get_value()
|
||||
self.listchildren = menu.get_option_by_name('listc').get_value()
|
||||
self.includenotes = menu.get_option_by_name('incnotes').get_value()
|
||||
self.usecall = menu.get_option_by_name('usecall').get_value()
|
||||
blankplace = menu.get_option_by_name('repplace').get_value()
|
||||
blankdate = menu.get_option_by_name('repdate').get_value()
|
||||
self.calcageflag = menu.get_option_by_name('computeage').get_value()
|
||||
self.dupperson = menu.get_option_by_name('omitda').get_value()
|
||||
self.verbose = menu.get_option_by_name('verbose').get_value()
|
||||
self.childref = menu.get_option_by_name('desref').get_value()
|
||||
self.addimages = menu.get_option_by_name('incphotos').get_value()
|
||||
self.inc_names = menu.get_option_by_name('incnames').get_value()
|
||||
self.inc_events = menu.get_option_by_name('incevents').get_value()
|
||||
self.inc_addr = menu.get_option_by_name('incaddresses').get_value()
|
||||
self.inc_sources = menu.get_option_by_name('incsources').get_value()
|
||||
self.inc_attrs = menu.get_option_by_name('incattrs').get_value()
|
||||
pid = menu.get_option_by_name('pid').get_value()
|
||||
self.center_person = database.get_person_from_gramps_id(pid)
|
||||
|
||||
self.gen_handles = {}
|
||||
self.prev_gen_handles = {}
|
||||
|
||||
if self.blankDate:
|
||||
if blankdate:
|
||||
self.EMPTY_DATE = EMPTY_ENTRY
|
||||
else:
|
||||
self.EMPTY_DATE = ""
|
||||
|
||||
if self.blankPlace:
|
||||
if blankplace:
|
||||
self.EMPTY_PLACE = EMPTY_ENTRY
|
||||
else:
|
||||
self.EMPTY_PLACE = ""
|
||||
@ -166,26 +167,26 @@ class DetAncestorReport(Report):
|
||||
self.doc.write_text(text,mark)
|
||||
self.doc.end_paragraph()
|
||||
generation = generation + 1
|
||||
if self.childRef:
|
||||
if self.childref:
|
||||
self.prev_gen_handles= self.gen_handles.copy()
|
||||
self.gen_handles.clear()
|
||||
|
||||
person_handle = self.map[key]
|
||||
person = self.database.get_person_from_handle(person_handle)
|
||||
self.gen_handles[person_handle] = key
|
||||
dupPerson = self.write_person(key)
|
||||
if dupPerson == 0: # Is this a duplicate ind record
|
||||
if self.listChildren or self.includeEvents:
|
||||
dupperson = self.write_person(key)
|
||||
if dupperson == 0: # Is this a duplicate ind record
|
||||
if self.listchildren or self.inc_events:
|
||||
for family_handle in person.get_family_handle_list():
|
||||
family = self.database.get_family_from_handle(family_handle)
|
||||
mother_handle = family.get_mother_handle()
|
||||
if mother_handle == None or \
|
||||
person.get_gender() == gen.lib.Person.FEMALE:
|
||||
if self.listChildren:
|
||||
if self.listchildren:
|
||||
self.write_children(family)
|
||||
if self.includeEvents:
|
||||
if self.inc_events:
|
||||
self.write_family_events(family)
|
||||
if self.includeSources:
|
||||
if self.inc_sources:
|
||||
Endnotes.write_endnotes(self.bibli,self.database,self.doc)
|
||||
|
||||
def write_person(self, key):
|
||||
@ -195,7 +196,7 @@ class DetAncestorReport(Report):
|
||||
person = self.database.get_person_from_handle(person_handle)
|
||||
plist = person.get_media_list()
|
||||
|
||||
if self.addImages and len(plist) > 0:
|
||||
if self.addimages and len(plist) > 0:
|
||||
photo = plist[0]
|
||||
ReportUtils.insert_image(self.database,self.doc,photo)
|
||||
|
||||
@ -212,7 +213,7 @@ class DetAncestorReport(Report):
|
||||
self.doc.write_text("%s. " % self.endnotes(person))
|
||||
self.doc.end_bold()
|
||||
|
||||
if self.dupPerson:
|
||||
if self.dupperson:
|
||||
# Check for duplicate record (result of distant cousins marrying)
|
||||
keys = self.map.keys()
|
||||
keys.sort()
|
||||
@ -274,7 +275,7 @@ class DetAncestorReport(Report):
|
||||
self.write_mate(person)
|
||||
|
||||
notelist = person.get_note_list()
|
||||
if len(notelist) > 0 and self.includeNotes:
|
||||
if len(notelist) > 0 and self.includenotes:
|
||||
self.doc.start_paragraph("DAR-NoteHeader")
|
||||
self.doc.write_text(_("Notes for %s") % name)
|
||||
self.doc.end_paragraph()
|
||||
@ -283,7 +284,7 @@ class DetAncestorReport(Report):
|
||||
self.doc.write_note(note.get(),note.get_format(),"DAR-Entry")
|
||||
|
||||
first = True
|
||||
if self.includeNames:
|
||||
if self.inc_names:
|
||||
for alt_name in person.get_alternate_names():
|
||||
if first:
|
||||
self.doc.start_paragraph('DAR-MoreHeader')
|
||||
@ -301,7 +302,7 @@ class DetAncestorReport(Report):
|
||||
})
|
||||
self.doc.end_paragraph()
|
||||
|
||||
if self.includeEvents:
|
||||
if self.inc_events:
|
||||
birth_ref = person.get_birth_ref()
|
||||
death_ref = person.get_death_ref()
|
||||
for event_ref in person.get_primary_event_ref_list():
|
||||
@ -317,7 +318,7 @@ class DetAncestorReport(Report):
|
||||
|
||||
self.write_event(event_ref)
|
||||
|
||||
if self.includeAddr:
|
||||
if self.inc_addr:
|
||||
for addr in person.get_address_list():
|
||||
if first:
|
||||
self.doc.start_paragraph('DAR-MoreHeader')
|
||||
@ -336,7 +337,7 @@ class DetAncestorReport(Report):
|
||||
self.doc.write_text( self.endnotes(addr) )
|
||||
self.doc.end_paragraph()
|
||||
|
||||
if self.includeAttrs:
|
||||
if self.inc_attrs:
|
||||
attrs = person.get_attribute_list()
|
||||
if first and attrs:
|
||||
self.doc.start_paragraph('DAR-MoreHeader')
|
||||
@ -394,7 +395,7 @@ class DetAncestorReport(Report):
|
||||
|
||||
self.doc.write_text(text)
|
||||
|
||||
if self.includeAttrs:
|
||||
if self.inc_attrs:
|
||||
text = ""
|
||||
attr_list = event.get_attribute_list()
|
||||
attr_list.extend(event_ref.get_attribute_list())
|
||||
@ -410,7 +411,7 @@ class DetAncestorReport(Report):
|
||||
|
||||
self.doc.end_paragraph()
|
||||
|
||||
if self.includeNotes:
|
||||
if self.includenotes:
|
||||
# if the event or event reference has a note attached to it,
|
||||
# get the text and format it correctly
|
||||
notelist = event.get_note_list()
|
||||
@ -509,7 +510,7 @@ class DetAncestorReport(Report):
|
||||
child_name = _nd.display(child)
|
||||
child_mark = ReportUtils.get_person_mark(self.database,child)
|
||||
|
||||
if self.childRef and self.prev_gen_handles.get(child_handle):
|
||||
if self.childref and self.prev_gen_handles.get(child_handle):
|
||||
value = str(self.prev_gen_handles.get(child_handle))
|
||||
child_name += " [%s]" % value
|
||||
|
||||
@ -629,9 +630,9 @@ class DetAncestorReport(Report):
|
||||
self.doc.end_paragraph()
|
||||
|
||||
if person_name and mate.get_gender()==gen.lib.Person.MALE:
|
||||
if self.listChildren:
|
||||
if self.listchildren:
|
||||
self.write_children(family)
|
||||
if self.includeEvents:
|
||||
if self.inc_events:
|
||||
self.write_family_events(family)
|
||||
|
||||
def calc_age(self,ind):
|
||||
@ -645,13 +646,13 @@ class DetAncestorReport(Report):
|
||||
months: 2
|
||||
days: 3
|
||||
"""
|
||||
if self.calcAgeFlag:
|
||||
if self.calcageflag:
|
||||
return ReportUtils.old_calc_age(self.database,ind)
|
||||
else:
|
||||
return (0,0)
|
||||
|
||||
def endnotes(self,obj):
|
||||
if not obj or not self.includeSources:
|
||||
if not obj or not self.inc_sources:
|
||||
return ""
|
||||
|
||||
txt = Endnotes.cite_source(self.bibli,obj)
|
||||
|
@ -78,44 +78,45 @@ class DetDescendantReport(Report):
|
||||
gen - Maximum number of generations to include.
|
||||
pagebgg - Whether to include page breaks between generations.
|
||||
firstName - Whether to use first names instead of pronouns.
|
||||
fullDate - Whether to use full dates instead of just year.
|
||||
listChildren - Whether to list children.
|
||||
includeMates - Whether to include information about spouses
|
||||
includeNotes - Whether to include notes.
|
||||
includeAttrs - Whether to include attributes
|
||||
fulldate - Whether to use full dates instead of just year.
|
||||
listchildren - Whether to list children.
|
||||
inc_mates - Whether to include information about spouses
|
||||
inc_notes - Whether to include notes.
|
||||
inc_attrs - 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 mary).
|
||||
calcageflag - Whether to compute age.
|
||||
dubperson - Whether to omit duplicate ancestors (e.g. when distant cousins mary).
|
||||
verbose - Whether to use complete sentences
|
||||
childRef - Whether to add descendant references in child list.
|
||||
addImages - Whether to include images.
|
||||
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.
|
||||
"""
|
||||
Report.__init__(self, database, person, options_class)
|
||||
|
||||
self.map = {}
|
||||
|
||||
self.max_generations = options_class.handler.options_dict['gen']
|
||||
self.pgbrk = options_class.handler.options_dict['pagebbg']
|
||||
self.fullDate = options_class.handler.options_dict['fulldates']
|
||||
self.listChildren = options_class.handler.options_dict['listc']
|
||||
self.includeNotes = options_class.handler.options_dict['incnotes']
|
||||
self.usecall = options_class.handler.options_dict['usecall']
|
||||
self.blankPlace = options_class.handler.options_dict['repplace']
|
||||
self.blankDate = options_class.handler.options_dict['repdate']
|
||||
self.calcAgeFlag = options_class.handler.options_dict['computeage']
|
||||
self.dupPerson = options_class.handler.options_dict['omitda']
|
||||
self.verbose = options_class.handler.options_dict['verbose']
|
||||
self.childRef = options_class.handler.options_dict['desref']
|
||||
self.addImages = options_class.handler.options_dict['incphotos']
|
||||
self.includeNames = options_class.handler.options_dict['incnames']
|
||||
self.includeEvents = options_class.handler.options_dict['incevents']
|
||||
self.includeAddr = options_class.handler.options_dict['incaddresses']
|
||||
self.includeSources= options_class.handler.options_dict['incsources']
|
||||
self.includeMates = options_class.handler.options_dict['incmates']
|
||||
self.includeAttrs = options_class.handler.options_dict['incattrs']
|
||||
pid = options_class.handler.options_dict['pid']
|
||||
menu = options_class.menu
|
||||
self.max_generations = menu.get_option_by_name('gen').get_value()
|
||||
self.pgbrk = menu.get_option_by_name('pagebbg').get_value()
|
||||
self.fulldate = menu.get_option_by_name('fulldates').get_value()
|
||||
self.listchildren = menu.get_option_by_name('listc').get_value()
|
||||
self.inc_notes = menu.get_option_by_name('incnotes').get_value()
|
||||
self.usecall = menu.get_option_by_name('usecall').get_value()
|
||||
blankplace = menu.get_option_by_name('repplace').get_value()
|
||||
blankdate = menu.get_option_by_name('repdate').get_value()
|
||||
self.calcageflag = menu.get_option_by_name('computeage').get_value()
|
||||
self.dubperson = menu.get_option_by_name('omitda').get_value()
|
||||
self.verbose = menu.get_option_by_name('verbose').get_value()
|
||||
self.childref = menu.get_option_by_name('desref').get_value()
|
||||
self.addimages = menu.get_option_by_name('incphotos').get_value()
|
||||
self.inc_names = menu.get_option_by_name('incnames').get_value()
|
||||
self.inc_events = menu.get_option_by_name('incevents').get_value()
|
||||
self.inc_addr = menu.get_option_by_name('incaddresses').get_value()
|
||||
self.inc_sources = menu.get_option_by_name('incsources').get_value()
|
||||
self.inc_mates = menu.get_option_by_name('incmates').get_value()
|
||||
self.inc_attrs = menu.get_option_by_name('incattrs').get_value()
|
||||
pid = menu.get_option_by_name('pid').get_value()
|
||||
self.center_person = database.get_person_from_gramps_id(pid)
|
||||
|
||||
self.gen_handles = {}
|
||||
@ -123,12 +124,12 @@ class DetDescendantReport(Report):
|
||||
self.gen_keys = []
|
||||
self.henry = {}
|
||||
|
||||
if self.blankDate:
|
||||
if blankdate:
|
||||
self.EMPTY_DATE = EMPTY_ENTRY
|
||||
else:
|
||||
self.EMPTY_DATE = ""
|
||||
|
||||
if self.blankPlace:
|
||||
if blankplace:
|
||||
self.EMPTY_PLACE = EMPTY_ENTRY
|
||||
else:
|
||||
self.EMPTY_PLACE = ""
|
||||
@ -195,7 +196,7 @@ class DetDescendantReport(Report):
|
||||
mark = BaseDoc.IndexMark(text,BaseDoc.INDEX_TYPE_TOC,2)
|
||||
self.doc.write_text(text,mark)
|
||||
self.doc.end_paragraph()
|
||||
if self.childRef:
|
||||
if self.childref:
|
||||
self.prev_gen_handles = self.gen_handles.copy()
|
||||
self.gen_handles.clear()
|
||||
|
||||
@ -205,7 +206,7 @@ class DetDescendantReport(Report):
|
||||
self.gen_handles[person_handle] = key
|
||||
self.write_person(key)
|
||||
|
||||
if self.includeSources:
|
||||
if self.inc_sources:
|
||||
Endnotes.write_endnotes(self.bibli,self.database,self.doc)
|
||||
|
||||
def write_person(self, key):
|
||||
@ -228,7 +229,7 @@ class DetDescendantReport(Report):
|
||||
self.doc.write_text("%s. " % self.endnotes(person))
|
||||
self.doc.end_bold()
|
||||
|
||||
if self.dupPerson:
|
||||
if self.dubperson:
|
||||
# Check for duplicate record (result of distant cousins marrying)
|
||||
keys = self.map.keys()
|
||||
keys.sort()
|
||||
@ -245,10 +246,10 @@ class DetDescendantReport(Report):
|
||||
|
||||
self.write_person_info(person)
|
||||
|
||||
if self.listChildren or self.includeEvents or self.includeMates:
|
||||
if self.listchildren or self.inc_events or self.inc_mates:
|
||||
for family_handle in person.get_family_handle_list():
|
||||
family = self.database.get_family_from_handle(family_handle)
|
||||
if self.includeMates:
|
||||
if self.inc_mates:
|
||||
if person.get_gender() == gen.lib.Person.MALE:
|
||||
mate_handle = family.get_mother_handle()
|
||||
else:
|
||||
@ -256,9 +257,9 @@ class DetDescendantReport(Report):
|
||||
if mate_handle:
|
||||
mate = self.database.get_person_from_handle(mate_handle)
|
||||
self.write_person_info(mate)
|
||||
if self.listChildren:
|
||||
if self.listchildren:
|
||||
self.write_children(family)
|
||||
if self.includeEvents:
|
||||
if self.inc_events:
|
||||
self.write_family_events(family)
|
||||
|
||||
def write_event(self, event_ref):
|
||||
@ -298,7 +299,7 @@ class DetDescendantReport(Report):
|
||||
|
||||
self.doc.write_text(text)
|
||||
|
||||
if self.includeAttrs:
|
||||
if self.inc_attrs:
|
||||
text = ""
|
||||
attr_list = event.get_attribute_list()
|
||||
attr_list.extend(event_ref.get_attribute_list())
|
||||
@ -314,7 +315,7 @@ class DetDescendantReport(Report):
|
||||
|
||||
self.doc.end_paragraph()
|
||||
|
||||
if self.includeNotes:
|
||||
if self.inc_notes:
|
||||
# if the event or event reference has a note attached to it,
|
||||
# get the text and format it correctly
|
||||
notelist = event.get_note_list()
|
||||
@ -414,7 +415,7 @@ class DetDescendantReport(Report):
|
||||
child_name = _nd.display(child)
|
||||
child_mark = ReportUtils.get_person_mark(self.database,child)
|
||||
|
||||
if self.childRef and self.prev_gen_handles.get(child_handle):
|
||||
if self.childref and self.prev_gen_handles.get(child_handle):
|
||||
value = str(self.prev_gen_handles.get(child_handle))
|
||||
child_name += " [%s]" % value
|
||||
|
||||
@ -470,7 +471,7 @@ class DetDescendantReport(Report):
|
||||
name = _nd.display_formal(person)
|
||||
|
||||
plist = person.get_media_list()
|
||||
if self.addImages and len(plist) > 0:
|
||||
if self.addimages and len(plist) > 0:
|
||||
photo = plist[0]
|
||||
ReportUtils.insert_image(self.database,self.doc,photo)
|
||||
|
||||
@ -517,7 +518,7 @@ class DetDescendantReport(Report):
|
||||
self.doc.end_paragraph()
|
||||
|
||||
notelist = person.get_note_list()
|
||||
if len(notelist) > 0 and self.includeNotes:
|
||||
if len(notelist) > 0 and self.inc_notes:
|
||||
self.doc.start_paragraph("DDR-NoteHeader")
|
||||
self.doc.write_text(_("Notes for %s") % name)
|
||||
self.doc.end_paragraph()
|
||||
@ -526,7 +527,7 @@ class DetDescendantReport(Report):
|
||||
self.doc.write_note(note.get(),note.get_format(),"DDR-Entry")
|
||||
|
||||
first = True
|
||||
if self.includeNames:
|
||||
if self.inc_names:
|
||||
for alt_name in person.get_alternate_names():
|
||||
if first:
|
||||
self.doc.start_paragraph('DDR-MoreHeader')
|
||||
@ -544,7 +545,7 @@ class DetDescendantReport(Report):
|
||||
})
|
||||
self.doc.end_paragraph()
|
||||
|
||||
if self.includeEvents:
|
||||
if self.inc_events:
|
||||
for event_ref in person.get_primary_event_ref_list():
|
||||
if first:
|
||||
self.doc.start_paragraph('DDR-MoreHeader')
|
||||
@ -555,7 +556,7 @@ class DetDescendantReport(Report):
|
||||
|
||||
self.write_event(event_ref)
|
||||
|
||||
if self.includeAddr:
|
||||
if self.inc_addr:
|
||||
for addr in person.get_address_list():
|
||||
if first:
|
||||
self.doc.start_paragraph('DDR-MoreHeader')
|
||||
@ -574,7 +575,7 @@ class DetDescendantReport(Report):
|
||||
self.doc.write_text( self.endnotes(addr) )
|
||||
self.doc.end_paragraph()
|
||||
|
||||
if self.includeAttrs:
|
||||
if self.inc_attrs:
|
||||
attrs = person.get_attribute_list()
|
||||
if first and attrs:
|
||||
self.doc.start_paragraph('DDR-MoreHeader')
|
||||
@ -603,13 +604,13 @@ class DetDescendantReport(Report):
|
||||
months: 2
|
||||
days: 3
|
||||
"""
|
||||
if self.calcAgeFlag:
|
||||
if self.calcageflag:
|
||||
return ReportUtils.old_calc_age(self.database, ind)
|
||||
else:
|
||||
return (0, 0)
|
||||
|
||||
def endnotes(self, obj):
|
||||
if not obj or not self.includeSources:
|
||||
if not obj or not self.inc_sources:
|
||||
return ""
|
||||
|
||||
txt = Endnotes.cite_source(self.bibli, obj)
|
||||
|
@ -64,7 +64,8 @@ class EndOfLineReport(Report):
|
||||
"""
|
||||
Report.__init__(self, database, person, options_class)
|
||||
|
||||
pid = options_class.handler.options_dict['pid']
|
||||
menu = options_class.menu
|
||||
pid = menu.get_option_by_name('pid').get_value()
|
||||
self.center_person = database.get_person_from_gramps_id(pid)
|
||||
|
||||
# eol_map is a map whose:
|
||||
@ -85,6 +86,9 @@ class EndOfLineReport(Report):
|
||||
self.get_eol(self.center_person, 1, [])
|
||||
|
||||
def get_eol(self, person, gen, pedigree):
|
||||
"""
|
||||
Recursively find the end of the line for each person
|
||||
"""
|
||||
name = name_displayer.display(person)
|
||||
pedigree = pedigree + [name]
|
||||
person_is_eol = False
|
||||
|
@ -61,24 +61,25 @@ class FamilyGroup(Report):
|
||||
includeAttrs - Whether to include attributes
|
||||
"""
|
||||
Report.__init__(self, database, person, options_class)
|
||||
menu = options_class.menu
|
||||
|
||||
self.family_handle = None
|
||||
|
||||
family_id = options_class.handler.options_dict['family_id']
|
||||
family_id = menu.get_option_by_name('family_id').get_value()
|
||||
family = database.get_family_from_gramps_id(family_id)
|
||||
self.family_handle = family.get_handle()
|
||||
|
||||
self.recursive = options_class.handler.options_dict['recursive']
|
||||
self.missingInfo = options_class.handler.options_dict['missinginfo']
|
||||
self.generations = options_class.handler.options_dict['generations']
|
||||
self.incParEvents = options_class.handler.options_dict['incParEvents']
|
||||
self.incParAddr = options_class.handler.options_dict['incParAddr']
|
||||
self.incParNotes = options_class.handler.options_dict['incParNotes']
|
||||
self.incParNames = options_class.handler.options_dict['incParNames']
|
||||
self.incParMar = options_class.handler.options_dict['incParMar']
|
||||
self.incRelDates = options_class.handler.options_dict['incRelDates']
|
||||
self.incChiMar = options_class.handler.options_dict['incChiMar']
|
||||
self.includeAttrs = options_class.handler.options_dict['incattrs']
|
||||
self.recursive = menu.get_option_by_name('recursive').get_value()
|
||||
self.missingInfo = menu.get_option_by_name('missinginfo').get_value()
|
||||
self.generations = menu.get_option_by_name('generations').get_value()
|
||||
self.incParEvents = menu.get_option_by_name('incParEvents').get_value()
|
||||
self.incParAddr = menu.get_option_by_name('incParAddr').get_value()
|
||||
self.incParNotes = menu.get_option_by_name('incParNotes').get_value()
|
||||
self.incParNames = menu.get_option_by_name('incParNames').get_value()
|
||||
self.incParMar = menu.get_option_by_name('incParMar').get_value()
|
||||
self.incRelDates = menu.get_option_by_name('incRelDates').get_value()
|
||||
self.incChiMar = menu.get_option_by_name('incChiMar').get_value()
|
||||
self.includeAttrs = menu.get_option_by_name('incattrs').get_value()
|
||||
|
||||
def dump_parent_event(self,name,event):
|
||||
place = ""
|
||||
|
@ -83,11 +83,12 @@ class FanChart(Report):
|
||||
radial - Print radial texts roundabout or as upright as possible.
|
||||
"""
|
||||
|
||||
self.max_generations = options_class.handler.options_dict['maxgen']
|
||||
self.circle = options_class.handler.options_dict['circle']
|
||||
self.background = options_class.handler.options_dict['background']
|
||||
self.radial = options_class.handler.options_dict['radial']
|
||||
pid = options_class.handler.options_dict['pid']
|
||||
menu = options_class.menu
|
||||
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.center_person = database.get_person_from_gramps_id(pid)
|
||||
|
||||
self.background_style = []
|
||||
|
@ -17,7 +17,7 @@
|
||||
# along with this program; if not, write to the Free Software
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
# $Id: $
|
||||
# $Id$
|
||||
|
||||
"""
|
||||
Generate an hourglass graph using the GraphViz generator.
|
||||
@ -55,9 +55,11 @@ class HourGlassReport(Report):
|
||||
"""
|
||||
Report.__init__(self, database, person, options_class)
|
||||
self.__db = database
|
||||
self.max_descend = options_class.handler.options_dict['maxdescend']
|
||||
self.max_ascend = options_class.handler.options_dict['maxascend']
|
||||
pid = options_class.handler.options_dict['pid']
|
||||
|
||||
menu = options_class.menu
|
||||
self.max_descend = menu.get_option_by_name('maxdescend').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 = database.get_person_from_gramps_id(pid)
|
||||
|
||||
def write_report(self):
|
||||
|
@ -23,7 +23,7 @@
|
||||
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
#
|
||||
|
||||
# $Id: $
|
||||
# $Id$
|
||||
|
||||
"""
|
||||
Create a relationship graph using Graphviz
|
||||
@ -41,7 +41,7 @@ from TransUtils import sgettext as _
|
||||
# GRAMPS modules
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
from PluginUtils import register_report, PersonFilterOption, \
|
||||
from PluginUtils import register_report, FilterOption, \
|
||||
EnumeratedListOption, BooleanOption, PersonOption
|
||||
from ReportBase import Report, ReportUtils, MenuReportOptions, \
|
||||
MODE_GUI, MODE_CLI, CATEGORY_GRAPHVIZ
|
||||
@ -116,22 +116,22 @@ class RelGraphReport(Report):
|
||||
}
|
||||
self.database = database
|
||||
|
||||
options = options_class.handler.options_dict
|
||||
self.includeid = options['incid']
|
||||
self.includedates = options['incdate']
|
||||
self.includeurl = options['url']
|
||||
self.includeimg = options['includeImages']
|
||||
self.imgpos = options['imageOnTheSide']
|
||||
self.adoptionsdashed = options['dashed']
|
||||
self.show_families = options['showfamily']
|
||||
self.just_years = options['justyears']
|
||||
self.placecause = options['placecause']
|
||||
self.colorize = options['color']
|
||||
menu = options_class.menu
|
||||
self.includeid = menu.get_option_by_name('incid').get_value()
|
||||
self.includedates = menu.get_option_by_name('incdate').get_value()
|
||||
self.includeurl = menu.get_option_by_name('url').get_value()
|
||||
self.includeimg = menu.get_option_by_name('includeImages').get_value()
|
||||
self.imgpos = menu.get_option_by_name('imageOnTheSide').get_value()
|
||||
self.adoptionsdashed = menu.get_option_by_name('dashed').get_value()
|
||||
self.show_families = menu.get_option_by_name('showfamily').get_value()
|
||||
self.just_years = menu.get_option_by_name('justyears').get_value()
|
||||
self.placecause = menu.get_option_by_name('placecause').get_value()
|
||||
self.colorize = menu.get_option_by_name('color').get_value()
|
||||
if self.colorize == 'colored':
|
||||
self.colors = colored
|
||||
elif self.colorize == 'filled':
|
||||
self.colors = filled
|
||||
arrow_str = options['arrow']
|
||||
arrow_str = menu.get_option_by_name('arrow').get_value()
|
||||
if arrow_str.find('a') + 1:
|
||||
self.arrowheadstyle = 'normal'
|
||||
else:
|
||||
@ -142,10 +142,10 @@ class RelGraphReport(Report):
|
||||
self.arrowtailstyle = 'none'
|
||||
|
||||
filter_option = options_class.menu.get_option_by_name('filter')
|
||||
self.filter = filter_option.get_filter()
|
||||
self._filter = filter_option.get_filter()
|
||||
|
||||
def write_report(self):
|
||||
self.person_handles = self.filter.apply(self.database,
|
||||
self.person_handles = self._filter.apply(self.database,
|
||||
self.database.get_person_handles(sort_handles=False))
|
||||
|
||||
if len(self.person_handles) > 1:
|
||||
@ -428,17 +428,18 @@ class RelGraphOptions(MenuReportOptions):
|
||||
category_name = _("Report Options")
|
||||
################################
|
||||
|
||||
self.__filter = FilterOption(_("Filter"), 0)
|
||||
self.__filter.set_help(
|
||||
_("Determines what people are included in the graph"))
|
||||
menu.add_option(category_name, "filter", self.__filter)
|
||||
self.__filter.connect('value-changed', self.__filter_changed)
|
||||
|
||||
self.__pid = PersonOption(_("Filter Person"))
|
||||
self.__pid.set_help(_("The center person for the filter"))
|
||||
menu.add_option(category_name, "pid", self.__pid)
|
||||
self.__pid.connect('value-changed', self.__update_filters)
|
||||
|
||||
self.__filter = PersonFilterOption(_("Filter"), 0)
|
||||
self.__filter.set_help(
|
||||
_("Determines what people are included in the graph"))
|
||||
self.__update_filters()
|
||||
menu.add_option(category_name, "filter", self.__filter)
|
||||
self.__filter.connect('value-changed', self.__filter_changed)
|
||||
|
||||
incdate = BooleanOption(
|
||||
_("Include Birth, Marriage and Death dates"), True)
|
||||
|
@ -37,7 +37,7 @@ from gettext import gettext as _
|
||||
import gen.lib
|
||||
import BaseDoc
|
||||
import DateHandler
|
||||
from PluginUtils import register_report, PersonFilterOption, BooleanOption, \
|
||||
from PluginUtils import register_report, FilterOption, BooleanOption, \
|
||||
PersonOption
|
||||
from ReportBase import Report, ReportUtils, MenuReportOptions, \
|
||||
CATEGORY_TEXT, MODE_GUI, MODE_BKI, MODE_CLI
|
||||
@ -73,7 +73,8 @@ class IndivCompleteReport(Report):
|
||||
|
||||
Report.__init__(self, database, person, options_class)
|
||||
|
||||
self.use_srcs = options_class.handler.options_dict['cites']
|
||||
menu = options_class.menu
|
||||
self.use_srcs = menu.get_option_by_name('cites').get_value()
|
||||
|
||||
filter_option = options_class.menu.get_option_by_name('filter')
|
||||
self.filter = filter_option.get_filter()
|
||||
@ -345,35 +346,6 @@ class IndivCompleteReport(Report):
|
||||
self.doc.start_paragraph('IDS-Normal')
|
||||
self.doc.end_paragraph()
|
||||
|
||||
def write_sources(self):
|
||||
keys = self.sref_map.keys()
|
||||
if not keys:
|
||||
return
|
||||
|
||||
self.doc.start_table("three","IDS-IndTable")
|
||||
self.doc.start_row()
|
||||
self.doc.start_cell("IDS-TableHead",2)
|
||||
self.doc.start_paragraph("IDS-TableTitle")
|
||||
self.doc.write_text(_("Sources"))
|
||||
self.doc.end_paragraph()
|
||||
self.doc.end_cell()
|
||||
self.doc.end_row()
|
||||
|
||||
keys.sort()
|
||||
for key in keys:
|
||||
srcref = self.sref_map[key]
|
||||
base = self.database.get_source_from_handle(
|
||||
srcref.get_reference_handle())
|
||||
self.doc.start_row()
|
||||
self.doc.start_cell('IDS-NormalCell',2)
|
||||
self.doc.start_paragraph("IDS-Normal","%d." % key)
|
||||
self.doc.write_text(base.get_title())
|
||||
self.doc.end_paragraph()
|
||||
self.doc.end_cell()
|
||||
self.doc.end_row()
|
||||
|
||||
self.doc.end_table()
|
||||
|
||||
def write_facts(self):
|
||||
self.doc.start_table("two","IDS-IndTable")
|
||||
self.doc.start_row()
|
||||
@ -540,17 +512,18 @@ class IndivCompleteOptions(MenuReportOptions):
|
||||
category_name = _("Report Options")
|
||||
################################
|
||||
|
||||
self.__filter = FilterOption(_("Filter"), 0)
|
||||
self.__filter.set_help(
|
||||
_("Select the filter to be applied to the report"))
|
||||
menu.add_option(category_name, "filter", self.__filter)
|
||||
self.__filter.connect('value-changed', self.__filter_changed)
|
||||
|
||||
self.__pid = PersonOption(_("Filter Person"))
|
||||
self.__pid.set_help(_("The center person for the filter"))
|
||||
menu.add_option(category_name, "pid", self.__pid)
|
||||
self.__pid.connect('value-changed', self.__update_filters)
|
||||
|
||||
self.__filter = PersonFilterOption(_("Filter"), 0)
|
||||
self.__filter.set_help(
|
||||
_("Select the filter to be applied to the report"))
|
||||
self.__update_filters()
|
||||
menu.add_option(category_name, "filter", self.__filter)
|
||||
self.__filter.connect('value-changed', self.__filter_changed)
|
||||
|
||||
cites = BooleanOption(_("Include Source Information"), True)
|
||||
cites.set_help(_("Whether to cite sources."))
|
||||
|
@ -72,16 +72,17 @@ class KinshipReport(Report):
|
||||
"""
|
||||
Report.__init__(self, database, person, options_class)
|
||||
|
||||
self.max_descend = options_class.handler.options_dict['maxdescend']
|
||||
self.max_ascend = options_class.handler.options_dict['maxascend']
|
||||
self.incSpouses = options_class.handler.options_dict['incspouses']
|
||||
self.incCousins = options_class.handler.options_dict['inccousins']
|
||||
self.incAunts = options_class.handler.options_dict['incaunts']
|
||||
pid = options_class.handler.options_dict['pid']
|
||||
menu = options_class.menu
|
||||
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 = database.get_person_from_gramps_id(pid)
|
||||
|
||||
self.db = database
|
||||
self.relCalc = relationship_class()
|
||||
self.__db = database
|
||||
self.rel_calc = relationship_class()
|
||||
self.kinship_map = {}
|
||||
self.spouse_map = {}
|
||||
|
||||
@ -98,7 +99,7 @@ class KinshipReport(Report):
|
||||
self.doc.write_text(title, mark)
|
||||
self.doc.end_paragraph()
|
||||
|
||||
if self.incSpouses:
|
||||
if self.inc_spouses:
|
||||
spouse_handles = self.get_spouse_handles(self.person.get_handle())
|
||||
if spouse_handles:
|
||||
self.write_people(_("Spouses"), spouse_handles)
|
||||
@ -117,15 +118,15 @@ class KinshipReport(Report):
|
||||
x = min (Ga,Gb)
|
||||
y = abs(Ga-Gb)
|
||||
# Skip unrequested people
|
||||
if x == 1 and y > 0 and not self.incAunts:
|
||||
if x == 1 and y > 0 and not self.inc_aunts:
|
||||
continue
|
||||
elif x > 1 and not self.incCousins:
|
||||
elif x > 1 and not self.inc_cousins:
|
||||
continue
|
||||
|
||||
title = self.relCalc.get_plural_relationship_string(Ga,Gb)
|
||||
title = self.rel_calc.get_plural_relationship_string(Ga,Gb)
|
||||
self.write_people(title,self.kinship_map[Ga][Gb])
|
||||
|
||||
if self.incSpouses and \
|
||||
if self.inc_spouses and \
|
||||
self.spouse_map.has_key(Ga) and \
|
||||
self.spouse_map[Ga].has_key(Gb):
|
||||
title = _("spouses of %s") % title
|
||||
@ -153,7 +154,7 @@ class KinshipReport(Report):
|
||||
if child_handle != skip_handle:
|
||||
self.add_kin(child_handle,Ga,Gb)
|
||||
|
||||
if self.incSpouses:
|
||||
if self.inc_spouses:
|
||||
for spouse_handle in self.get_spouse_handles(child_handle):
|
||||
self.add_spouse(spouse_handle,Ga,Gb)
|
||||
|
||||
@ -210,10 +211,10 @@ class KinshipReport(Report):
|
||||
given person handle.
|
||||
"""
|
||||
parent_handles = []
|
||||
person = self.db.get_person_from_handle(person_handle)
|
||||
person = self.__db.get_person_from_handle(person_handle)
|
||||
family_handle = person.get_main_parents_family_handle()
|
||||
if family_handle:
|
||||
family = self.db.get_family_from_handle(family_handle)
|
||||
family = self.__db.get_family_from_handle(family_handle)
|
||||
father_handle = family.get_father_handle()
|
||||
if father_handle:
|
||||
parent_handles.append(father_handle)
|
||||
@ -228,9 +229,9 @@ class KinshipReport(Report):
|
||||
given person handle.
|
||||
"""
|
||||
spouses = []
|
||||
person = self.db.get_person_from_handle(person_handle)
|
||||
person = self.__db.get_person_from_handle(person_handle)
|
||||
for family_handle in person.get_family_handle_list():
|
||||
family = self.db.get_family_from_handle(family_handle)
|
||||
family = self.__db.get_family_from_handle(family_handle)
|
||||
father_handle = family.get_father_handle()
|
||||
mother_handle = family.get_mother_handle()
|
||||
spouse_handle = None
|
||||
@ -249,9 +250,9 @@ class KinshipReport(Report):
|
||||
given person handle.
|
||||
"""
|
||||
children = []
|
||||
person = self.db.get_person_from_handle(person_handle)
|
||||
person = self.__db.get_person_from_handle(person_handle)
|
||||
for family_handle in person.get_family_handle_list():
|
||||
family = self.db.get_family_from_handle(family_handle)
|
||||
family = self.__db.get_family_from_handle(family_handle)
|
||||
for child_ref in family.get_child_ref_list():
|
||||
children.append(child_ref.get_reference_handle())
|
||||
return children
|
||||
@ -262,10 +263,10 @@ class KinshipReport(Report):
|
||||
given person handle.
|
||||
"""
|
||||
siblings = []
|
||||
person = self.db.get_person_from_handle(person_handle)
|
||||
person = self.__db.get_person_from_handle(person_handle)
|
||||
family_handle = person.get_main_parents_family_handle()
|
||||
if family_handle:
|
||||
family = self.db.get_family_from_handle(family_handle)
|
||||
family = self.__db.get_family_from_handle(family_handle)
|
||||
for child_ref in family.get_child_ref_list():
|
||||
sibling_handle = child_ref.get_reference_handle()
|
||||
if sibling_handle != person_handle:
|
||||
|
@ -66,7 +66,8 @@ class MarkerReport(Report):
|
||||
marker - The marker each object must match to be included.
|
||||
"""
|
||||
Report.__init__(self, database, person, options_class)
|
||||
self.marker = options_class.handler.options_dict['marker']
|
||||
menu = options_class.menu
|
||||
self.marker = menu.get_option_by_name('marker').get_value()
|
||||
|
||||
def write_report(self):
|
||||
markerstr = self.marker
|
||||
|
@ -48,7 +48,7 @@ from gen.lib import Person, FamilyRelType, EventType
|
||||
# gender and report type names
|
||||
import BaseDoc
|
||||
from PluginUtils import register_report
|
||||
from PluginUtils import BooleanOption, PersonFilterOption, PersonOption, \
|
||||
from PluginUtils import BooleanOption, FilterOption, PersonOption, \
|
||||
EnumeratedListOption, NumberOption
|
||||
from ReportBase import Report, ReportUtils, MenuReportOptions, \
|
||||
CATEGORY_DRAW, MODE_GUI, MODE_BKI, MODE_CLI
|
||||
@ -389,7 +389,7 @@ class Extract:
|
||||
chart[1][key] = 1
|
||||
|
||||
|
||||
def collect_data(self, db, filter_func, options, genders,
|
||||
def collect_data(self, db, filter_func, menu, genders,
|
||||
year_from, year_to, no_years):
|
||||
"""goes through the database and collects the selected personal
|
||||
data persons fitting the filter and birth year criteria. The
|
||||
@ -412,10 +412,10 @@ class Extract:
|
||||
data = []
|
||||
ext = self.extractors
|
||||
# which methods to use
|
||||
for key in options:
|
||||
if options[key] and key in self.extractors:
|
||||
for name in menu.get_all_option_names():
|
||||
if name in self.extractors:
|
||||
# localized data title, value dict, type and data method
|
||||
data.append((ext[key][1], {}, ext[key][2], ext[key][3]))
|
||||
data.append((ext[name][1], {}, ext[name][2], ext[name][3]))
|
||||
|
||||
# go through the people and collect data
|
||||
for person_handle in filter_func.apply(db, db.get_person_handles(sort_handles=False)):
|
||||
@ -476,11 +476,11 @@ class StatisticsChart(Report):
|
||||
self.filter_option = options_class.menu.get_option_by_name('filter')
|
||||
self.filter = self.filter_option.get_filter()
|
||||
|
||||
options = options_class.handler.options_dict
|
||||
self.bar_items = options['bar_items']
|
||||
year_from = options['year_from']
|
||||
year_to = options['year_to']
|
||||
gender = options['gender']
|
||||
menu = options_class.menu
|
||||
self.bar_items = menu.get_option_by_name('bar_items').get_value()
|
||||
year_from = menu.get_option_by_name('year_from').get_value()
|
||||
year_to = menu.get_option_by_name('year_to').get_value()
|
||||
gender = menu.get_option_by_name('gender').get_value()
|
||||
|
||||
# title needs both data extraction method name + gender name
|
||||
if gender == Person.MALE:
|
||||
@ -500,14 +500,15 @@ class StatisticsChart(Report):
|
||||
|
||||
# extract requested items from the database and count them
|
||||
self.progress.set_pass(_('Collecting data...'), 1)
|
||||
tables = _Extract.collect_data(database, self.filter, options,
|
||||
gender, year_from, year_to, options['no_years'])
|
||||
tables = _Extract.collect_data(database, self.filter, menu,
|
||||
gender, year_from, year_to,
|
||||
menu.get_option_by_name('no_years').get_value())
|
||||
self.progress.step()
|
||||
|
||||
self.progress.set_pass(_('Sorting data...'), len(tables))
|
||||
self.data = []
|
||||
sortby = options['sortby']
|
||||
reverse = options['reverse']
|
||||
sortby = menu.get_option_by_name('sortby').get_value()
|
||||
reverse = menu.get_option_by_name('reverse').get_value()
|
||||
for table in tables:
|
||||
# generate sorted item lookup index index
|
||||
lookup = self.index_items(table[1], sortby, reverse)
|
||||
@ -670,17 +671,18 @@ class StatisticsChartOptions(MenuReportOptions):
|
||||
"""
|
||||
category_name = _("Report Options")
|
||||
|
||||
self.__filter = FilterOption(_("Filter"), 0)
|
||||
self.__filter.set_help(
|
||||
_("Determines what people are included in the report"))
|
||||
menu.add_option(category_name, "filter", self.__filter)
|
||||
self.__filter.connect('value-changed', self.__filter_changed)
|
||||
|
||||
self.__pid = PersonOption(_("Filter Person"))
|
||||
self.__pid.set_help(_("The center person for the filter"))
|
||||
menu.add_option(category_name, "pid", self.__pid)
|
||||
self.__pid.connect('value-changed', self.__update_filters)
|
||||
|
||||
self.__filter = PersonFilterOption(_("Filter"), 0)
|
||||
self.__filter.set_help(
|
||||
_("Determines what people are included in the report"))
|
||||
self.__update_filters()
|
||||
menu.add_option(category_name, "filter", self.__filter)
|
||||
self.__filter.connect('value-changed', self.__filter_changed)
|
||||
|
||||
sortby = EnumeratedListOption(_('Sort chart items by'),
|
||||
_options.SORT_VALUE )
|
||||
|
@ -38,13 +38,12 @@ from TransUtils import sgettext as _
|
||||
#
|
||||
#------------------------------------------------------------------------
|
||||
from PluginUtils import register_report
|
||||
from PluginUtils import PersonFilterOption, EnumeratedListOption, \
|
||||
from PluginUtils import FilterOption, EnumeratedListOption, \
|
||||
PersonOption
|
||||
from ReportBase import Report, ReportUtils, MenuReportOptions, \
|
||||
CATEGORY_DRAW, MODE_GUI, MODE_BKI, MODE_CLI
|
||||
pt2cm = ReportUtils.pt2cm
|
||||
import BaseDoc
|
||||
from Filters import GenericFilter, Rules
|
||||
import Sort
|
||||
from QuestionDialog import ErrorDialog
|
||||
from BasicUtils import name_displayer
|
||||
@ -87,14 +86,12 @@ class TimeLine(Report):
|
||||
"""
|
||||
|
||||
Report.__init__(self, database, person, options_class)
|
||||
|
||||
filter_num = options_class.handler.options_dict['filter']
|
||||
self.filter_option = options_class.menu.get_option_by_name('filter')
|
||||
self.filter = self.filter_option.get_filter()
|
||||
menu = options_class.menu
|
||||
self.filter = menu.get_option_by_name('filter').get_filter()
|
||||
|
||||
self.title = _("Timeline Graph for %s") % self.filter.get_name()
|
||||
|
||||
sort_func_num = options_class.handler.options_dict['sortby']
|
||||
sort_func_num = menu.get_option_by_name('sortby').get_value()
|
||||
sort_functions = _get_sort_functions(Sort.Sort(database))
|
||||
self.sort_func = sort_functions[sort_func_num][1]
|
||||
|
||||
@ -305,17 +302,18 @@ class TimeLineOptions(MenuReportOptions):
|
||||
def add_menu_options(self,menu,dbstate):
|
||||
category_name = _("Report Options")
|
||||
|
||||
self.__filter = FilterOption(_("Filter"), 0)
|
||||
self.__filter.set_help(
|
||||
_("Determines what people are included in the report"))
|
||||
menu.add_option(category_name, "filter", self.__filter)
|
||||
self.__filter.connect('value-changed', self.__filter_changed)
|
||||
|
||||
self.__pid = PersonOption(_("Filter Person"))
|
||||
self.__pid.set_help(_("The center person for the filter"))
|
||||
menu.add_option(category_name, "pid", self.__pid)
|
||||
self.__pid.connect('value-changed', self.__update_filters)
|
||||
|
||||
self.__filter = PersonFilterOption(_("Filter"), 0)
|
||||
self.__filter.set_help(
|
||||
_("Determines what people are included in the report"))
|
||||
self.__update_filters()
|
||||
menu.add_option(category_name, "filter", self.__filter)
|
||||
self.__filter.connect('value-changed', self.__filter_changed)
|
||||
|
||||
sortby = EnumeratedListOption(_('Sort by'), 0 )
|
||||
idx = 0
|
||||
|
Loading…
x
Reference in New Issue
Block a user