-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathshow_tablet.py
58 lines (43 loc) · 1.37 KB
/
show_tablet.py
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
52
53
54
55
56
57
58
class MyClass(GeneratedClass):
def __init__(self):
GeneratedClass.__init__(self)
def onLoad(self):
#put initialization code here
pass
def onUnload(self):
#put clean-up code here
pass
def onInput_onStart(self, keyword):
# show the new question
self.showQuestion(keyword)
self.output_matricola(keyword)
# move
self.onStopped()
def onInput_onStop(self):
self.onUnload()
self.onStopped()
def _getTabletService(self):
tabletService = None
try:
tabletService = self.session().service("ALTabletService")
except Exception as e:
self.logger.error(e)
return tabletService
def _getMemoryService(self):
service = None
try:
service = self.session().service("ALMemory")
except Exception as e:
self.logger.error(e)
return service
def showQuestion(self, p):
self._getMemoryService().insertData('keyword', p)
tabService = self._getTabletService()
ip = tabService.robotIp()
uid = self.packageUid()
url = 'http://' + ip + '/apps/' + uid + '/index.html'
tabService.loadUrl(url)
tabService.showWebview()
def hideQuestion(self):
tabService = self._getTabletService()
tabService.hideWebview()