bridge (frontends side): fixed call of async method in blocking context

This commit is contained in:
Goffi 2014-10-16 20:18:40 +02:00
commit 4ba87c6050

View file

@ -450,12 +450,13 @@ class DbusConstructor(Constructor):
completion['args_result'] = self.getArguments(function['sig_in'], name=arg_doc)
completion['async_args'] = 'callback=None, errback=None' if async else ''
completion['async_comma'] = ', ' if async and function['sig_in'] else ''
completion['async_args_result'] = 'timeout=const_TIMEOUT, reply_handler=callback, error_handler=lambda err:errback(dbus_to_bridge_exception(err))' if async else ''
completion['error_handler'] = ("error_handler = None if callback is None else lambda err:errback(dbus_to_bridge_exception(err))\n" + 8*" ") if async else ''
completion['async_args_result'] = 'timeout=const_TIMEOUT, reply_handler=callback, error_handler=error_handler' if async else ''
result = "self.db_%(category)s_iface.%(name)s(%(args_result)s%(async_comma)s%(async_args_result)s)" % completion
completion['result'] = ("unicode(%s)" if self.options.unicode and function['sig_out'] == 's' else "%s") % result
methods_part.append("""\
def %(name)s(self, %(args)s%(async_comma)s%(async_args)s):
%(debug)sreturn %(result)s
%(error_handler)s%(debug)sreturn %(result)s
""" % completion)
#at this point, methods_part should be filled,