Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/tutorius/dbustools.py
diff options
context:
space:
mode:
authorerick <erick@sugar-dev-erick.(none)>2009-11-16 04:13:18 (GMT)
committer erick <erick@sugar-dev-erick.(none)>2009-11-16 04:13:18 (GMT)
commit69e3f4598a8b1a4e3d20edcae524b05a8cc7f330 (patch)
tree1b2055927b46b92148e24559f42a87fb81eec090 /tutorius/dbustools.py
parent857aff7e1c1694a819c0dbc9b9103ef2206699e6 (diff)
Added a first implementation of a Future in dbustools, using the gtk mainloop for synchronisation
Diffstat (limited to 'tutorius/dbustools.py')
-rw-r--r--tutorius/dbustools.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/tutorius/dbustools.py b/tutorius/dbustools.py
index 5d70d7b..02acd3d 100644
--- a/tutorius/dbustools.py
+++ b/tutorius/dbustools.py
@@ -1,4 +1,6 @@
import logging
+import gobject
+
LOGGER = logging.getLogger("sugar.tutorius.dbustools")
def save_args(callable, *xargs, **xkwargs):
@@ -40,3 +42,16 @@ def remote_call(callable, args, return_cb=None, error_cb=None, block=False):
else:
callable(*args, reply_handler=reply_cb, error_handler=errhandler_cb)
+class Future(object):
+ def __init__(self):
+ self._value = None
+
+ def get(self):
+ context = gobject.MainLoop().get_context()
+ while self._value == None and context.iteration(True):
+ pass
+ return self._value
+
+ def _set(self, value):
+ self._value = value
+