activityfactory: Cope with dbus-python 0.82.2's fix to non-default timeouts. In 0.82.1 async call timeouts were wrongly in milliseconds, in >= 0.82.2 they are correctly in seconds. Synchronous timeouts have always been in seconds.
This patch can be simplified once dbus-python gets into builds (#3903).
This commit is contained in:
parent
e543eada4e
commit
d60cc6ae39
@ -29,6 +29,13 @@ from sugar import util
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
# #3903 - this constant can be removed and assumed to be 1 when dbus-python
|
||||||
|
# 0.82.3 is the only version used
|
||||||
|
if dbus.version >= (0, 82, 3):
|
||||||
|
DBUS_PYTHON_TIMEOUT_UNITS_PER_SECOND = 1
|
||||||
|
else:
|
||||||
|
DBUS_PYTHON_TIMEOUT_UNITS_PER_SECOND = 1000
|
||||||
|
|
||||||
_SHELL_SERVICE = "org.laptop.Shell"
|
_SHELL_SERVICE = "org.laptop.Shell"
|
||||||
_SHELL_PATH = "/org/laptop/Shell"
|
_SHELL_PATH = "/org/laptop/Shell"
|
||||||
_SHELL_IFACE = "org.laptop.Shell"
|
_SHELL_IFACE = "org.laptop.Shell"
|
||||||
@ -143,7 +150,7 @@ class ActivityCreationHandler(gobject.GObject):
|
|||||||
if not os.path.exists('/etc/olpc-security'):
|
if not os.path.exists('/etc/olpc-security'):
|
||||||
handle = self._handle.get_dict()
|
handle = self._handle.get_dict()
|
||||||
self._factory.create(dbus.Dictionary(handle, signature='ss'),
|
self._factory.create(dbus.Dictionary(handle, signature='ss'),
|
||||||
timeout=120 * 1000,
|
timeout=120 * DBUS_PYTHON_TIMEOUT_UNITS_PER_SECOND,
|
||||||
reply_handler=self._no_reply_handler,
|
reply_handler=self._no_reply_handler,
|
||||||
error_handler=self._create_error_handler)
|
error_handler=self._create_error_handler)
|
||||||
else:
|
else:
|
||||||
@ -153,7 +160,7 @@ class ActivityCreationHandler(gobject.GObject):
|
|||||||
factory.CreateActivity(
|
factory.CreateActivity(
|
||||||
self._service_name,
|
self._service_name,
|
||||||
self._handle.get_dict(),
|
self._handle.get_dict(),
|
||||||
timeout=120 * 1000,
|
timeout=120 * DBUS_PYTHON_TIMEOUT_UNITS_PER_SECOND,
|
||||||
reply_handler=self._create_reply_handler,
|
reply_handler=self._create_reply_handler,
|
||||||
error_handler=self._create_error_handler,
|
error_handler=self._create_error_handler,
|
||||||
dbus_interface=_RAINBOW_ACTIVITY_FACTORY_INTERFACE)
|
dbus_interface=_RAINBOW_ACTIVITY_FACTORY_INTERFACE)
|
||||||
|
Loading…
Reference in New Issue
Block a user