On Sat, Oct 10, 2009 at 1:24 AM, Sune Foldager <sune.folda...@me.com> wrote: > Adrian Buehlmann wrote: >> IMHO, adding 'return False' randomly in functions that happen to be >> used in idle_add is confusing and suboptimal for maintenance. >> >> We could package my approach in a function for example in >> hgtk.gtklib: >> >> def idle_add(f): >> class single_call(object): >> def __init__(self, f): >> self.f = f >> def __call__(self): >> self.f() >> return False >> gobject.idle_add(single_call(f)) >> >> and then use it like this (example): >> >> gtklib.idle_add(self.realize_settings) >> >> This approach is even extensible, as it would allow to add >> parameters (which would be kept in the single_call object >> until f is called, just add an '*args'). >> >> And it can be applied to every function. >> > +1 as well. As for TK Soh's objections, remember that we use idle_call > on various functions which might also be used for other purposes, and as > such passing in a wrapper, either as a lambda or like Adrian suggests, > seems perfectly normal and good style to me. I support this :)
gtklib.idle_add() does seem to be a reasonable approach. -- Steve Borho ------------------------------------------------------------------------------ Come build with us! The BlackBerry(R) Developer Conference in SF, CA is the only developer event you need to attend this year. Jumpstart your developing skills, take BlackBerry mobile applications to market and stay ahead of the curve. Join us from November 9 - 12, 2009. Register now! http://p.sf.net/sfu/devconference _______________________________________________ Tortoisehg-develop mailing list Tortoisehg-develop@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/tortoisehg-develop