blob: f695de6ca2d7747013d08079e4a5f12c4339bbd7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
import logging
import dbus.mainloop.glib
from jarabe.model import shell
from sugar.tutorius.bundler import TutorialStore
class Engine:
"""
Driver for the execution of tutorials
"""
def __init__(self):
# FIXME Probe management should be in the probe manager
dbus.mainloop.glib.DBusGMainLoop(set_as_default=True)
#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._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")
def stop(self):
""" Stop the current tutorial
"""
self._tutorial.detach()
self._tutorial = None
def pause(self):
""" Interrupt the current tutorial and save its state in the journal
"""
raise NotImplementedError("Unable to store tutorial state")
|