Mercurial > libervia-backend
comparison src/bridge/DBus.py @ 298:15c8916317d0
dbus bridge: added doc parameter, unmanaged yet
author | Goffi <goffi@goffi.org> |
---|---|
date | Sun, 20 Feb 2011 17:21:03 +0100 |
parents | c25371424090 |
children | 233e6fce0b49 |
comparison
equal
deleted
inserted
replaced
297:c5554e2939dd | 298:15c8916317d0 |
---|---|
330 if opening_count == 0: | 330 if opening_count == 0: |
331 break | 331 break |
332 i+=1 | 332 i+=1 |
333 return attr_string | 333 return attr_string |
334 | 334 |
335 def addMethod(self, name, int_suffix, in_sign, out_sign): | 335 def addMethod(self, name, int_suffix, in_sign, out_sign, doc={}): |
336 """Dynamically add a method to Dbus Bridge""" | 336 """Dynamically add a method to Dbus Bridge""" |
337 #FIXME: Better way ??? | 337 #FIXME: Better way ??? |
338 attributes = self.__attribute_string(in_sign) | 338 attributes = self.__attribute_string(in_sign) |
339 | 339 |
340 code = compile ('def '+name+' (self,'+attributes+'): return self.cb["'+name+'"]('+attributes+')', '<DBus bridge>','exec') | 340 code = compile ('def '+name+' (self,'+attributes+'): return self.cb["'+name+'"]('+attributes+')', '<DBus bridge>','exec') |
344 const_INT_PREFIX+int_suffix, in_signature=in_sign, out_signature=out_sign)(method)) | 344 const_INT_PREFIX+int_suffix, in_signature=in_sign, out_signature=out_sign)(method)) |
345 function = getattr(self, name) | 345 function = getattr(self, name) |
346 func_table = self._dbus_class_table[self.__class__.__module__ + '.' + self.__class__.__name__][function._dbus_interface] | 346 func_table = self._dbus_class_table[self.__class__.__module__ + '.' + self.__class__.__name__][function._dbus_interface] |
347 func_table[function.__name__] = function #Needed for introspection | 347 func_table[function.__name__] = function #Needed for introspection |
348 | 348 |
349 def addSignal(self, name, int_suffix, signature): | 349 def addSignal(self, name, int_suffix, signature, doc={}): |
350 """Dynamically add a signal to Dbus Bridge""" | 350 """Dynamically add a signal to Dbus Bridge""" |
351 #FIXME: Better way ??? | 351 #FIXME: Better way ??? |
352 attributes = self.__attribute_string(signature) | 352 attributes = self.__attribute_string(signature) |
353 | 353 |
354 code = compile ('def '+name+' (self,'+attributes+'): debug ("'+name+' signal")', '<DBus bridge>','exec') | 354 code = compile ('def '+name+' (self,'+attributes+'): debug ("'+name+' signal")', '<DBus bridge>','exec') |
414 | 414 |
415 def register(self, name, callback): | 415 def register(self, name, callback): |
416 debug("registering DBus bridge method [%s]", name) | 416 debug("registering DBus bridge method [%s]", name) |
417 self.dbus_bridge.register(name, callback) | 417 self.dbus_bridge.register(name, callback) |
418 | 418 |
419 def addMethod(self, name, int_suffix, in_sign, out_sign, method): | 419 def addMethod(self, name, int_suffix, in_sign, out_sign, method, doc={}): |
420 """Dynamically add a method to Dbus Bridge""" | 420 """Dynamically add a method to Dbus Bridge""" |
421 print ("Adding method [%s] to DBus bridge" % name) | 421 print ("Adding method [%s] to DBus bridge" % name) |
422 self.dbus_bridge.addMethod(name, int_suffix, in_sign, out_sign) | 422 self.dbus_bridge.addMethod(name, int_suffix, in_sign, out_sign) |
423 self.register(name, method) | 423 self.register(name, method) |
424 | 424 |
425 def addSignal(self, name, int_suffix, signature): | 425 def addSignal(self, name, int_suffix, signature, doc={}): |
426 self.dbus_bridge.addSignal(name, int_suffix, signature) | 426 self.dbus_bridge.addSignal(name, int_suffix, signature) |
427 setattr(DBusBridge, name, getattr(self.dbus_bridge, name)) | 427 setattr(DBusBridge, name, getattr(self.dbus_bridge, name)) |