dbus/python _dbus.py,1.2,1.3 proxies.py,1.3,1.4

John Palmieri johnp at freedesktop.org
Mon May 16 14:27:06 PDT 2005


Update of /cvs/dbus/dbus/python
In directory gabe:/tmp/cvs-serv4895/python

Modified Files:
	_dbus.py proxies.py 
Log Message:
* glib/dbus-gmain.c (io_handler_dispatch): fix deadlock
  when using recursive g_main_loops

* python/_dbus.py (class Bus): add the ProxyObjectClass
  alias for ProxyObject to make it easier for the Twisted
  networking framework to integrate dbus.

* python/proxies.py (class ProxyObject): add the ProxyMethodClass
  alias for ProxyMethod to make it easier for the Twisted
  networking framework to integrate dbus.



Index: _dbus.py
===================================================================
RCS file: /cvs/dbus/dbus/python/_dbus.py,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- _dbus.py	5 May 2005 18:01:45 -0000	1.2
+++ _dbus.py	16 May 2005 21:27:04 -0000	1.3
@@ -70,6 +70,8 @@
     """bus_type=[Bus.TYPE_SESSION | Bus.TYPE_SYSTEM | Bus.TYPE_STARTER]
     """
 
+    ProxyObjectClass = ProxyObject
+
     START_REPLY_SUCCESS = dbus_bindings.DBUS_START_REPLY_SUCCESS
     START_REPLY_ALREADY_RUNNING = dbus_bindings.DBUS_START_REPLY_ALREADY_RUNNING 
 
@@ -106,7 +108,7 @@
 
     def get_object(self, named_service, object_path):
         """Get a proxy object to call over the bus"""
-        return ProxyObject(self, named_service, object_path)
+        return self.ProxyObjectClass(self, named_service, object_path)
 
     def add_signal_receiver(self, handler_function, signal_name=None, dbus_interface=None, named_service=None, path=None):
         match_rule = self._get_match_rule(signal_name, dbus_interface, named_service, path)

Index: proxies.py
===================================================================
RCS file: /cvs/dbus/dbus/python/proxies.py,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- proxies.py	5 May 2005 18:27:34 -0000	1.3
+++ proxies.py	16 May 2005 21:27:04 -0000	1.4
@@ -1,45 +1,5 @@
 import dbus_bindings
 
-class ProxyObject:
-    """A proxy to the remote Object.
-
-    A ProxyObject is provided by the Bus. ProxyObjects
-    have member functions, and can be called like normal Python objects.
-    """
-    def __init__(self, bus, named_service, object_path):
-        self._bus          = bus
-        self._named_service = named_service
-        self._object_path  = object_path
-
-    def connect_to_signal(self, signal_name, handler_function, dbus_interface=None):
-        self._bus.add_signal_receiver(handler_function,
-                                      signal_name=signal_name,
-                                      dbus_interface=dbus_interface,
-                                      named_service=self._named_service,
-                                      path=self._object_path)
-
-
-
-    def __getattr__(self, member, **keywords):
-        if member == '__call__':
-            return object.__call__
-        elif member.startswith('__') and member.endswith('__'):
-            raise AttributeError(member)
-        else:
-            iface = None
-            if (keywords.has_key('dbus_interface')):
-                iface = keywords['dbus_interface']
-
-            return ProxyMethod(self._bus.get_connection(),
-                                self._named_service,
-                                self._object_path, iface, member)
-
-    def __repr__(self):
-        return '<ProxyObject wrapping %s %s %s at %x>'%( 
-            self._bus, self._named_service, self._object_path , id(self))
-    __str__ = __repr__
-
-
 class ProxyMethod:
     """A proxy Method.
 
@@ -95,3 +55,45 @@
         else:
             return args_tuple
 
+
+class ProxyObject:
+    """A proxy to the remote Object.
+
+    A ProxyObject is provided by the Bus. ProxyObjects
+    have member functions, and can be called like normal Python objects.
+    """
+    ProxyMethodClass = ProxyMethod
+
+    def __init__(self, bus, named_service, object_path):
+        self._bus          = bus
+        self._named_service = named_service
+        self._object_path  = object_path
+
+    def connect_to_signal(self, signal_name, handler_function, dbus_interface=None):
+        self._bus.add_signal_receiver(handler_function,
+                                      signal_name=signal_name,
+                                      dbus_interface=dbus_interface,
+                                      named_service=self._named_service,
+                                      path=self._object_path)
+
+
+
+    def __getattr__(self, member, **keywords):
+        if member == '__call__':
+            return object.__call__
+        elif member.startswith('__') and member.endswith('__'):
+            raise AttributeError(member)
+        else:
+            iface = None
+            if (keywords.has_key('dbus_interface')):
+                iface = keywords['dbus_interface']
+
+            return self.ProxyMethodClass(self._bus.get_connection(),
+                                self._named_service,
+                                self._object_path, iface, member)
+
+    def __repr__(self):
+        return '<ProxyObject wrapping %s %s %s at %x>'%( 
+            self._bus, self._named_service, self._object_path , id(self))
+    __str__ = __repr__
+



More information about the dbus-commit mailing list