call gtk.gdk.threads_init() to initialise threads used when en/decrypting GPG. Fixes #4959

This commit is contained in:
Yann Leboulanger 2009-04-25 22:10:03 +00:00
parent e412cd1dfb
commit 5419b2cb36
1 changed files with 14 additions and 13 deletions

View File

@ -477,19 +477,19 @@ class PassphraseRequest:
self.dialog_created = True
class ThreadInterface:
def __init__(self, func, func_args, callback, callback_args):
'''Call a function in a thread
:param func: the function to call in the thread
:param func_args: list or arguments for this function
:param callback: callback to call once function is finished
:param callback_args: list of arguments for this callback
'''
def thread_function(func, func_args, callback, callback_args):
output = func(*func_args)
gobject.idle_add(callback, output, *callback_args)
Thread(target=thread_function, args=(func, func_args, callback,
class ThreadInterface:
def __init__(self, func, func_args, callback, callback_args):
'''Call a function in a thread
:param func: the function to call in the thread
:param func_args: list or arguments for this function
:param callback: callback to call once function is finished
:param callback_args: list of arguments for this callback
'''
def thread_function(func, func_args, callback, callback_args):
output = func(*func_args)
gobject.idle_add(callback, output, *callback_args)
Thread(target=thread_function, args=(func, func_args, callback,
callback_args)).start()
class Interface:
@ -3536,6 +3536,7 @@ if __name__ == '__main__':
Interface()
try:
gtk.gdk.threads_init()
gtk.main()
except KeyboardInterrupt:
print >> sys.stderr, 'KeyboardInterrupt'