← Back to team overview

gnome15-team team mailing list archive

stopwatch plugin done!!!

 

Hi Brett

Finally the stopwatch plugin is done! 

This plugin gives two configurable timers to the user. For each timer
the user can enable or disable them and select their "working mode"
(stopwatch or countdown). Each time a countdown timer reaches "zero" a
notification is displayed to the user. Countdown timers can run
continuously in a "loop" mode.

When running my first "integration" tests, I had two main problems.
They were the cause of the "delayed" delivery:

**1. Menu plugin and L2 key**
At first, I had the "G15" keys configured as follows
L2 - Start timer 1
L3 - Reset timer 1
L4 - Start timer 2
L5 - Reset timer 2

The problems was that if the menu plugin is enabled, the L2 key is
assigned to that plugin.
As a workaround I changed the stopwatch plugin so that the user can
select the "active" plugin with the L5 key, and use the L3 and L4 keys
to control that timer.

**2. pynotify and notify-lcd plugin**
At first, I used pynotify to display "Timer is over" notifications to
the user.
This was working fine, until I enabled the notify-lcd plugin.
For a reason that I don't understand (but I must admit I didn't look too
much at it), the plugin seems to hang and a timeout message is displayed
if I do a pynotify call from inside the plugin code.
As a workaround, I display notifications by calling the //notify-send//
utility that comes with libnotify.

If you take a look at the code, you will see that I avoided using
threads for the timers.
I know their value by doing some time arithmetic, and knowing the last
time they were paused/resumed.
This means that notifications are "passive". They are only displayed
when the timer value is read and the read value is lower than zero.

I could not test the plugin with a G15 keyboard, so the SVG files may
need some adjustments.

Regards

-- 
Nuno Araujo <nuno.araujo@xxxxxxxxxxx>




Follow ups