7766: Fan Chart views crash with self.maxperiod = self.minperiod

This commit is contained in:
Jérôme Rapinat 2014-06-03 10:38:25 +02:00
parent bbefe30256
commit d4df31abf3

View File

@ -442,8 +442,11 @@ class FanChartBaseWidget(Gtk.DrawingArea):
if period is None: if period is None:
color = (255, 255, 255) # white color = (255, 255, 255) # white
else: else:
periodfrac = ((period - self.minperiod) if self.maxperiod != self.minperiod:
/ (self.maxperiod - self.minperiod)) periodfrac = ((period - self.minperiod)
/ (self.maxperiod - self.minperiod))
else:
periodfrac = 0.5
periodcol = colorsys.hsv_to_rgb( periodcol = colorsys.hsv_to_rgb(
(1-periodfrac) * self.cstart_hsv[0] + periodfrac * self.cend_hsv[0], (1-periodfrac) * self.cstart_hsv[0] + periodfrac * self.cend_hsv[0],
(1-periodfrac) * self.cstart_hsv[1] + periodfrac * self.cend_hsv[1], (1-periodfrac) * self.cstart_hsv[1] + periodfrac * self.cend_hsv[1],