make report dialog height less than 600, for smaller displays [SC]

This commit is contained in:
Paul Franklin 2016-12-09 19:47:26 -08:00
parent 55fa8f8d86
commit 2c9bad6108

View File

@ -1058,17 +1058,19 @@ class StatisticsChartOptions(MenuReportOptions):
# -------------------------------------------------
# List of available charts on separate option tabs
idx = 0
half = len(_Extract.extractors) // 2
third = (len(_Extract.extractors) + 1) // 3
chart_types = []
for (chart_opt, ctuple) in _Extract.extractors.items():
chart_types.append((_(ctuple[1]), chart_opt, ctuple))
sorted_chart_types = sorted(chart_types,
key=lambda x: glocale.sort_key(x[0]))
for (translated_option_name, opt_name, ctuple) in sorted_chart_types:
if idx <= half:
category_name = _("Charts 1")
else:
if idx >= (third * 2):
category_name = _("Charts 3")
elif idx >= third:
category_name = _("Charts 2")
else:
category_name = _("Charts 1")
opt = BooleanOption(translated_option_name, False)
opt.set_help(_("Include charts with indicated data."))
menu.add_option(category_name, opt_name, opt)
@ -1087,8 +1089,8 @@ class StatisticsChartOptions(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):
@ -1097,12 +1099,11 @@ class StatisticsChartOptions(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 do)
self.__pid.set_available(True)
def make_default_style(self, default_style):
"""Make the default output style for the Statistics report."""