changeset 284:c25371424090

dbus bridge: fixed introspection for dynamically added methods and signals
author Goffi <goffi@goffi.org>
date Fri, 04 Feb 2011 00:13:41 +0100
parents 68cd30d982a5
children 6422fcdd831c
files src/bridge/DBus.py src/bridge/bridge_constructor/dbus_core_template.py
diffstat 2 files changed, 12 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/src/bridge/DBus.py	Thu Feb 03 18:06:25 2011 +0100
+++ b/src/bridge/DBus.py	Fri Feb 04 00:13:41 2011 +0100
@@ -342,6 +342,9 @@
         method = locals()[name]
         setattr(DbusObject, name, dbus.service.method(
             const_INT_PREFIX+int_suffix, in_signature=in_sign, out_signature=out_sign)(method))
+        function = getattr(self, name)
+        func_table = self._dbus_class_table[self.__class__.__module__ + '.' + self.__class__.__name__][function._dbus_interface]
+        func_table[function.__name__] = function #Needed for introspection
     
     def addSignal(self, name, int_suffix, signature):
         """Dynamically add a signal to Dbus Bridge"""
@@ -353,6 +356,9 @@
         signal = locals()[name]
         setattr(DbusObject, name, dbus.service.signal(
             const_INT_PREFIX+int_suffix, signature=signature)(signal))
+        function = getattr(self, name)
+        func_table = self._dbus_class_table[self.__class__.__module__ + '.' + self.__class__.__name__][function._dbus_interface]
+        func_table[function.__name__] = function #Needed for introspection
 
 class DBusBridge(Bridge):
     def __init__(self):
--- a/src/bridge/bridge_constructor/dbus_core_template.py	Thu Feb 03 18:06:25 2011 +0100
+++ b/src/bridge/bridge_constructor/dbus_core_template.py	Fri Feb 04 00:13:41 2011 +0100
@@ -94,6 +94,9 @@
         method = locals()[name]
         setattr(DbusObject, name, dbus.service.method(
             const_INT_PREFIX+int_suffix, in_signature=in_sign, out_signature=out_sign)(method))
+        function = getattr(self, name)
+        func_table = self._dbus_class_table[self.__class__.__module__ + '.' + self.__class__.__name__][function._dbus_interface]
+        func_table[function.__name__] = function #Needed for introspection
     
     def addSignal(self, name, int_suffix, signature):
         """Dynamically add a signal to Dbus Bridge"""
@@ -105,6 +108,9 @@
         signal = locals()[name]
         setattr(DbusObject, name, dbus.service.signal(
             const_INT_PREFIX+int_suffix, signature=signature)(signal))
+        function = getattr(self, name)
+        func_table = self._dbus_class_table[self.__class__.__module__ + '.' + self.__class__.__name__][function._dbus_interface]
+        func_table[function.__name__] = function #Needed for introspection
 
 class DBusBridge(Bridge):
     def __init__(self):