{"thread":{"id":"15739","subject":"Help with a tcl/tk gui thing..","startedAt":"2008-10-01T19:54:44Z","lastAt":"2008-10-02T15:01:46Z","messageCount":10,"participants":["Linus Torvalds","Johannes Schindelin","Mikael Magnusson","Björn Steinbrink"],"isPatch":false,"patchVersion":null,"patchTotal":null},"messages":[{"id":"92087","messageId":"alpine.LFD.2.00.0810011240390.3575@nehalem.linux-foundation.org","threadId":"15739","inReplyTo":null,"subject":"Help with a tcl/tk gui thing..","fromName":"Linus Torvalds","fromEmail":"torvalds@linux-foundation.org","sentAt":"2008-10-01T19:54:44Z","receivedAt":"2008-10-01T19:54:44Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\nOk, this is ridiculous, and has nothing to do with git apart from being \nhosted in it, but I thought I'd send out an email about it since the git \ncommunity is the only one I know that does any GUI work at all...\n\nI've got three girls, all wasting their time on their computer, and we set \nup this rule that they get to have a maximum of an hour of internet time \neach day. Of course, being the geek I am, I wrote a stupid time tracker \nfor that purpose, and then totally forgot about it.\n\nUntil the harddisk in their computer broke down, and I had to re-install, \nand realized that I didn't have a copy of my stupid tracker sources \nanywhere. So I had to re-write it, and to make sure that I didn't lose it \n_again_, I put it in a git repo this time, and now have it on my desktop \nmachine.\n\nI _also_ have it on kernel.org, because I tend to change machines often \nenough that files get lost because I decide that switching machines is \nalso a great way of doing \"generational GC\" on my home directory.\n\n[ iow, I copy my old home directory as \"old-home\" when I switch machines, \n  and anything I didn't end up copying by the time I switch machines \n  again, just gets deleted. Very neat, and a great way to lose things that \n  you only care about every other year or so. ]\n\nWhatever.\n\nTo make a long story short, I have a very small program that does all the \ntracking, and I have no problems with that. It doesn't have much of a \nadmin interface, but I can do \"echo 3600 > /var/log/tracker/celeste\" to \nreset the time etc. _I_ have no need for pretty GUI's.\n\nBut I also have a UI that the kids can run to _see_ how much time they \nhave left, so that getting thrown off the machine doesn't come as a total \nsurprise. And yesterday Patricia asked why it has to be that ugly. And I \nhad to admit that her dad is just not very good at UI's - and my \nre-implementation may in fact have been EVEN UGLIER than my original \nversion. If that is even possible.\n\nBut hey, I'm not above impressing my kids with pretty bling if I can get \nsomebody else who actually knows what they are doing to enhance my wish \nscripts to something reasonable.\n\nAnybody?\n\nThe repository is at\n\n\tgit://git.kernel.org/pub/scm/linux/kernel/git/torvalds/tracker.git\n\nif somebody knows how to make the text turn red when the end is near \nand/or make it have some nice graphical bar that fills up as time is about \nto expire.\n\nAnd if nobody does, no worries. At least I tried. My kids can continue to \nwatch ugly/small/monochrome fonts with just a count-down clock.\n\n\t\t\tLinus\n"},{"id":"92089","messageId":"alpine.DEB.1.00.0810012229390.22125@pacific.mpi-cbg.de.mpi-cbg.de","threadId":"15739","inReplyTo":"alpine.LFD.2.00.0810011240390.3575@nehalem.linux-foundation.org","subject":"[TRACKER PATCH] Change color at specified threshold","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-10-01T20:30:37Z","receivedAt":"2008-10-01T20:30:37Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\nNow the color changes when a certain threshold of remaining seconds is\nreached.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n\n\tOn Wed, 1 Oct 2008, Linus Torvalds wrote:\n\n\t> But I also have a UI that the kids can run to _see_ how much \n\t> time they have left, so that getting thrown off the machine doesn't \n\t> come as a total surprise.\n\n tracker-ui.tcl |   11 +++++++++--\n 1 files changed, 9 insertions(+), 2 deletions(-)\n\ndiff --git a/tracker-ui.tcl b/tracker-ui.tcl\nindex 16d00d7..1533db5 100755\n--- a/tracker-ui.tcl\n+++ b/tracker-ui.tcl\n@@ -1,5 +1,7 @@\n #!/usr/bin/wish\n \n+set red_threshold [expr 60 * 10]\n+\n proc every {ms body} {\n      eval $body\n      after $ms [list every $ms $body]\n@@ -7,14 +9,19 @@ proc every {ms body} {\n \n set user $env(USER)\n \n-pack [label .tracker -textvariable time]\n+pack [label .tracker -textvariable time -font \"Times 36\" -relief sunken]\n \n every 1000 {\n-\tglobal user\n+\tglobal user red_threshold\n \tset f [open \"/var/log/tracker/$user\" \"r\"]\n \tgets $f l1\n \tgets $f l2\n \tgets $f l3\n \tclose $f\n \tset ::time \"$l3\"\n+\tif {[expr [lindex $l1 0] - [lindex $l1 1]] < $red_threshold} {\n+\t\t.tracker configure -foreground white -background red\n+\t} {\n+\t\t.tracker configure -foreground black -background white\n+\t}\n }\n-- \n1.6.0.2.GIT\n"},{"id":"92092","messageId":"alpine.DEB.1.00.0810012239030.22125@pacific.mpi-cbg.de.mpi-cbg.de","threadId":"15739","inReplyTo":"alpine.DEB.1.00.0810012229390.22125@pacific.mpi-cbg.de.mpi-cbg.de","subject":"[PATCH] Make maximum surf time really per day","fromName":"Johannes Schindelin","fromEmail":"johannes.schindelin@gmx.de","sentAt":"2008-10-01T20:41:30Z","receivedAt":"2008-10-01T20:41:30Z","isPatch":true,"sender":{"key":"johannes.schindelin@gmx.de","avatar":"https://avatars.githubusercontent.com/u/127790?v=4"},"body":"\nEarlier, when the maximum time was reached, we would block for 8 hours.\nThe program description suggested that the maximum time should be per\nday instead, however.  So rather check that.\n\nSigned-off-by: Johannes Schindelin <johannes.schindelin@gmx.de>\n---\n\n\tI am sure your kids will hate me.  Now the trick to surf before \n\tschool, after school, and then late at night does not work \n\tanymore.  :-(\n\n\tWell, the \"late at night\" would have interfered with next day's \n\t\"before school\" anyway.\n\n tracker.c |    5 ++++-\n 1 files changed, 4 insertions(+), 1 deletions(-)\n\ndiff --git a/tracker.c b/tracker.c\nindex 1b26e7e..faa4a91 100644\n--- a/tracker.c\n+++ b/tracker.c\n@@ -12,6 +12,9 @@\n \n #define TRACKER_FILE \"/var/log/tracker/%s\"\n \n+/* Define this, just in case it changes some day */\n+#define SECS_PER_DAY 86400\n+\n enum state {\n \tno_user, old_user, new_user\n };\n@@ -43,7 +46,7 @@ static void update_fd(struct user *user, int fd, unsigned int s)\n \tcur += s;\n \n \t/* Has the user been logged out more than 8 hours? */\n-\tif (user->last - last >= 8*60*60)\n+\tif (user->last / SECS_PER_DAY != last / SECS_PER_DAY)\n \t\tcur = 0;\n \n \tleft = max - cur;\n-- \n1.6.0.2.GIT\n"},{"id":"92095","messageId":"237967ef0810011403i2b18255and988df29a71798bf@mail.gmail.com","threadId":"15739","inReplyTo":"alpine.LFD.2.00.0810011240390.3575@nehalem.linux-foundation.org","subject":"Re: Help with a tcl/tk gui thing..","fromName":"Mikael Magnusson","fromEmail":"mikachu@gmail.com","sentAt":"2008-10-01T21:03:50Z","receivedAt":"2008-10-01T21:03:50Z","isPatch":false,"sender":{"key":"mikachu@gmail.com","avatar":null},"body":"How's this?\n\ngit clone git://mika.l3ib.org/tracker.git\n\nI wrote it in pygtk since I know zero to no tcl/tk, hope that's okay.\nIt has a label with the time remaining (simply read from the daemon file),\nand shows the text in red if less than 10% is remaining. You'll need to\nchange the ./ in cb_function to /var/log/tracker since I forgot to change\nthat and I'm lazy :).\n\n2008/10/1 Linus Torvalds <torvalds@linux-foundation.org>:\n>\n> Ok, this is ridiculous, and has nothing to do with git apart from being\n> hosted in it, but I thought I'd send out an email about it since the git\n> community is the only one I know that does any GUI work at all...\n>\n> I've got three girls, all wasting their time on their computer, and we set\n> up this rule that they get to have a maximum of an hour of internet time\n> each day. Of course, being the geek I am, I wrote a stupid time tracker\n> for that purpose, and then totally forgot about it.\n>\n> Until the harddisk in their computer broke down, and I had to re-install,\n> and realized that I didn't have a copy of my stupid tracker sources\n> anywhere. So I had to re-write it, and to make sure that I didn't lose it\n> _again_, I put it in a git repo this time, and now have it on my desktop\n> machine.\n>\n> I _also_ have it on kernel.org, because I tend to change machines often\n> enough that files get lost because I decide that switching machines is\n> also a great way of doing \"generational GC\" on my home directory.\n>\n> [ iow, I copy my old home directory as \"old-home\" when I switch machines,\n>  and anything I didn't end up copying by the time I switch machines\n>  again, just gets deleted. Very neat, and a great way to lose things that\n>  you only care about every other year or so. ]\n>\n> Whatever.\n>\n> To make a long story short, I have a very small program that does all the\n> tracking, and I have no problems with that. It doesn't have much of a\n> admin interface, but I can do \"echo 3600 > /var/log/tracker/celeste\" to\n> reset the time etc. _I_ have no need for pretty GUI's.\n>\n> But I also have a UI that the kids can run to _see_ how much time they\n> have left, so that getting thrown off the machine doesn't come as a total\n> surprise. And yesterday Patricia asked why it has to be that ugly. And I\n> had to admit that her dad is just not very good at UI's - and my\n> re-implementation may in fact have been EVEN UGLIER than my original\n> version. If that is even possible.\n>\n> But hey, I'm not above impressing my kids with pretty bling if I can get\n> somebody else who actually knows what they are doing to enhance my wish\n> scripts to something reasonable.\n>\n> Anybody?\n>\n> The repository is at\n>\n>        git://git.kernel.org/pub/scm/linux/kernel/git/torvalds/tracker.git\n>\n> if somebody knows how to make the text turn red when the end is near\n> and/or make it have some nice graphical bar that fills up as time is about\n> to expire.\n>\n> And if nobody does, no worries. At least I tried. My kids can continue to\n> watch ugly/small/monochrome fonts with just a count-down clock.\n>\n>                        Linus\n> --\n> To unsubscribe from this list: send the line \"unsubscribe git\" in\n> the body of a message to majordomo@vger.kernel.org\n> More majordomo info at  http://vger.kernel.org/majordomo-info.html\n>\n\n\n\n-- \nMikael Magnusson\n"},{"id":"92097","messageId":"20081001210901.GA5731@atjola.homenet","threadId":"15739","inReplyTo":"alpine.LFD.2.00.0810011240390.3575@nehalem.linux-foundation.org","subject":"[PATCH] GUI: Add a progressbar to visualize the time that is left","fromName":"Björn Steinbrink","fromEmail":"b.steinbrink@gmx.de","sentAt":"2008-10-01T21:09:01Z","receivedAt":"2008-10-01T21:09:01Z","isPatch":true,"sender":{"key":"b.steinbrink@gmx.de","avatar":"https://avatars.githubusercontent.com/u/230962?v=4"},"body":"Signed-off-by: Björn Steinbrink <B.Steinbrink@gmx.de>\n---\nOK, this bar doesn't fill up as you requested, but instead gets empty,\nthat's just how I feel it should be ;-)\n\nMight require Tcl/Tk 8.5...\n\n tracker-ui.tcl |    6 ++++++\n 1 files changed, 6 insertions(+), 0 deletions(-)\n\ndiff --git a/tracker-ui.tcl b/tracker-ui.tcl\nindex 16d00d7..5314c57 100755\n--- a/tracker-ui.tcl\n+++ b/tracker-ui.tcl\n@@ -8,6 +8,7 @@ proc every {ms body} {\n set user $env(USER)\n \n pack [label .tracker -textvariable time]\n+pack [ttk::progressbar .bar]\n \n every 1000 {\n \tglobal user\n@@ -17,4 +18,9 @@ every 1000 {\n \tgets $f l3\n \tclose $f\n \tset ::time \"$l3\"\n+\tset times [split \"$l1\" \" \"]\n+\tset max [lindex $times 0]\n+\tset cur [lindex $times 1]\n+\tset left [expr $max - $cur]\n+\t.bar configure -max $max -value $left\n }\n-- \n1.6.0.2.307.gc427\n"},{"id":"92102","messageId":"alpine.LFD.2.00.0810011605001.3341@nehalem.linux-foundation.org","threadId":"15739","inReplyTo":"237967ef0810011403i2b18255and988df29a71798bf@mail.gmail.com","subject":"Re: Help with a tcl/tk gui thing..","fromName":"Linus Torvalds","fromEmail":"torvalds@linux-foundation.org","sentAt":"2008-10-01T23:06:36Z","receivedAt":"2008-10-01T23:06:36Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Wed, 1 Oct 2008, Mikael Magnusson wrote:\n> \n> git clone git://mika.l3ib.org/tracker.git\n> \n> I wrote it in pygtk since I know zero to no tcl/tk, hope that's okay.\n> It has a label with the time remaining (simply read from the daemon file),\n> and shows the text in red if less than 10% is remaining. You'll need to\n> change the ./ in cb_function to /var/log/tracker since I forgot to change\n> that and I'm lazy :).\n\nWell, it doesn't do anything at all for me except change the cursor to a \ncross, and if I'm a n00b with tcl/tk, I'm even more of one with pygtk.\n\nI merged the two other suggestions, though. And am open to seeing that \npygtk thing too as an alternative, but only if it actually works for me ;)\n\n\t\tLinus\n"},{"id":"92103","messageId":"alpine.LFD.2.00.0810011606550.3341@nehalem.linux-foundation.org","threadId":"15739","inReplyTo":"alpine.DEB.1.00.0810012239030.22125@pacific.mpi-cbg.de.mpi-cbg.de","subject":"Re: [PATCH] Make maximum surf time really per day","fromName":"Linus Torvalds","fromEmail":"torvalds@linux-foundation.org","sentAt":"2008-10-01T23:09:56Z","receivedAt":"2008-10-01T23:09:56Z","isPatch":true,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Wed, 1 Oct 2008, Johannes Schindelin wrote:\n> \n> Earlier, when the maximum time was reached, we would block for 8 hours.\n> The program description suggested that the maximum time should be per\n> day instead, however.  So rather check that.\n\nI actually prefer the old behavior. Your new one has a \"flag time\" when \nyou get all your time back, and it's not even something logical like \nmidnight, it is (if I read the patch right), \"midnight UTC\" that will do \nit.\n\nSo the \"you have to be offline for at least 8 hours\" thing is actually \nsomething that even my old tracker worked with, and at least with my kids, \nthere is no worry that they'd wake up early just to do it both before \n_and_ after school ;)\n\n\t\tLinus\n"},{"id":"92113","messageId":"237967ef0810012218i28d41573s6bb7866e0be485f2@mail.gmail.com","threadId":"15739","inReplyTo":"alpine.LFD.2.00.0810011605001.3341@nehalem.linux-foundation.org","subject":"Re: Help with a tcl/tk gui thing..","fromName":"Mikael Magnusson","fromEmail":"mikachu@gmail.com","sentAt":"2008-10-02T05:18:15Z","receivedAt":"2008-10-02T05:18:15Z","isPatch":false,"sender":{"key":"mikachu@gmail.com","avatar":null},"body":"2008/10/2 Linus Torvalds <torvalds@linux-foundation.org>:\n>\n>\n> On Wed, 1 Oct 2008, Mikael Magnusson wrote:\n>>\n>> git clone git://mika.l3ib.org/tracker.git\n>>\n>> I wrote it in pygtk since I know zero to no tcl/tk, hope that's okay.\n>> It has a label with the time remaining (simply read from the daemon file),\n>> and shows the text in red if less than 10% is remaining. You'll need to\n>> change the ./ in cb_function to /var/log/tracker since I forgot to change\n>> that and I'm lazy :).\n>\n> Well, it doesn't do anything at all for me except change the cursor to a\n> cross, and if I'm a n00b with tcl/tk, I'm even more of one with pygtk.\n>\n> I merged the two other suggestions, though. And am open to seeing that\n> pygtk thing too as an alternative, but only if it actually works for me ;)\n\nHeh, sorry, I'm an idiot. I forgot to put '#!/usr/bin/python' on the first\nline. I was running 'python tracker-ui.py' then did chmod +x just before\ncommitting :). So the cross is coming from running 'import time'.\n\n-- \nMikael Magnusson\n"},{"id":"92169","messageId":"alpine.LFD.2.00.0810020746480.3341@nehalem.linux-foundation.org","threadId":"15739","inReplyTo":"237967ef0810012218i28d41573s6bb7866e0be485f2@mail.gmail.com","subject":"Re: Help with a tcl/tk gui thing..","fromName":"Linus Torvalds","fromEmail":"torvalds@linux-foundation.org","sentAt":"2008-10-02T14:49:09Z","receivedAt":"2008-10-02T14:49:09Z","isPatch":false,"sender":{"key":"torvalds@linux-foundation.org","avatar":"https://avatars.githubusercontent.com/u/1024025?v=4"},"body":"\n\nOn Thu, 2 Oct 2008, Mikael Magnusson wrote:\n> \n> Heh, sorry, I'm an idiot. I forgot to put '#!/usr/bin/python' on the first\n> line. I was running 'python tracker-ui.py' then did chmod +x just before\n> committing :). So the cross is coming from running 'import time'.\n\nAhh. It did _something_, so I assumed it was working, just not well. Being \nconfused about the language would do it ;)\n\nI fixed it up and merged it as an alternate UI. It doesn't react well to a \ntracker file that has just been initialized with the timeout (but without \nany of the extra information that gets filled out once you actually start \ngetting tracked), but it's certainly prettier than my original one.\n\nThanks,\n\n\t\tLinus\n"},{"id":"92173","messageId":"237967ef0810020801o47a40f8ye832a02783b5f992@mail.gmail.com","threadId":"15739","inReplyTo":"alpine.LFD.2.00.0810020746480.3341@nehalem.linux-foundation.org","subject":"Re: Help with a tcl/tk gui thing..","fromName":"Mikael Magnusson","fromEmail":"mikachu@gmail.com","sentAt":"2008-10-02T15:01:46Z","receivedAt":"2008-10-02T15:01:46Z","isPatch":false,"sender":{"key":"mikachu@gmail.com","avatar":null},"body":"2008/10/2 Linus Torvalds <torvalds@linux-foundation.org>:\n>\n>\n> On Thu, 2 Oct 2008, Mikael Magnusson wrote:\n>>\n>> Heh, sorry, I'm an idiot. I forgot to put '#!/usr/bin/python' on the first\n>> line. I was running 'python tracker-ui.py' then did chmod +x just before\n>> committing :). So the cross is coming from running 'import time'.\n>\n> Ahh. It did _something_, so I assumed it was working, just not well. Being\n> confused about the language would do it ;)\n>\n> I fixed it up and merged it as an alternate UI. It doesn't react well to a\n> tracker file that has just been initialized with the timeout (but without\n> any of the extra information that gets filled out once you actually start\n> getting tracked), but it's certainly prettier than my original one.\n\nAh, I didn't play around too much with the actual server part, but I guess\nthat would get sort of annoying, so I pushed a fix for that, and also it\nnow sets the window title right.\n\nI should also note that I'm not exactly a python master, so if it looks ugly,\nblame me, not python :).\n\n-- \nMikael Magnusson\n"}]}