Author: justi9
Date: 2007-10-27 10:43:35 -0400 (Sat, 27 Oct 2007)
New Revision: 1174
Modified:
mgmt/cumin/python/cumin/widgets.py
Log:
In the little status lights, use + in place of multidigit numbers.
Add an "inactive" state.
Modified: mgmt/cumin/python/cumin/widgets.py
===================================================================
--- mgmt/cumin/python/cumin/widgets.py 2007-10-27 14:02:55 UTC (rev 1173)
+++ mgmt/cumin/python/cumin/widgets.py 2007-10-27 14:43:35 UTC (rev 1174)
@@ -14,12 +14,26 @@
def none():
return "<span class=\"none\">None</span>"
-def status(errors, warnings):
+def status(errors, warnings, active=True):
count = errors + warnings
- return "<div class=\"statuslight %s\">%s</div>" % \
- (count == 0 and "green" or (errors and "red" or
"yellow"),
- count == 0 and " " or str(count))
+ if count == 0:
+ number = " "
+ elif count > 9:
+ number = "+"
+ else:
+ number = str(count)
+
+ if active:
+ if count == 0:
+ class_ = "green"
+ else:
+ class_ = errors and "red" or "yellow"
+ else:
+ class_ = "inactive"
+
+ return "<div class=\"statuslight %s\">%s</div>" %
(class_, number)
+
class CuminFrame(Frame, ModeSet):
def __init__(self, app, name):
super(CuminFrame, self).__init__(app, name)