0001880: Birthday and Anniversary Report does not work

svn: r10174
This commit is contained in:
Brian Matherly 2008-03-03 04:06:48 +00:00
parent 8e90f4764d
commit 504f0e554a
2 changed files with 119 additions and 127 deletions

View File

@ -1,3 +1,7 @@
2008-03-02 Brian Matherly <brian@gramps-project.org>
* src/plugins/Calendar.py:
0001880: Birthday and Anniversary Report does not work
2008-03-02 Brian Matherly <brian@gramps-project.org>
* src/ManagedWindow.py:
0001878: bug: AttributeError: BookReportDialog instance has no

View File

@ -143,7 +143,8 @@ class Calendar(Report):
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 = menu.get_option_by_name('pid').get_value()
pid = menu.get_option_by_name('pid').get_value()
self.center_person = database.get_person_from_gramps_id(pid)
self.title = _("Calendar Report") #% name
@ -313,7 +314,6 @@ class Calendar(Report):
self.progress.set_pass(_('Filtering data...'), 0)
people = self.filter.apply(self.database,
self.database.get_person_handles(sort_handles=False))
center_person = self.database.get_person_from_gramps_id(self.pid)
rel_calc = relationship_class()
self.progress.set_pass(_('Filtering data...'), len(people))
for person_handle in people:
@ -353,7 +353,10 @@ class Calendar(Report):
if ((self.alive and alive) or not self.alive):
comment = ""
if self.relationships:
relation = rel_calc.get_one_relationship(self.database, center_person, person)
relation = rel_calc.get_one_relationship(
self.database,
self.center_person,
person)
if relation:
comment = " --- %s" % relation
self.add_day_item("%s, %d%s" % (short_name, age, comment), self.year, month, day)
@ -433,8 +436,7 @@ class CalendarReport(Calendar):
self.doc.write_text(str(self.text3))
self.doc.end_paragraph()
if self.relationships:
center_person = self.filter_option.get_center_person()
name = center_person.get_primary_name()
name = self.center_person.get_primary_name()
self.doc.start_paragraph('BIR-Text3style')
self.doc.write_text(_("Relationships shown are to %s") % name_displayer.display_name(name))
self.doc.end_paragraph()
@ -490,10 +492,9 @@ class CalendarOptions(MenuReportOptions):
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"))
self.__pid = PersonOption(_("Center Person"))
self.__pid.set_help(_("The center person for the report"))
menu.add_option(category_name, "pid", self.__pid)
self.__pid.connect('value-changed', self.__update_filters)
@ -562,19 +563,6 @@ class CalendarOptions(MenuReportOptions):
filter_list = ReportUtils.get_person_filters(person, False)
self.__filter.set_filters(filter_list)
def __filter_changed(self):
"""
Handle filter change. If the filter is not specific to a person,
disable the person option
"""
filter_value = self.__filter.get_value()
if filter_value in [1, 2, 3, 4]:
# Filters 1, 2, 3 and 4 rely on the center person
self.__pid.set_available(True)
else:
# The rest don't
self.__pid.set_available(False)
def make_my_style(self, default_style, name, description,
size=9, font=BaseDoc.FONT_SERIF, justified ="left",
color=None, align=BaseDoc.PARA_ALIGN_CENTER,
@ -652,9 +640,9 @@ class CalendarReportOptions(CalendarOptions):
menu.add_option(category_name, "titletext", titletext)
CalendarOptions.add_menu_options(self, menu)
category_name = _("Report Options")
option = BooleanOption(_("Include relationships to center person (slower)"),
option = BooleanOption(_("Include relationships to center person"),
False)
option.set_help(_("Include relationships to center person"))
option.set_help(_("Include relationships to center person (slower)"))
menu.add_option(category_name, "relationships", option)
def make_default_style(self, default_style):