git/list[1] front-page[2] threads[3] people[4] search[5] about
 

[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
Previous: Linus TorvaldsNext: Johannes Schindelin
Message 2 of 10 in “Help with a tcl/tk gui thing..”
  1. Linus TorvaldsOct 1, 2008
  2. Change color at specified thresholdJohannes Schindelin, Oct 1, 2008
  3. Make maximum surf time really per dayJohannes Schindelin, Oct 1, 2008
  4. Linus TorvaldsOct 1, 2008
  5. Mikael MagnussonOct 1, 2008
  6. Linus TorvaldsOct 1, 2008
  7. Mikael MagnussonOct 2, 2008
  8. Linus TorvaldsOct 2, 2008
  9. Mikael MagnussonOct 2, 2008
  10. GUI: Add a progressbar to visualize the time that is leftBjörn Steinbrink, Oct 1, 2008

Read the whole thread, see it on lore, or plain text.

$ cat FOOTERMessages come from the public archive at lore.kernel.org/git, fetched every hour. The front page is chosen and written each morning by an AI editor and can be wrong; the threads themselves are the record. About and API. For agents: an MCP server at https://gitlist.dev/mcp, and any thread, story or person page as Markdown by adding .md to its URL (or sending Accept: text/markdown). Details in /llms.txt.