changeset 1024:7e43ea75cce8

bridge (constructor): fixed D-Bus frontend generator for async method without sig_in + fixed --debug option + regenerated bridge to fix bad frontend D-Bus bridge.
author Goffi <goffi@goffi.org>
date Thu, 15 May 2014 16:35:28 +0200
parents 8bae81e254a2
children 24fe24cfb363
files frontends/src/bridge/DBus.py src/bridge/bridge_constructor/bridge_constructor.py
diffstat 2 files changed, 6 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/frontends/src/bridge/DBus.py	Thu May 15 16:02:16 2014 +0200
+++ b/frontends/src/bridge/DBus.py	Thu May 15 16:35:28 2014 +0200
@@ -180,7 +180,7 @@
     def getProgress(self, id, profile):
         return self.db_core_iface.getProgress(id, profile)
 
-    def getReady(self, , callback=None, errback=None):
+    def getReady(self, callback=None, errback=None):
         return self.db_core_iface.getReady(reply_handler=callback, error_handler=lambda err:errback(err._dbus_error_name[len(const_ERROR_PREFIX)+1:]))
 
     def getVersion(self, ):
--- a/src/bridge/bridge_constructor/bridge_constructor.py	Thu May 15 16:02:16 2014 +0200
+++ b/src/bridge/bridge_constructor/bridge_constructor.py	Thu May 15 16:35:28 2014 +0200
@@ -40,7 +40,6 @@
 
 import sys
 import os
-from os import path
 from optparse import OptionParser
 from ConfigParser import SafeConfigParser as Parser
 from ConfigParser import NoOptionError
@@ -373,7 +372,7 @@
                 'args': self.getArguments(function['sig_in'], name=arg_doc, default=default)}
 
             if function["type"] == "signal":
-                completion['body'] = "pass" if not self.options.debug else 'debug ("%s")' % section
+                completion['body'] = "pass" if not self.options.debug else 'log.debug ("%s")' % section
                 signals_part.append("""\
     @dbus.service.signal(const_INT_PREFIX+const_%(category)s_SUFFIX,
                          signature='%(sig_in)s')
@@ -386,7 +385,7 @@
 """ % completion)
 
             elif function["type"] == "method":
-                completion['debug'] = "" if not self.options.debug else 'debug ("%s")\n%s' % (section, 8 * ' ')
+                completion['debug'] = "" if not self.options.debug else 'log.debug ("%s")\n%s' % (section, 8 * ' ')
                 completion['args_result'] = self.getArguments(function['sig_in'], name=arg_doc, unicode_protect=self.options.unicode)
                 completion['async_comma'] = ', ' if async and function['sig_in'] else ''
                 completion['async_args_def'] = 'callback=None, errback=None' if async else ''
@@ -447,15 +446,15 @@
                 'args': self.getArguments(function['sig_in'], name=arg_doc, default=default)}
 
             if function["type"] == "method":
-                completion['debug'] = "" if not self.options.debug else 'debug ("%s")\n%s' % (section, 8 * ' ')
+                completion['debug'] = "" if not self.options.debug else 'log.debug ("%s")\n%s' % (section, 8 * ' ')
                 completion['args_result'] = self.getArguments(function['sig_in'], name=arg_doc)
-                completion['async_args'] = ', callback=None, errback=None' if async else ''
+                completion['async_args'] = 'callback=None, errback=None' if async else ''
                 completion['async_comma'] = ', ' if async and function['sig_in'] else ''
                 completion['async_args_result'] = 'reply_handler=callback, error_handler=lambda err:errback(err._dbus_error_name[len(const_ERROR_PREFIX)+1:])' 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_args)s):
+    def %(name)s(self, %(args)s%(async_comma)s%(async_args)s):
         %(debug)sreturn %(result)s
 """ % completion)