changeset 0a2ee3507b4d in /home/hg/repos/gajim

details:http://hg.gajim.org/gajim?cmd=changeset;node=0a2ee3507b4d
description: [Zhihao Yuan] ability to run a function in a thread without 
calling a callback.

diffstat:

 src/gui_interface.py |  5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diffs (20 lines):

diff -r 71421b4797e7 -r 0a2ee3507b4d src/gui_interface.py
--- a/src/gui_interface.py      Tue Apr 12 16:30:26 2011 +0200
+++ b/src/gui_interface.py      Tue Apr 12 16:34:34 2011 +0200
@@ -2899,13 +2899,14 @@
 
 
 class ThreadInterface:
-    def __init__(self, func, func_args, callback, callback_args):
+    def __init__(self, func, func_args=(), callback=None, callback_args=()):
         """
         Call a function in a thread
         """
         def thread_function(func, func_args, callback, callback_args):
             output = func(*func_args)
-            gobject.idle_add(callback, output, *callback_args)
+            if callback:
+                gobject.idle_add(callback, output, *callback_args)
 
         Thread(target=thread_function, args=(func, func_args, callback,
                 callback_args)).start()
_______________________________________________
Commits mailing list
[email protected]
http://lists.gajim.org/cgi-bin/listinfo/commits

Reply via email to