summaryrefslogtreecommitdiffstats
path: root/python/proxies.py
diff options
context:
space:
mode:
authorJohn (J5) Palmieri <johnp@redhat.com>2005-10-18 04:38:05 +0000
committerJohn (J5) Palmieri <johnp@redhat.com>2005-10-18 04:38:05 +0000
commit2b9417707a6cac377e2caca047fde8169236d93e (patch)
tree9f7b49dd959a7502fc33a620f61a32f8c156c2dd /python/proxies.py
parent0ae9f138ad4dfacbbd28abd39ce3dee66333539a (diff)
* glib/dbus-gvalue-utils.c (hash_free_from_gtype): handle gdouble
and G_TYPE_VALUE_ARRAY (DBUS_TYPE_STRUCT) (gvalue_from_hash_value, hash_value_from_gvalue): handle gdouble * glib/dbus-gvalue.c (dbus_gvalue_to_signature): add missing DBUS_STRUCT_BEGIN_CHAR and DBUS_STRUCT_END_CHAR charaters when constructing struct signatures * python/_dbus.py (Bus): handle private connections using the private keyword in the constructor. defaults to private=False (Bus::close): new method to close a connection to the bus * python/dbus_bindings.pyx (Connection::close): renamed method was previously called disconnect (bus_get): now supports getting a private connection * python/proxies.py (ProxyMethod::__call__): check if ignore_reply keyword is set to True. if it is, execute the method without waiting for a reply (ProxyObject::_introspect_execute_queue): new method for executing all the pending methods that were waiting for the introspect to finish. this is called when introspect either succeeds or fails (ProxyObject::_introspect_error_handler): call queued methods
Diffstat (limited to 'python/proxies.py')
-rw-r--r--python/proxies.py44
1 files changed, 25 insertions, 19 deletions
diff --git a/python/proxies.py b/python/proxies.py
index ee2a3f7e..efa2b501 100644
--- a/python/proxies.py
+++ b/python/proxies.py
@@ -46,6 +46,10 @@ class ProxyMethod:
if keywords.has_key('error_handler'):
error_handler = keywords['error_handler']
+ ignore_reply = False
+ if keywords.has_key('ignore_reply'):
+ ignore_reply = keywords['ignore_reply']
+
if not(reply_handler and error_handler):
if reply_handler:
raise MissingErrorHandlerException()
@@ -65,8 +69,11 @@ class ProxyMethod:
iter.append_strict(arg, sig)
else:
iter.append(arg)
-
- if reply_handler:
+
+ if ignore_reply:
+ result = self._connection.send(message)
+ args_tuple = (result,)
+ elif reply_handler:
result = self._connection.send_with_reply_handlers(message, timeout, reply_handler, error_handler)
args_tuple = result
else:
@@ -94,8 +101,6 @@ class ProxyObject:
INTROSPECT_STATE_INTROSPECT_IN_PROGRESS = 1
INTROSPECT_STATE_INTROSPECT_DONE = 2
- #TODO: default introspect to False right now because it is not done yet
- # make sure to default to True later
def __init__(self, bus, named_service, object_path, introspect=True):
self._bus = bus
self._named_service = named_service
@@ -132,20 +137,8 @@ class ProxyObject:
self._introspect_reply_handler,
self._introspect_error_handler)
return result
-
-
-
- def _introspect_reply_handler(self, data):
- try:
- self._introspect_method_map = introspect_parser.process_introspection_data(data)
- except IntrospectionParserException, e:
- self._introspect_error_handler(e)
- return
-
- self._introspect_state = self.INTROSPECT_STATE_INTROSPECT_DONE
-
- #TODO: we should actually call these even if introspection fails
+ def _introspect_execute_queue(self):
for call in self._pending_introspect_queue:
(member, iface, args, keywords) = call
@@ -162,14 +155,27 @@ class ProxyObject:
call_object = self.ProxyMethodClass(self._bus.get_connection(),
self._named_service,
- self._object_path, iface, member,
+ self._object_path,
+ iface,
+ member,
introspect_sig)
call_object(args, keywords)
+ def _introspect_reply_handler(self, data):
+ try:
+ self._introspect_method_map = introspect_parser.process_introspection_data(data)
+ except IntrospectionParserException, e:
+ self._introspect_error_handler(e)
+ return
+
+ self._introspect_state = self.INTROSPECT_STATE_INTROSPECT_DONE
+ #self._introspect_execute_queue()
+
def _introspect_error_handler(self, error):
self._introspect_state = self.INTROSPECT_STATE_DONT_INTROSPECT
- sys.stderr.write(str(error))
+ self._introspect_execute_queue()
+ sys.stderr.write("Introspect error: " + str(error) + "\n")
def __getattr__(self, member, **keywords):
if member == '__call__':