From d4df31abf3af84eb8df866ebb4c8ff5f4ad343a4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Rapinat?= Date: Tue, 3 Jun 2014 10:38:25 +0200 Subject: [PATCH] 7766: Fan Chart views crash with self.maxperiod = self.minperiod --- gramps/gui/widgets/fanchart.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/gramps/gui/widgets/fanchart.py b/gramps/gui/widgets/fanchart.py index 724796224..d3e612e05 100644 --- a/gramps/gui/widgets/fanchart.py +++ b/gramps/gui/widgets/fanchart.py @@ -442,8 +442,11 @@ class FanChartBaseWidget(Gtk.DrawingArea): if period is None: color = (255, 255, 255) # white else: - periodfrac = ((period - self.minperiod) - / (self.maxperiod - self.minperiod)) + if self.maxperiod != self.minperiod: + periodfrac = ((period - self.minperiod) + / (self.maxperiod - self.minperiod)) + else: + periodfrac = 0.5 periodcol = colorsys.hsv_to_rgb( (1-periodfrac) * self.cstart_hsv[0] + periodfrac * self.cend_hsv[0], (1-periodfrac) * self.cstart_hsv[1] + periodfrac * self.cend_hsv[1],