1 # -*- coding: utf-8 -*-
2 from enigma import eTimer
3 from Components.Language import language
5 class NumericalTextInput:
6 def __init__(self, nextFunc=None, handleTimeout = True, search = False):
8 self.lang = language.getLanguage()
10 self.nextFunction=nextFunc
14 self.timer.callback.append(self.timeout)
21 self.mapping.append (u"%_0") # 0
22 self.mapping.append (u" 1") # 1
23 self.mapping.append (u"abc2") # 2
24 self.mapping.append (u"def3") # 3
25 self.mapping.append (u"ghi4") # 4
26 self.mapping.append (u"jkl5") # 5
27 self.mapping.append (u"mno6") # 6
28 self.mapping.append (u"pqrs7") # 7
29 self.mapping.append (u"tuv8") # 8
30 self.mapping.append (u"wxyz9") # 9
33 if self.lang == 'de_DE':
34 self.mapping.append (u"0,?!&@=*'+\"()$~") # 0
35 self.mapping.append (u" 1.:/-_") # 1
36 self.mapping.append (u"abcä2ABCÄ") # 2
37 self.mapping.append (u"def3DEF") # 3
38 self.mapping.append (u"ghi4GHI") # 4
39 self.mapping.append (u"jkl5JKL") # 5
40 self.mapping.append (u"mnoö6MNOÖ") # 6
41 self.mapping.append (u"pqrsß7PQRSß") # 7
42 self.mapping.append (u"tuvü8TUVÜ") # 8
43 self.mapping.append (u"wxyz9WXYZ") # 9
44 elif self.lang == 'es_ES':
45 self.mapping.append (u"0,?!&@=*'+\"()$~") # 0
46 self.mapping.append (u" 1.:/-_") # 1
47 self.mapping.append (u"abcáà2ABCÁÀ") # 2
48 self.mapping.append (u"deéèf3DEFÉÈ") # 3
49 self.mapping.append (u"ghiíì4GHIÍÌ") # 4
50 self.mapping.append (u"jkl5JKL") # 5
51 self.mapping.append (u"mnñoóò6MNÑOÓÒ") # 6
52 self.mapping.append (u"pqrs7PQRS") # 7
53 self.mapping.append (u"tuvúù8TUVÚÙ") # 8
54 self.mapping.append (u"wxyz9WXYZ") # 9
55 if self.lang in ('sv_SE', 'fi_FI'):
56 self.mapping.append (u"0,?!&@=*'+\"()$~") # 0
57 self.mapping.append (u" 1.:/-_") # 1
58 self.mapping.append (u"abcåä2ABCÅÄ") # 2
59 self.mapping.append (u"defé3DEFÉ") # 3
60 self.mapping.append (u"ghi4GHI") # 4
61 self.mapping.append (u"jkl5JKL") # 5
62 self.mapping.append (u"mnoö6MNOÖ") # 6
63 self.mapping.append (u"pqrs7PQRS") # 7
64 self.mapping.append (u"tuv8TUV") # 8
65 self.mapping.append (u"wxyz9WXYZ") # 9
67 self.mapping.append (u"0,?!&@=*'+\"()$~") # 0
68 self.mapping.append (u" 1.:/-_") # 1
69 self.mapping.append (u"abc2ABC") # 2
70 self.mapping.append (u"def3DEF") # 3
71 self.mapping.append (u"ghi4GHI") # 4
72 self.mapping.append (u"jkl5JKL") # 5
73 self.mapping.append (u"mno6MNO") # 6
74 self.mapping.append (u"pqrs7PQRS") # 7
75 self.mapping.append (u"tuv8TUV") # 8
76 self.mapping.append (u"wxyz9WXYZ") # 9
78 def setUseableChars(self, useable):
79 self.useableChars = useable
81 def getKey(self, num):
83 if self.lastKey != num:
84 if self.lastKey != -1:
88 if self.timer is not None:
89 self.timer.start(1000, True)
92 if len(self.mapping[num]) <= self.pos:
95 pos = self.useableChars.find(self.mapping[num][self.pos])
98 if cnt < len(self.mapping[num]):
103 return self.mapping[num][self.pos]
106 if self.timer is not None:
112 if self.nextFunction:
116 if self.lastKey != -1: