[Twisted-Python] little patch to gtk2reactor
Federico Di Gregorio
fog at initd.org
Thu Feb 6 03:55:02 MST 2003
hi *,
this is my first mailto this list so, hello and kudos to all twisted
developers: it (twisted) is great.
as some of you (the ones in irc) already know, yesterday i fight quite a
lot with gtk2reactor not working with latest pygtk2 and i finally got it
working again. the problem is that:
[quote from pygtk ML]
James Henstridge <james at daa.com.au> wrote:
>If you want your callback to be requeued, add "return True" to the end.
>Returning None (which happens if you have no return statement) is
>treated the same as returning False, which tells gtk not to requeue the
>callback.
[/quote]
so the solution is just to add a "return 1" (or the equivalent) to the
end of Gtk2Reactor.callback and a "return real_cb(...)" in input_add.
obvious patch attached.
ciao,
federico
-------------- next part --------------
--- gtk2reactor.py.old 2003-02-06 11:53:46.000000000 +0100
+++ gtk2reactor.py 2003-02-06 11:53:10.000000000 +0100
@@ -71,7 +71,7 @@
if hasattr(source, 'fileno'):
# handle python objects
def wrapper(source, condition, real_s=source, real_cb=callback):
- real_cb(real_s, condition)
+ return real_cb(real_s, condition)
return gtk.input_add(source.fileno(), condition, wrapper)
else:
return gtk.input_add(source, condition, callback)
@@ -151,6 +151,7 @@
# If source disconnected, don't call the rest of the methods.
break
self.simulate()
+ return 1
def simulate(self):
"""Run simulation loops and reschedule callbacks.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: </pipermail/twisted-python/attachments/20030206/f4a47d64/attachment.sig>
More information about the Twisted-Python
mailing list