blob: 02c93b1a18146b6e77e99a7fe522b575d9dc58d3 (
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
|
from engine import Engine
import dbus
_DBUS_SERVICE = "org.tutorius.Service"
_DBUS_PATH = "org/tutorius/Service"
_DBUS_SERVICE_IFACE = "org.tutorius.Service"
class Service(dbus.service.Object):
"""
Global tutorius entry point to control the whole system
"""
def __init__(self):
bus = dbus.SessionBus()
bus_name = dbus.service.BusName(_DBUS_SERVICE, bus=bus)
dbus.service.Object.__init__(self, bus_name, _DBUS_PATH)
self._engine = Engine()
def start(self):
""" Start the service itself
"""
# For the moment there is nothing to do
pass
@@dbus.service.method(_DBUS_SERVICE_IFACE,
in_signature="s", out_signature="")
def launch(self, tutorialID):
""" Launch a tutorial
@param tutorialID unique tutorial identifier used to retrieve it from the disk
"""
self._engine.launch(tutorialID)
@@dbus.service.method(_DBUS_SERVICE_IFACE,
in_signature="", out_signature="")
def stop(self):
""" Stop the current tutorial
"""
self._engine.stop()
@@dbus.service.method(_DBUS_SERVICE_IFACE,
in_signature="", out_signature="")
def pause(self):
""" Interrupt the current tutorial and save its state in the journal
"""
self._engine.pause()
|