diff --git a/src/plugins/gramplet/AgeStats.py b/src/plugins/gramplet/AgeStats.py index 0d3211b23..711a50f36 100644 --- a/src/plugins/gramplet/AgeStats.py +++ b/src/plugins/gramplet/AgeStats.py @@ -69,11 +69,16 @@ class AgeStatsGramplet(Gramplet): self.max_father_diff = int(self.gui.data[2]) self.chart_width = int(self.gui.data[3]) - def on_save(self): + def save_update_options(self, widget=None): + self.max_age = int(self.get_option(_("Max age")).get_value()) + self.max_mother_diff = int(self.get_option(_("Max age of Mother at birth")).get_value()) + self.max_father_diff = int(self.get_option(_("Max age of Father at birth")).get_value()) + self.chart_width = int(self.get_option(_("Chart width")).get_value()) self.gui.data = [self.max_age, self.max_mother_diff, self.max_father_diff, self.chart_width] + self.update() def db_changed(self): self.update() diff --git a/src/plugins/gramplet/PedigreeGramplet.py b/src/plugins/gramplet/PedigreeGramplet.py index 194faca17..0940d9314 100644 --- a/src/plugins/gramplet/PedigreeGramplet.py +++ b/src/plugins/gramplet/PedigreeGramplet.py @@ -75,8 +75,12 @@ class PedigreeGramplet(Gramplet): self.show_dates = int(self.gui.data[1]) self.box_mode = self.gui.data[2] # "ASCII" or "UTF" - def on_save(self): + def save_update_options(self, widget=None): + self.max_generations = int(self.get_option(_("Max generations")).get_value()) + self.show_dates = int(self.get_option(_("Show dates")).get_value()) + self.box_mode = self.get_option(_("Line type")).get_value() self.gui.data = [self.max_generations, self.show_dates, self.box_mode] + self.update() def db_changed(self): """ diff --git a/src/plugins/gramplet/SurnameCloudGramplet.py b/src/plugins/gramplet/SurnameCloudGramplet.py index 2baa04c87..a50262d22 100644 --- a/src/plugins/gramplet/SurnameCloudGramplet.py +++ b/src/plugins/gramplet/SurnameCloudGramplet.py @@ -78,8 +78,12 @@ class SurnameCloudGramplet(Gramplet): self.min_font = int(self.gui.data[1]) self.max_font = int(self.gui.data[2]) - def on_save(self): + def save_update_options(self, widget=None): + self.top_size = int(self.get_option(_("Number of surnames")).get_value()) + self.min_font = int(self.get_option(_("Min font size")).get_value()) + self.max_font = int(self.get_option(_("Max font size")).get_value()) self.gui.data = [self.top_size, self.min_font, self.max_font] + self.update() def main(self): self.set_text(_("Processing...") + "\n") @@ -117,8 +121,6 @@ class SurnameCloudGramplet(Gramplet): cloud_values.append( count ) cloud_names.sort(key=lambda k:k[1]) - counts = list(set(cloud_values)) - counts.sort(reverse=True) line = 0 ### All done! # Now, find out how many we can display without going over top_size: @@ -129,14 +131,22 @@ class SurnameCloudGramplet(Gramplet): total = 0 include_greater_than = 0 for s in sums: - if total + totals[s] <= self.top_size_option.get_value(): + if total + totals[s] <= self.top_size: total += totals[s] else: include_greater_than = s break - mins = self.min_option.get_value() - maxs = self.max_option.get_value() + # now, limit counts to only include those that we can display: + + mins = self.min_font + maxs = self.max_font # Ok, now we can show those counts > include_greater_than: + good_counts = [] + for (count, surname) in cloud_names: # surname_sort: + if count > include_greater_than: + good_counts.append(count) + counts = list(set(good_counts)) + counts.sort(reverse=True) showing = 0 self.set_text("") for (count, surname) in cloud_names: # surname_sort: