On Mon, 30 Jun 2014 02:15:17 -0700 (PDT)
Fidel N <[email protected]> wrote:
> def on_idle(tag, keywords):
> g.es("iddle timer")
>
> g.registerHandler("idle", on_idle)
>
> g.enableIdleTimeHook(idleTimeDelay=5000)
Edward alluded to some of this in his response, but I'd say:
Never heard of the idleTimeDelay parameter, not sure I believe it
works that way, what if someone else started it with a delay of
1000, or it's just being called on idle by Qt's definition of idle,
so it could be a doc. bug. I do this:
import time
c._todo_1_next = time.time() + 60 # fire once every 60 sec.
then the hook code looks like this
def check(tag, keywords, c=c):
if keywords['c'] != c:
return
now = time.time()
if now < c._todo_1_next:
return
c._todo_1_next = now + 60
so although it's called once for every outline (c) open, it only fires
for the one it was defined in (it was defined by a @script in on
particular outline).
Cheers -Terry
--
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.