On Feb 27, 2014, at 11:57 AM, Ben Darnell <[email protected]> wrote:

> Personally I'm -1 on this feature; "idleness" is ill-defined and will either 
> run the function too often or too rarely.  It's better to either trigger it 
> based on some appropriate event or just put it on a timer.

Sorry I've been really behind on mailing list traffic.

I am also -1 on this feature.  Even the idea that there is such a thing as "one 
loop tick" is somewhat implementation-specific; a totally compliant main loop 
could run one thing per "tick" or it could run thousands.  Or never!

The right way to implement the feature that Urwid wants, conceptually, is to 
have a management object that, given some changes to flush to the screen, does 
a redrawer.need_redraw(), implemented like this:

class Redrawer(object):
    def need_redraw(self):
        if not self._dirty:
            self._dirty = True
            self.loop.call_soon(self.redraw)
    def redraw(self):
        self._dirty = False
        # draw stuff

If more than a few packages cry out for this, putting a common implementation 
of this pattern into Tulip might be a good idea, but definitely not within the 
loop itself.

(And this reminds me, I really need to upstream some patches into urwid to get 
it to stop doing horrible stuff to various framework internals to get this 
feature and instead implement it in a simple high-level way...)

-glyph

Attachment: smime.p7s
Description: S/MIME cryptographic signature

Reply via email to