Fixes for configuring gramplets
svn: r15215
This commit is contained in:
parent
1dd85ced01
commit
d5056554a0
@ -69,11 +69,16 @@ class AgeStatsGramplet(Gramplet):
|
|||||||
self.max_father_diff = int(self.gui.data[2])
|
self.max_father_diff = int(self.gui.data[2])
|
||||||
self.chart_width = int(self.gui.data[3])
|
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.gui.data = [self.max_age,
|
||||||
self.max_mother_diff,
|
self.max_mother_diff,
|
||||||
self.max_father_diff,
|
self.max_father_diff,
|
||||||
self.chart_width]
|
self.chart_width]
|
||||||
|
self.update()
|
||||||
|
|
||||||
def db_changed(self):
|
def db_changed(self):
|
||||||
self.update()
|
self.update()
|
||||||
|
@ -75,8 +75,12 @@ class PedigreeGramplet(Gramplet):
|
|||||||
self.show_dates = int(self.gui.data[1])
|
self.show_dates = int(self.gui.data[1])
|
||||||
self.box_mode = self.gui.data[2] # "ASCII" or "UTF"
|
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.gui.data = [self.max_generations, self.show_dates, self.box_mode]
|
||||||
|
self.update()
|
||||||
|
|
||||||
def db_changed(self):
|
def db_changed(self):
|
||||||
"""
|
"""
|
||||||
|
@ -78,8 +78,12 @@ class SurnameCloudGramplet(Gramplet):
|
|||||||
self.min_font = int(self.gui.data[1])
|
self.min_font = int(self.gui.data[1])
|
||||||
self.max_font = int(self.gui.data[2])
|
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.gui.data = [self.top_size, self.min_font, self.max_font]
|
||||||
|
self.update()
|
||||||
|
|
||||||
def main(self):
|
def main(self):
|
||||||
self.set_text(_("Processing...") + "\n")
|
self.set_text(_("Processing...") + "\n")
|
||||||
@ -117,8 +121,6 @@ class SurnameCloudGramplet(Gramplet):
|
|||||||
cloud_values.append( count )
|
cloud_values.append( count )
|
||||||
|
|
||||||
cloud_names.sort(key=lambda k:k[1])
|
cloud_names.sort(key=lambda k:k[1])
|
||||||
counts = list(set(cloud_values))
|
|
||||||
counts.sort(reverse=True)
|
|
||||||
line = 0
|
line = 0
|
||||||
### All done!
|
### All done!
|
||||||
# Now, find out how many we can display without going over top_size:
|
# Now, find out how many we can display without going over top_size:
|
||||||
@ -129,14 +131,22 @@ class SurnameCloudGramplet(Gramplet):
|
|||||||
total = 0
|
total = 0
|
||||||
include_greater_than = 0
|
include_greater_than = 0
|
||||||
for s in sums:
|
for s in sums:
|
||||||
if total + totals[s] <= self.top_size_option.get_value():
|
if total + totals[s] <= self.top_size:
|
||||||
total += totals[s]
|
total += totals[s]
|
||||||
else:
|
else:
|
||||||
include_greater_than = s
|
include_greater_than = s
|
||||||
break
|
break
|
||||||
mins = self.min_option.get_value()
|
# now, limit counts to only include those that we can display:
|
||||||
maxs = self.max_option.get_value()
|
|
||||||
|
mins = self.min_font
|
||||||
|
maxs = self.max_font
|
||||||
# Ok, now we can show those counts > include_greater_than:
|
# 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
|
showing = 0
|
||||||
self.set_text("")
|
self.set_text("")
|
||||||
for (count, surname) in cloud_names: # surname_sort:
|
for (count, surname) in cloud_names: # surname_sort:
|
||||||
|
Loading…
Reference in New Issue
Block a user