You are not logged in.

#1 2013-04-12 17:55:17

Unia
Member
From: Stockholm, Sweden
Registered: 2010-03-30
Posts: 2,486
Website

GTimeUtils: small GTK3 stopwatch and timer

Hey guys,

Another "quick" project of mine: a stopwatch  big_smile I found gnome-clocks a tad much for my simple stopwatch needs, so I wrote my own. I found a very basic one by Mutantturkey and forked it.

I ported it to GTK3, added a tree widget, some buttons, support for laps and more. What does it do? What you expect from a basic stopwatch! It starts running, pauses running, resets, stops and has support for laps. I looked into adding the split time between laps, but couldn't get this to work so I dropped it (personally, I don't need it anyway). Patches are welcome, though!

Here's a quick screenshot:
taTJtYw

taTJtZA

And the code: https://github.com/Unia/gtimeutils
AUR: https://aur.archlinux.org/packages/gtimeutils-git/

Last edited by Unia (2013-04-16 22:06:37)


If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres

Offline

#2 2013-04-16 22:05:19

Unia
Member
From: Stockholm, Sweden
Registered: 2010-03-30
Posts: 2,486
Website

Re: GTimeUtils: small GTK3 stopwatch and timer

I have just added a small timer too. It's only an initial version for now, it still needs some improvements (see below) but the main function, counting down, works  smile

Improvements:
1. sound/notification when timer is done;
2. Colored buttons;
3. Sensitive buttons;

Last edited by Unia (2013-04-17 00:29:43)


If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres

Offline

#3 2013-05-06 18:53:43

Unia
Member
From: Stockholm, Sweden
Registered: 2010-03-30
Posts: 2,486
Website

Re: GTimeUtils: small GTK3 stopwatch and timer

I just pushed a new update to Gtimer: you can now set the text to be displayed in the notification. If you don't specify it, it will say what it has always said before: Time is up!.

If you want to change that, just feed the GtkEntry something new and start the timer wink


If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres

Offline

#4 2013-05-06 18:56:22

HalosGhost
Forum Moderator
From: Twin Cities, MN
Registered: 2012-06-22
Posts: 2,089
Website

Re: GTimeUtils: small GTK3 stopwatch and timer

Any plans to add curses support? tongue

All the best,

-HG

Offline

#5 2013-05-06 19:10:39

Unia
Member
From: Stockholm, Sweden
Registered: 2010-03-30
Posts: 2,486
Website

Re: GTimeUtils: small GTK3 stopwatch and timer

If I'd go that way, I guess I would have to approach this differently; I'm using Glib's timer functions. When using GTK, this isn't that much of a hurdle since GTK requires Glib.

Curses, however... tongue

Last edited by Unia (2013-05-06 19:10:59)


If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres

Offline

#6 2013-05-06 19:16:00

HalosGhost
Forum Moderator
From: Twin Cities, MN
Registered: 2012-06-22
Posts: 2,089
Website

Re: GTimeUtils: small GTK3 stopwatch and timer

Fair enough. tongue Each day, I move one step closer to using only curses interfaces, with only a very few exceptions.

All the best,

-HG

Offline

#7 2013-05-06 19:21:33

Unia
Member
From: Stockholm, Sweden
Registered: 2010-03-30
Posts: 2,486
Website

Re: GTimeUtils: small GTK3 stopwatch and timer

I am willing to attempt coding a curses based stopwatch/timer, if you need one. It will probably take a while though, as I've never done curses before and I'm on a trip through Europe with my twin brother.

EDIT: Are you sure there's not already some available? I can't imagine no one has ever made one; I mean, for a skilled programmer this should be relatively easy.

Last edited by Unia (2013-05-06 19:24:21)


If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres

Offline

#8 2013-05-06 19:25:54

HalosGhost
Forum Moderator
From: Twin Cities, MN
Registered: 2012-06-22
Posts: 2,089
Website

Re: GTimeUtils: small GTK3 stopwatch and timer

Unia wrote:

I am willing to attempt coding a curses based stopwatch/timer, if you need one. It will probably take a while though, as I've never done curses before and I'm on a trip through Europe with my twin brother.

Really? Where abouts are you? And, I don't have a need for a curses-based timer at the moment, though it would be helpful when I go back to judging debate next Fall (certainly do not feel compelled to make one on my account).

All the best,

-HG

Offline

#9 2013-05-06 20:03:35

Unia
Member
From: Stockholm, Sweden
Registered: 2010-03-30
Posts: 2,486
Website

Re: GTimeUtils: small GTK3 stopwatch and timer

Currently we're in Crete, our previous and first destination was Istanbul. We have no idea what the next will be, but we're thinking of Budapest and we also want to see Chernobyl big_smile


If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres

Offline

#10 2013-05-06 22:05:50

progandy
Member
Registered: 2012-05-17
Posts: 5,184

Re: GTimeUtils: small GTK3 stopwatch and timer

HalosGhost wrote:

Any plans to add curses support? tongue

All the best,

-HG

I suggest utimer. It is no curses interface, only console. You have a timer, a countdown, and a stopwatch. Everything with laps (enter), pause (space), stop (q).


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#11 2013-05-07 07:56:14

HalosGhost
Forum Moderator
From: Twin Cities, MN
Registered: 2012-06-22
Posts: 2,089
Website

Re: GTimeUtils: small GTK3 stopwatch and timer

progandy wrote:

I suggest utimer. It is no curses interface, only console. You have a timer, a countdown, and a stopwatch. Everything with laps (enter), pause (space), stop (q).

Iiiinteresting. I'll take a look at it. Don't want to thread-jack though.

All the best,

-HG

Offline

#12 2013-05-07 12:46:00

chneukirchen
Member
Registered: 2010-02-11
Posts: 100

Re: GTimeUtils: small GTK3 stopwatch and timer

Would be awesome if you allowed to set timeout and text from command line, and then start immediately when run.

Offline

#13 2013-05-07 14:20:17

Unia
Member
From: Stockholm, Sweden
Registered: 2010-03-30
Posts: 2,486
Website

Re: GTimeUtils: small GTK3 stopwatch and timer

chneukirchen wrote:

Would be awesome if you allowed to set timeout and text from command line, and then start immediately when run.

Interesting, I will look into this. Shouldn't be too hard I think.


If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres

Offline

#14 2013-05-07 15:06:09

Unia
Member
From: Stockholm, Sweden
Registered: 2010-03-30
Posts: 2,486
Website

Re: GTimeUtils: small GTK3 stopwatch and timer

Unia wrote:
chneukirchen wrote:

Would be awesome if you allowed to set timeout and text from command line, and then start immediately when run.

Interesting, I will look into this. Shouldn't be too hard I think.

It wasn't and has been added smile Please test and see if this is what you wanted. I chose to use -u for hours since -h was already taken by default (by the help message) so I took the first letter of the Dutch word for hours: uren. If you want something else that might make more sense, tell me.


If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres

Offline

#15 2013-05-07 15:56:40

chneukirchen
Member
Registered: 2010-02-11
Posts: 100

Re: GTimeUtils: small GTK3 stopwatch and timer

Unia wrote:
Unia wrote:
chneukirchen wrote:

Would be awesome if you allowed to set timeout and text from command line, and then start immediately when run.

Interesting, I will look into this. Shouldn't be too hard I think.

It wasn't and has been added smile Please test and see if this is what you wanted. I chose to use -u for hours since -h was already taken by default (by the help message) so I took the first letter of the Dutch word for hours: uren. If you want something else that might make more sense, tell me.

That's fine. Now I just want to have a flag to immediately start it (my use case is alias pizza="gtimer -m 8 -t "Pizza is ready!")

Offline

#16 2013-05-07 16:53:59

Unia
Member
From: Stockholm, Sweden
Registered: 2010-03-30
Posts: 2,486
Website

Re: GTimeUtils: small GTK3 stopwatch and timer

chneukirchen wrote:

That's fine. Now I just want to have a flag to immediately start it (my use case is alias pizza="gtimer -m 8 -t "Pizza is ready!")

Done smile See the new -r option.


If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres

Offline

#17 2013-05-19 22:52:04

Unia
Member
From: Stockholm, Sweden
Registered: 2010-03-30
Posts: 2,486
Website

Re: GTimeUtils: small GTK3 stopwatch and timer

I know there are some people out there who stick with GTK2 as much as I try to go GTK3 only. For those people (and for the fun of it), I have updated GTimeUtils with GTK2 support. It required only a few changes.

You can choose which version to build by specifying -GTK{2,3} to make at compile time. See the README in the GitHub repository for more information.

EDIT: Also, Gtimer has gotten rudimentary systray support for those who have a systray. This code isn't finished, though, and definitely needs testing. If you use Gtimer and you have a system tray, could you give the latest version a go and report any issues to me?

Last edited by Unia (2013-05-19 22:53:06)


If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres

Offline

#18 2013-06-07 11:45:46

Unia
Member
From: Stockholm, Sweden
Registered: 2010-03-30
Posts: 2,486
Website

Re: GTimeUtils: small GTK3 stopwatch and timer

I have removed the system tray. It might be back in a future version, but I don't want to have half-working features in my application. I will first perfectionalize the rest and then I might look into this again.


If you can't sit by a cozy fire with your code in hand enjoying its simplicity and clarity, it needs more work. --Carlos Torres

Offline

Board footer

Powered by FluxBB