8102: Fix problem with fanchart if max_generation = 1

This commit is contained in:
Bastien Jacquet 2014-11-05 23:22:48 +01:00
parent d716146e9d
commit cd540cdb13
2 changed files with 3 additions and 3 deletions

View File

@ -350,7 +350,7 @@ class FanChartBaseWidget(Gtk.DrawingArea):
self.maincolor = cstart
elif self.background == BACKGROUND_GRAD_GEN:
#compute the colors, -1, 0, ..., maxgen
divs = [x/(maxgen-1) for x in range(maxgen)]
divs = [x/(maxgen-1) for x in range(maxgen)] if maxgen>1 else [0]
rgb_colors = [colorsys.hsv_to_rgb(
(1-x) * self.cstart_hsv[0] + x * self.cend_hsv[0],
(1-x) * self.cstart_hsv[1] + x * self.cend_hsv[1],

View File

@ -158,10 +158,10 @@ class FanChartDescWidget(FanChartBaseWidget):
self.gen2fam[0] = [] #no families
self.angle = {}
self.angle[-2] = []
for i in range(1, self.generations-1):
for i in range(1, self.generations+1):
self.gen2fam[i] = []
self.gen2people[i] = []
self.gen2people[self.generations-1] = [] #indication of more children
self.gen2people[self.generations] = [] #indication of more children
self.rotfactor = 1
self.rotstartangle = 0
if self.form == FORM_HALFCIRCLE: