summaryrefslogtreecommitdiffstats
path: root/python/dbus.py
diff options
context:
space:
mode:
authorJohn (J5) Palmieri <johnp@redhat.com>2005-01-28 19:09:55 +0000
committerJohn (J5) Palmieri <johnp@redhat.com>2005-01-28 19:09:55 +0000
commit216fa619f3470f39e16d229683b3218f85db8309 (patch)
tree62cf6ee28bc09cfbdf39f7be412acc8922286b19 /python/dbus.py
parentcbe79dee56173228640ebd3d32932bdb3a4ee14f (diff)
* python/dbus_bindings.pyx.in: Updated to handle new D-BUS type system
- BUS_ACTIVATION -> BUS_STARTER - DBUS_BUS_ACTIVATION -> DBUS_BUS_STARTER - class MessageIter (__init__): Added recursion checking so we throw a nice error instead of just disconnecting from the bus. (get): Added arg_type parameter for recursion. Removed the nil type Added signiture type placeholder (not implemented) Added struct type placeholder (not implemented) Added varient type placeholder (not implemented) Commented out dict type for now (get_element_type): renamed from get_array_type (get_*): changed to use the dbus_message_iter_get_basic API (get_*_array): removed in favor of recursive get_array method (get_array): new recursive method which calls get to marshal the elements of the array (value_to_dbus_sig): New method returns the corrasponding dbus signiture to a python value (append): Comment out dict handling for now Handle lists with the new recursive API Comment out None handling for now (append_nil): removed (append_*): changed to use dbus_message_iter_append_basic API (append_*_array): removed in favor of recursive append_array method (__str__): Make it easier to print out recursive iterators for debugging - class Message (__str__): moved type inspection to the MessageIter class' __str__ method (get_iter): Added an append parameter wich defaults to False If True use the new API's to create an append iterator * python/dbus.py: Update to use new bindings API - TYPE_ACTIVATION -> TYPE_STARTER - class Bus (_get_match_rule): GetServiceOwner -> GetNameOwner - class ActivationBus -> class StarterBus - class RemoteObject (__call__): get an append iterator - (_dispatch_dbus_method_call): get an append iterator - class Object (emit_signal): get an append iterator * python/examples/: Fixed up the examples to work with the new API
Diffstat (limited to 'python/dbus.py')
-rw-r--r--python/dbus.py24
1 files changed, 11 insertions, 13 deletions
diff --git a/python/dbus.py b/python/dbus.py
index 72919d90..e80b0cef 100644
--- a/python/dbus.py
+++ b/python/dbus.py
@@ -54,13 +54,13 @@ class Bus:
"""A connection to a DBus daemon.
One of three possible standard buses, the SESSION, SYSTEM,
- or ACTIVATION bus
+ or STARTER bus
"""
TYPE_SESSION = dbus_bindings.BUS_SESSION
TYPE_SYSTEM = dbus_bindings.BUS_SYSTEM
- TYPE_ACTIVATION = dbus_bindings.BUS_ACTIVATION
+ TYPE_STARTER = dbus_bindings.BUS_STARTER
- """bus_type=[Bus.TYPE_SESSION | Bus.TYPE_SYSTEM | Bus.TYPE_ACTIVATION]
+ """bus_type=[Bus.TYPE_SESSION | Bus.TYPE_SYSTEM | Bus.TYPE_STARTER]
"""
START_REPLY_SUCCESS = dbus_bindings.DBUS_START_REPLY_SUCCESS
@@ -117,7 +117,7 @@ class Bus:
bus_service = self.get_service("org.freedesktop.DBus")
bus_object = bus_service.get_object('/org/freedesktop/DBus',
'org.freedesktop.DBus')
- service = bus_object.GetServiceOwner(service)
+ service = bus_object.GetNameOwner(service)
match_rule = match_rule + ",sender='%s'" % (service)
if (path):
@@ -158,12 +158,12 @@ class SessionBus(Bus):
def __init__(self):
Bus.__init__(self, Bus.TYPE_SESSION)
-class ActivationBus(Bus):
+class StarterBus(Bus):
"""The bus that activated this process (if
this process was launched by DBus activation)
"""
def __init__(self):
- Bus.__init__(self, Bus.TYPE_ACTIVATION)
+ Bus.__init__(self, Bus.TYPE_STARTER)
class RemoteObject:
@@ -212,7 +212,7 @@ class RemoteMethod:
message.set_destination(self._service_name)
# Add the arguments to the function
- iter = message.get_iter()
+ iter = message.get_iter(True)
for arg in args:
iter.append(arg)
@@ -268,9 +268,9 @@ def _dispatch_dbus_method_call(target_method, argument_list, message):
else:
reply = dbus_bindings.MethodReturn(message)
if retval != None:
- iter = reply.get_iter()
+ iter = reply.get_iter(append=True)
iter.append(retval)
-
+
return reply
def _build_method_dictionary(methods):
@@ -305,7 +305,7 @@ class Object:
def emit_signal(self, interface, signal_name, *args):
message = dbus_bindings.Signal(self._object_path, interface, signal_name)
- iter = message.get_iter()
+ iter = message.get_iter(True)
for arg in args:
iter.append(arg)
@@ -320,10 +320,8 @@ class Object:
args = message.get_args_list()
reply = _dispatch_dbus_method_call(target_method, args, message)
-
- self._connection.send(reply)
-
+ self._connection.send(reply)
class ObjectTree:
"""An object tree allows you to register a handler for a tree of object paths.