enable custom filters in reports to select the center person

This commit is contained in:
Paul Franklin 2016-12-10 10:19:28 -08:00
parent 90a513effa
commit cdf6e0e3a3
10 changed files with 40 additions and 46 deletions

View File

@ -565,8 +565,8 @@ class CalendarOptions(MenuReportOptions):
person = self.__db.get_person_from_gramps_id(gid)
nfv = self._nf.get_value()
filter_list = utils.get_person_filters(person,
include_single=False,
name_format=nfv)
include_single=False,
name_format=nfv)
self.__filter.set_filters(filter_list)
def __filter_changed(self):
@ -575,12 +575,11 @@ class CalendarOptions(MenuReportOptions):
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
if filter_value == 0: # "Entire Database" (as "include_single=False")
self.__pid.set_available(False)
else:
# The other filters need a center person (assume custom ones too)
self.__pid.set_available(True)
def make_my_style(self, default_style, name, description,
size=9, font=FONT_SERIF, justified ="left",

View File

@ -1102,7 +1102,7 @@ class StatisticsChartOptions(MenuReportOptions):
if filter_value == 0: # "Entire Database" (as "include_single=False")
self.__pid.set_available(False)
else:
# The other filters need a center person (assume custom ones do)
# The other filters need a center person (assume custom ones too)
self.__pid.set_available(True)
def make_default_style(self, default_style):

View File

@ -452,8 +452,8 @@ class TimeLineOptions(MenuReportOptions):
person = self.__db.get_person_from_gramps_id(gid)
nfv = self._nf.get_value()
filter_list = utils.get_person_filters(person,
include_single=False,
name_format=nfv)
include_single=False,
name_format=nfv)
self.__filter.set_filters(filter_list)
def __filter_changed(self):
@ -462,12 +462,11 @@ class TimeLineOptions(MenuReportOptions):
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
if filter_value == 0: # "Entire Database" (as "include_single=False")
self.__pid.set_available(False)
else:
# The other filters need a center person (assume custom ones too)
self.__pid.set_available(True)
def make_default_style(self, default_style):
"""Make the default output style for the Timeline report."""

View File

@ -829,8 +829,8 @@ class RelGraphOptions(MenuReportOptions):
person = self.__db.get_person_from_gramps_id(gid)
nfv = self._nf.get_value()
filter_list = utils.get_person_filters(person,
include_single=False,
name_format=nfv)
include_single=False,
name_format=nfv)
self.__filter.set_filters(filter_list)
def __filter_changed(self):
@ -838,15 +838,14 @@ class RelGraphOptions(MenuReportOptions):
Handle filter change. If the filter is not specific to a person,
disable the person option
"""
if self.__show_relships and self.__show_relships.get_value():
self.__pid.set_available(True)
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)
elif self.__show_relships and self.__show_relships.get_value():
self.__pid.set_available(True)
else:
# The rest don't
if filter_value == 0: # "Entire Database" (as "include_single=False")
self.__pid.set_available(False)
else:
# The other filters need a center person (assume custom ones too)
self.__pid.set_available(True)
def __image_changed(self):
"""

View File

@ -526,7 +526,7 @@ class BirthdayOptions(MenuReportOptions):
if filter_value == 0: # "Entire Database" (as "include_single=False")
self.__pid.set_available(False)
else:
# The other filters need a center person (assume custom ones do)
# The other filters need a center person (assume custom ones too)
self.__pid.set_available(True)
def make_my_style(self, default_style, name, description,

View File

@ -821,7 +821,7 @@ class FamilyGroupOptions(MenuReportOptions):
if filter_value == 1: # "Entire Database" (as "include_single=True")
self.__fid.set_available(False)
else:
# The other filters need a center family (assume custom ones do)
# The other filters need a center family (assume custom ones too)
self.__fid.set_available(True)
# only allow recursion if the center family is the only family

View File

@ -1130,8 +1130,8 @@ class IndivCompleteOptions(MenuReportOptions):
person = self.__db.get_person_from_gramps_id(gid)
nfv = self._nf.get_value()
filter_list = utils.get_person_filters(person,
include_single=True,
name_format=nfv)
include_single=True,
name_format=nfv)
self.__filter.set_filters(filter_list)
def __filter_changed(self):
@ -1140,12 +1140,11 @@ class IndivCompleteOptions(MenuReportOptions):
disable the person option
"""
filter_value = self.__filter.get_value()
if filter_value in [0, 2, 3, 4, 5]:
# Filters 0, 2, 3, 4 and 5 rely on the center person
self.__pid.set_available(True)
else:
# The rest don't
if filter_value == 1: # "Entire Database" (as "include_single=True")
self.__pid.set_available(False)
else:
# The other filters need a center person (assume custom ones too)
self.__pid.set_available(True)
def __sources_changed(self):
"""

View File

@ -293,7 +293,7 @@ class RecordsReportOptions(MenuReportOptions):
if filter_value == 0: # "Entire Database" (as "include_single=False")
self.__pid.set_available(False)
else:
# The other filters need a center person (assume custom ones do)
# The other filters need a center person (assume custom ones too)
self.__pid.set_available(True)
def make_default_style(self, default_style):

View File

@ -197,12 +197,11 @@ class SortEventOptions(MenuToolOptions):
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
if filter_value == 0: # "Entire Database" (as "include_single=False")
self.__pid.set_available(False)
else:
# The other filters need a center person (assume custom ones too)
self.__pid.set_available(True)
def __update_filters(self):
"""
@ -210,5 +209,5 @@ class SortEventOptions(MenuToolOptions):
"""
gid = self.__pid.get_value()
person = self.__db.get_person_from_gramps_id(gid)
filter_list = utils.get_person_filters(person, False)
filter_list = utils.get_person_filters(person, include_single=False)
self.__filter.set_filters(filter_list)

View File

@ -10073,7 +10073,7 @@ class NavWebOptions(MenuReportOptions):
"""
gid = self.__pid.get_value()
person = self.__db.get_person_from_gramps_id(gid)
filter_list = utils.get_person_filters(person, False)
filter_list = utils.get_person_filters(person, include_single=False)
self.__filter.set_filters(filter_list)
def __filter_changed(self):
@ -10082,12 +10082,11 @@ class NavWebOptions(MenuReportOptions):
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
if filter_value == 0: # "Entire Database" (as "include_single=False")
self.__pid.set_available(False)
else:
# The other filters need a center person (assume custom ones too)
self.__pid.set_available(True)
def __stylesheet_changed(self):
"""