Page 1 of 2

pStopWatch 0.6

Posted: Tue 18 Mar 2008, 23:20
by zigbert
pStopWatch ... Xdialog clock

This is a
- Stopwatch / Timer
- (Alarm) Clock


Ptimer is a gui for pStopWatch

Sigmund Berglund

Code: Select all

# pstopwatch -h                           
Usage: pstopwatch [OPTION]

Options
	-a [command /path/file]
								alternative sound: alarm
	-A HH:MM		alarm at HOUR:MINUTE. requires -C     
	-b [command /path/file]
								alternative sound: beep low     
	-B [command /path/file]
								alternative sound: beep high     
	-c						no countdown - no sync with system time. Use with -s
	-C						start with ordinary clock. Forces -xy
	-f [font:size]	set font-type and fontsize       
	-h						show this help message
	-l [start:stop:header]
								Language support. Local variables for Start:Stop:Window-title                             
	-s						count with seconds, not tenth as default
	-t MM:SS			stopwatch alarm after MINUTES:SECONDS
	-v						show pStopWatch version
	-w X:Y				window size HORIZONTAL:VERTICAL
	-x						auto start
	-y						no stop-button. Must be killed external.

Image


Download
username: puppy
password: linux

pStopWatch-0.6 (7 kb).


Examples:
Big timer with barking

Code: Select all

pstopwatch -cyxst 00:03 -a "aplay /usr/share/audio/bark.au" -f bold:80 -w 470:120
Wake me at 7

Code: Select all

pstopwatch -CA 07:00 -l ::"Wake me at 7"
Changelog
Version 0.6 - 6.Apr 2008
- Less flicker on clock.
- Less flicker on stopwatch when tenth is not used.
- Integration with Ptimer.
- Removed menu entry in *.pet
- Bugfix: Kill external program which plays alarm.
- Bugfix: Window height in Puppy4
- Bugfix: Better parameter control

Posted: Wed 19 Mar 2008, 09:44
by zigbert
Things get clearer after some hours with sleep.

Version 0.2 is not SO buggy, and has got start/stop button.

Posted: Wed 19 Mar 2008, 10:20
by Lobster
Hi Sigmund

I am using pupEEE (3.01 based) and the program comes up
but there is no display (numbering)

:? Have I frozen time or entered the twighlight zone?
am assuming a missing graphic lib?

pStopWatch would be great for athletes/trainers using the Eeepc
Time your lap/effort and graph up in gnumeric . . .
Soon you will be an Olympiad athlete . . . Puppy trained!

:)

Posted: Wed 19 Mar 2008, 10:47
by HairyWill
aha
a project you could not do in gtkdialog
I challenge you to port it

Sorry, Sigmund the fonts do not work for me on muppy 8.

Posted: Wed 19 Mar 2008, 10:51
by zigbert
Could it be so simple that pupEEE has black text in Xdialog. (My Puppy 3.01 has dark grey.) Try to change line 21 in /usr/local/pstopwatch/pstopwatch.
from

Code: Select all

base[NORMAL]	= "#000000" }
to

Code: Select all

 base[NORMAL]	= "#FFFFFF" }
This will give white background.

Sigmund

Posted: Wed 19 Mar 2008, 11:09
by HairyWill
Sorry, I should have been more clear. Both the text in the window and on the button is in the system default font at only 10 or 12 points high. I tried poking at the section that exports the temporary gtk settings, I could change other things but nothing I seemed to do to the font made any difference.

Wait. If you are developing this in dingo then it has no gtk1, the problem may only exist if gtk1 is installed.

Posted: Wed 19 Mar 2008, 11:50
by Lobster
zigbert wrote: from

Code: Select all

base[NORMAL]	= "#000000" }
to

Code: Select all

 base[NORMAL]	= "#FFFFFF" }
This will give white background.

Sigmund
8) that works but I am getting
multiple lines of output - see image

Posted: Wed 19 Mar 2008, 12:03
by HairyWill
well that disproves my gtk1 theory

Posted: Wed 19 Mar 2008, 14:04
by zigbert
HairyWill wrote:aha
a project you could not do in gtkdialog
I challenge you to port it
If you beat me with this, I would be nothing else that VERY pleased.
I guess you have an idea how much I have tried. :)
Lobster wrote: that works but I am getting
multiple lines of output
I seems that Xdialog doesn't use the size parameters in your pupEEE system. Have you tried it on another puppy?

What background color should we use, since black maybe isn't the best choice.

Sigmund

Posted: Wed 19 Mar 2008, 15:53
by zigbert
Version 0.3

The stop watch didn't start correct. Now there are a 3 sec countdown to sync with system clock.

Tested in Puppy4

Posted: Wed 19 Mar 2008, 16:17
by Lobster
Have you tried it on another puppy?
not yet - it's barking at me (v 0.3) :?
What background color should we use, since black maybe isn't the best choice.
the text needs to be smaller or the display window bigger to get it all in. If you are working towards Dingo - then I suggest orange for now
black, white and grey are the neutral colours . . .
. . .or a variable to be configured . . .

Posted: Wed 19 Mar 2008, 16:51
by HairyWill
just tested both 0.2 and 0.3 in dingo7
for both of them the main window appears black with no visible text, the button font is the correct size

tested both on mini-muppy 8
background is black font is just legible but the fonts come out at the system default size

without the -s parameter it is thrashing my cpu

running with fractions o

Posted: Wed 19 Mar 2008, 17:00
by zigbert
just tested both 0.2 and 0.3 in dingo7
for both of them the main window appears black with no visible text, the button font is the correct size
I tested 0.3 on 3 different machines one alpha6, one alpha7, and one 3.01. All shows a nice stop watch. What goes wrong here? :?

Posted: Fri 21 Mar 2008, 12:44
by zigbert
Version 0.4

- Stopping clock during countdown crashed program
- Beeps for Barks.

a suggestion or two

Posted: Fri 21 Mar 2008, 23:13
by vovchik
Dear zigbert,

Thanks. I like the app but also ran into problems with fonts etc. (tiny, standard). One way out of the problem is to do the following after line 18 of the main script:

Code: Select all

mygtk="cat /root/.gtkrc-2.0 | grep include"
and

Code: Select all

echo '$mygtk

as the first line of the sequence that creates gtkrc_mono.

Then, only export the following:

Code: Select all

export GTK2_RC_FILES=/tmp/gtkrc_mono
This will ensure that the user's style is preserved with only the font size and colour changing.

In my case, the relevant line in /root/.gtkrc-2.0 is:

Code: Select all

include "/usr/share/themes/MacOS-X/gtk-2.0/gtkrc"
Also, I have attached two tiny wav files with nice pop sounds. I included one of them in the "Stop" part:

Code: Select all

"$APPDIR"/pstopwatch_counter &
Xdialog --title "Stop Watch" --smooth --screen-center --no-ok --cancel-label "Stop" --logbox /tmp/pstopwatch-clock 383x137
play ./pop-high.wav > /dev/null 2>&1
echo stop > /tmp/pstopwatch-status
tail /tmp/pstopwatch-clock | grep -v "^$" > /tmp/pstopwatch-clock
"$APPDIR"/pstopwatch
Again, thanks and kind regards,
vovchik

Posted: Sat 22 Mar 2008, 08:09
by zigbert
vovchik

Will you please post your hacked code. Since I can't reproduce the trouble, it is hard to test if my coding works.

Nice pops!

Sigmund

Hacked script

Posted: Sat 22 Mar 2008, 12:15
by vovchik
Dear Sigmund,

Here is the hacked code. I've restructured the first script so as to be able to understand more clearly the underlying logic. While most of the changes are not salient, you can see my old-school Pascal mania resurfacing.:). I introduced, among a few vars, mygeometry - which facilitates tweaking - and sound_high and sound_low, softcoded pointers to sound files to permit easy customization, in addition to the gtkrc hack. The only change introduced in the second script, as I recall, is the softcoding of the sound file vars. Please have a look. I'm interested whether the modded code runs fine on your machine.

With kind regards,
vovchik

Rev with parameter checking

Posted: Sat 22 Mar 2008, 15:34
by vovchik
Dear Sigmund,

Here is a slight revision that includes a very primitive parameter check. I noted that my earlier version ignored the "-s" parameter. The benefit of this mod, apart from properly passing the command line parameter, is that it provides a very rudimentary help - both on the command line and using Xdialog.

With kind regards,
vovchik

Posted: Sat 22 Mar 2008, 21:13
by zigbert
Thank you, vovchik.

Posted: Sun 23 Mar 2008, 11:23
by trapster
Working great now with vovchick's script.
I was getting the repeating list of time like Lobster was.

I had to comment out line 38 in pstopwatch_counter due to "true" showing up in the tenths spot.

I also added a colon (":") before $TENTH in line 40:
echo -e "$MIN:$NULL$SECONDS:$TENTH" >> /tmp/pstopwatch-clock

Image