From 44660039d5510f50539a66d2fd78ac4aa7d154ed Mon Sep 17 00:00:00 2001 From: HomeWorld Date: Tue, 14 Sep 2010 19:51:12 +0300 Subject: [PATCH] Made the colour change from 100% to > 100% less brutal in pygauge --- gui/pygauge.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/gui/pygauge.py b/gui/pygauge.py index e1b9a83e2..df3f6cab5 100644 --- a/gui/pygauge.py +++ b/gui/pygauge.py @@ -240,11 +240,12 @@ class PyGauge(wx.PyWindow): r = copy.copy(rect) r.width = w r.height = r.height/2+1 + pv= 100 * (float(value if value <= self._range else self._range) / self._range) if value <= self._range: - c1 = map(lambda t: sum(t), zip(c1, (3*w/4,-w,-w,0))) - c2 = map(lambda t: sum(t), zip(c2, (3*w/4,-w,-w,0))) + c1 = map(lambda t: sum(t), zip(c1, (3*pv/4,-pv,-pv,0))) + c2 = map(lambda t: sum(t), zip(c2, (3*pv/4,-pv,-pv,0))) else: - c1 = map(lambda t: sum(t), zip(c2, (w/3,-w,-w,0))) + c1 = map(lambda t: sum(t), zip(c2, (pv/2,-pv/2,-pv/2,0))) c2 = wx.Colour(255,0,0) dc.GradientFillLinear(r, c1, c2, wx.SOUTH)