Made the colour change from 100% to > 100% less brutal in pygauge

This commit is contained in:
HomeWorld
2010-09-14 19:51:12 +03:00
parent 834b8b809f
commit 44660039d5

View File

@@ -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)