​​
​​
​​On Fri, Mar 27, 2015 at 10:01 AM, Edward K. Ream <[email protected]>
wrote:

​> ​
Leo's present code to handle 'idle' events is unbearably complicated.

​Rev f7a05b7 (and a few previous) simplifies Leo's core idle-time handling.

The rest of this post is an Engineering Notebook post.  Feel free to
ignore.  Here are the details:

1. g.enableIdleTimeHook is now dead simple::

    def enableIdleTimeHook(*args,**keys): # All args ignored.
        '''
        Enable idle-time processing.

        Leo calls g.idleTimeHookHandler every g.app.idleTimeDelay msec.
        '''
        if g.app.idle_timer:
            g.app.idle_timer.start()
        else:
            timer = g.IdleTime(g.idleTimeHookHandler,g.app.idleTimeDelay)
            if timer:
                g.app.idle_timer = timer
                timer.start()

        g.app.idle_timer_enabled = True

2. There is now one and *only* one idle-time handler, namely
g.idleTimeHookHandler.  A lot of faux "flexibility" is gone.

3. Idle-time is now enabled if and only if g.app.idle_timer_enabled is
True.

4. g.enableIdleTimeHook ignores all arguments to it.  Idle-time handling is
constant once started, although it can be disabled.

5. Recent revs remove calls to g.enableIdleTimeHook in various plugins.
Those calls basically make no sense.

Idle-time handling will always be on unless there is an exception somewhere
or the user turns idle-time handling off.  In neither case does it make
sense for the plugin to attempt to restart the idle-time code.

In short, there has been an excellent collapse in complexity of Leo's
idle-time code.  This will come in handy as I work on vim-open-file.

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.

Reply via email to