[TRACKER PATCH] Change color at specified threshold
- From
Johannes Schindelin <johannes.schindelin@gmx.de>
- Date
- Oct 1, 2008, 20:30 UTC
- Message-ID
- <alpine.DEB.1.00.0810012229390.22125@pacific.mpi-cbg.de.mpi-cbg.de>
- In-Reply-To
- <alpine.LFD.2.00.0810011240390.3575@nehalem.linux-foundation.org>
Now the color changes when a certain threshold of remaining seconds is reached.
Signed-off-by: Johannes Schindelin <johannes.schindelin@gmx.de> ---
On Wed, 1 Oct 2008, Linus Torvalds wrote:
> But I also have a UI that the kids can run to _see_ how much > time they have left, so that getting thrown off the machine doesn't > come as a total surprise.
tracker-ui.tcl | 11 +++++++++-- 1 files changed, 9 insertions(+), 2 deletions(-)
diff --git a/tracker-ui.tcl b/tracker-ui.tcl index 16d00d7..1533db5 100755 --- a/tracker-ui.tcl +++ b/tracker-ui.tcl @@ -1,5 +1,7 @@ #!/usr/bin/wish +set red_threshold [expr 60 * 10] + proc every {ms body} { eval $body after $ms [list every $ms $body] @@ -7,14 +9,19 @@ proc every {ms body} { set user $env(USER) -pack [label .tracker -textvariable time] +pack [label .tracker -textvariable time -font "Times 36" -relief sunken] every 1000 { - global user + global user red_threshold set f [open "/var/log/tracker/$user" "r"] gets $f l1 gets $f l2 gets $f l3 close $f set ::time "$l3" + if {[expr [lindex $l1 0] - [lindex $l1 1]] < $red_threshold} { + .tracker configure -foreground white -background red + } { + .tracker configure -foreground black -background white + } }
-- 1.6.0.2.GIT