From 8883669cc67299a3c80da36fbe02ad63d2fc6d1f Mon Sep 17 00:00:00 2001 From: erick Date: Thu, 01 Oct 2009 21:06:33 +0000 Subject: Initial version of the Engine and the Service --- (limited to 'tutorius/engine.py') diff --git a/tutorius/engine.py b/tutorius/engine.py new file mode 100644 index 0000000..396a9e1 --- /dev/null +++ b/tutorius/engine.py @@ -0,0 +1,40 @@ +import dbus.mainloop.glib +from sugar.tutorius.TProbe import ProbeProxy +import sugar.tutorius.addon as addon + +class Engine: + """ + Driver for the execution of tutorials + """ + + def __init__(self): + # FIXME Probe management should be in the probe manager + dbus.mainloop.DBusGMainLoop(set_as_default=True) + self._probe = ProbeProxy("org.laptop.Calculate") + + + def launch(self, tutorialID): + """ Launch a tutorial + @param tutorialID unique tutorial identifier used to retrieve it from the disk + """ + if self._bm = None: + self._bm = addon.create("BubbleMessage") + + self._bm.position = (300,300) + self._bm.message = "Tutorial Started" + + self._probe.install(self._bm) + + + def stop(self): + """ Stop the current tutorial + """ + self._probe.uninstall(self._bm) + self._bm = None + + def pause(self): + """ Interrupt the current tutorial and save its state in the journal + """ + self._bm.message = "Tutorial State would be saved" + self._probe.update(self._bm) + -- cgit v0.9.1