Leo's present code to handle 'idle' events is unbearably complicated.
Worse, it works more poorly than using g.IdleTime. I am about to make the
following mass conversion from::
g.registerHandler('idle',handler)
to::
timer= g.IdleTime(c,handler,delay=500)
if timer: timer.start()
This bypasses a lot of pointless code, ensures that each handler is only
called on the correct commander (c) and handles shutdown more smoothly.
Furthermore, it provides finer control over idle-time processing. Plugins
can terminate the timer as follows::
timer.stop()
In contrast, g.unregisterHandler('idle') has no effect on any timer. You
could call this a bug.
I shall make these changes throughout Leo, including all "official" plugins
in leoPlugins.leo.
The only question is what to do about "private" plugins that people may
have written for their own use. I propose to do the following:
1. g.registerHandler will special-case 'idle' events. It will execute::
timer= g.IdleTime(c,handler,delay=500)
if timer: timer.start()
g.es_print('g.registerHandler("idle") is deprecated')
There is no need for the code to return the timer. No current code could
be using it.
2. g.unregisterHandler will throw a ValueError for 'idle' events. Trying to
unregister an 'idle' hook has never worked, and should be clearly flagged
as being wrong.
Your comments, please.
Edward
--
You received this message because you are subscribed to the Google Groups
"leo-editor" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/leo-editor.
For more options, visit https://groups.google.com/d/optout.