gnome15-team team mailing list archive
-
gnome15-team team
-
Mailing list archive
-
Message #00007
Re: stopwatch plugin done!!!
On Tue, 2011-04-05 at 00:30 +0200, Nuno Araujo wrote:
> Hi Brett
>
Hey Nuno,
> Finally the stopwatch plugin is done!
>
Awesome! Very much looking forward to trying it out :)
> 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.
Sounds perfect.
>
> 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.
Understood. This is starting to become a bit of a problem. I was
considering extending the macro system a bit to allow keys to be
assigned to 'Actions'. So :-
* Plugins register Actions they are capable of, along with some sensible
defaults. Model differences will have to be taken into account here.
* Each action is either 'global' (when any page is active), or 'page'
actions that only work on one particular page.
* Some actions could be re-used, for example UP/DOWN/SELECT.
* The user can then assign any key (or combination) to that action in
the macro UI.
>
> **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.
That's interesting. I am not sure, but it may be because the DBUS server
and DBUS client will be using the same 'loop'. I don't fully understand
the internals of those DBUS library. I'll investigate further as there
are other areas where this may be useful.
One possibility is the 'notify-lcd2' plugin. This is designed to run as
separate process that uses the Gnome15 DBUS API to draw the
notifications. What is missing is a way of starting / stopping the
plugin as a separate process, although you should be able to try if you
want by just running using the python command.
There is another known problem with notifications / DBUS, the one where
MPRIS calls hang for a while when notications are enabled. This could be
a clue in finding the cause of that too.
>
> 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.
>
Excellent.
> I could not test the plugin with a G15 keyboard, so the SVG files may
> need some adjustments.
No problem. I will dig out my G15 and try this. Oh, you could use the
GTK driver and change the emulation mode to G15 though ;)
I'll go grab the branch now and try it out. :)
Thanks a lot,
Brett
>
> Regards
>
References