fix movieplayer
[enigma2.git] / lib / python / Tools / NumericalTextInput.py
1 from enigma import *
2
3 class NumericalTextInput:
4     mapping = []
5     mapping.append (".,?'\"0-()@/:_") # 0
6     mapping.append (" 1") # 1
7     mapping.append ("abc2ABC") # 2
8     mapping.append ("def3DEF") # 3
9     mapping.append ("ghi4GHI") # 4
10     mapping.append ("jkl5JKL") # 5
11     mapping.append ("mno6MNO") # 6
12     mapping.append ("pqrs7PQRS") # 7
13     mapping.append ("tuv8TUV") # 8
14     mapping.append ("wxyz9WXYZ") # 9
15                                 
16     def __init__(self, nextFunction = None):
17         self.nextFunction = nextFunction
18         self.Timer = eTimer()
19         self.Timer.timeout.get().append(self.nextChar)
20         self.lastKey = -1
21         self.pos = 0
22     
23     def getKey(self, num):
24         self.Timer.stop()
25         self.Timer.start(1000)
26         if (self.lastKey != num):
27             self.lastKey = num
28             self.pos = 0
29         else:
30             self.pos += 1
31             if (len(self.mapping[num]) <= self.pos):
32                 self.pos = 0
33         return self.mapping[num][self.pos]
34     
35     def nextKey(self):
36         self.Timer.stop()
37         self.lastKey = -1
38     
39     def nextChar(self):
40         self.Timer.stop()
41         print "Timer done"
42         self.nextKey()
43         if (self.nextFunction != None):
44                 self.nextFunction()
45