Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorerick <erick@sugar-dev-erick.(none)>2009-10-01 22:18:11 (GMT)
committer erick <erick@sugar-dev-erick.(none)>2009-10-01 22:18:11 (GMT)
commit53c8fd8df82ba03b4caa84ed4816a80d3c3da0f9 (patch)
treec9d7478e36cf2ff7d94c2306456cccf37569fbab
parent71bdb113e5c105709963f6159b9c1facb4cff0b3 (diff)
Fixed small bugs preventing the service and engine from being used
-rw-r--r--tutorius/engine.py5
-rw-r--r--tutorius/service.py16
2 files changed, 17 insertions, 4 deletions
diff --git a/tutorius/engine.py b/tutorius/engine.py
index 192bdde..57c08e4 100644
--- a/tutorius/engine.py
+++ b/tutorius/engine.py
@@ -9,15 +9,16 @@ class Engine:
def __init__(self):
# FIXME Probe management should be in the probe manager
- dbus.mainloop.DBusGMainLoop(set_as_default=True)
+ dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
self._probe = ProbeProxy("org.laptop.Calculate")
+ self._bm = None
def launch(self, tutorialID):
""" Launch a tutorial
@param tutorialID unique tutorial identifier used to retrieve it from the disk
"""
- if self._bm = None:
+ if self._bm == None:
self._bm = addon.create("BubbleMessage")
self._bm.position = (300,300)
self._bm.message = "Tutorial Started"
diff --git a/tutorius/service.py b/tutorius/service.py
index 1393269..61c6526 100644
--- a/tutorius/service.py
+++ b/tutorius/service.py
@@ -2,7 +2,7 @@ from engine import Engine
import dbus
_DBUS_SERVICE = "org.tutorius.Service"
-_DBUS_PATH = "org/tutorius/Service"
+_DBUS_PATH = "/org/tutorius/Service"
_DBUS_SERVICE_IFACE = "org.tutorius.Service"
class Service(dbus.service.Object):
@@ -15,7 +15,7 @@ class Service(dbus.service.Object):
bus_name = dbus.service.BusName(_DBUS_SERVICE, bus=bus)
dbus.service.Object.__init__(self, bus_name, _DBUS_PATH)
- self._engine = Engine()
+ self._engine = None
def start(self):
""" Start the service itself
@@ -30,6 +30,8 @@ class Service(dbus.service.Object):
""" Launch a tutorial
@param tutorialID unique tutorial identifier used to retrieve it from the disk
"""
+ if self._engine == None:
+ self._engine = Engine()
self._engine.launch(tutorialID)
@dbus.service.method(_DBUS_SERVICE_IFACE,
@@ -62,3 +64,13 @@ class ServiceProxy:
def pause(self):
self._service.pause()
+
+if __name__ == "__main__":
+ import dbus.mainloop.glib
+ import gobject
+
+ loop = gobject.MainLoop()
+ dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
+ s = Service()
+ loop.run()
+