Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/tutorius/engine.py
diff options
context:
space:
mode:
authorVincent Vinet <vince.vinet@gmail.com>2009-10-13 01:28:23 (GMT)
committer Vincent Vinet <vince.vinet@gmail.com>2009-10-13 01:28:23 (GMT)
commit0928acd3d2d845fd6cd28cd848652aedecae0bdb (patch)
tree2150d79acc486cb95abc7818cdcad9ba866d8869 /tutorius/engine.py
parent53c8fd8df82ba03b4caa84ed4816a80d3c3da0f9 (diff)
run tutorials through the dbus service, currently for calculate only heh
Diffstat (limited to 'tutorius/engine.py')
-rw-r--r--tutorius/engine.py36
1 files changed, 24 insertions, 12 deletions
diff --git a/tutorius/engine.py b/tutorius/engine.py
index 57c08e4..f695de6 100644
--- a/tutorius/engine.py
+++ b/tutorius/engine.py
@@ -1,6 +1,8 @@
+import logging
import dbus.mainloop.glib
-from sugar.tutorius.TProbe import ProbeProxy
-import sugar.tutorius.addon as addon
+from jarabe.model import shell
+
+from sugar.tutorius.bundler import TutorialStore
class Engine:
"""
@@ -10,30 +12,40 @@ class Engine:
def __init__(self):
# FIXME Probe management should be in the probe manager
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
- self._probe = ProbeProxy("org.laptop.Calculate")
- self._bm = None
+ #FIXME shell.get_model() will only be useful in the shell process
+ self._shell = shell.get_model()
+ self._tutorial = None
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"
+ if self._tutorial:
+ self._tutorial.detach()
+ self._tutorial = None
+
+ store = TutorialStore()
+
+ #FIXME Cleanup the handling of 'aliases'
+ activity = self._shell.get_active_activity()
+ self._tutorial = store.load_tutorial(tutorialID, bundle_path=activity.get_bundle_path())
+ self._tutorial.attach("org.laptop.Calculate")
+# if activity in self._activities:
+# self._tutorial.attach(self._activities[activity])
+# else:
+# raise RuntimeError("Current activity alias unknown")
- self._probe.install(self._bm)
def stop(self):
""" Stop the current tutorial
"""
- self._probe.uninstall(self._bm)
+ self._tutorial.detach()
+ self._tutorial = 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)
+ raise NotImplementedError("Unable to store tutorial state")