Limit Age Stats gramplet settings to appropriate values (#936)

* Max ages should be divisible by 5 to avoid out of range
  errors.
* The chart width should be greater than 45 to look right and
  avoid division by zero errors.
This commit is contained in:
Nick Hall 2019-10-29 22:35:32 +00:00 committed by Sam Manzi
parent fb29a77f83
commit e69e6ca338

View File

@ -51,13 +51,13 @@ class AgeStatsGramplet(Gramplet):
def build_options(self): def build_options(self):
from gramps.gen.plug.menu import NumberOption from gramps.gen.plug.menu import NumberOption
self.add_option(NumberOption(_("Max age"), self.add_option(NumberOption(_("Max age"),
self.max_age, 1, 150)) self.max_age, 5, 150, 5))
self.add_option(NumberOption(_("Max age of Mother at birth"), self.add_option(NumberOption(_("Max age of Mother at birth"),
self.max_mother_diff, 1, 150)) self.max_mother_diff, 5, 150, 5))
self.add_option(NumberOption(_("Max age of Father at birth"), self.add_option(NumberOption(_("Max age of Father at birth"),
self.max_father_diff, 1, 150)) self.max_father_diff, 5, 150, 5))
self.add_option(NumberOption(_("Chart width"), self.add_option(NumberOption(_("Chart width"),
self.chart_width, 1, 150)) self.chart_width, 45, 150))
def save_options(self): def save_options(self):
self.max_age = int(self.get_option(_("Max age")).get_value()) self.max_age = int(self.get_option(_("Max age")).get_value())