fixed sequence to floating point conversion in usals parameters
[enigma2.git] / lib / python / Tools / NumericalTextInput.py
index d867d74eb0cff2a97999027b0db1d2f5234e2fe2..744978953ca738efa51c7081f938637eacccdde1 100644 (file)
@@ -2,29 +2,44 @@ from enigma import *
 
 class NumericalTextInput:
     mapping = []
-    mapping.append (('a', 'b', 'c', 'A', 'B', 'C')) # 0
-    mapping.append (('a', 'b', 'c', 'A', 'B', 'C')) # 1
-    mapping.append (('a', 'b', 'c', 'A', 'B', 'C')) # 2
-    mapping.append (('a', 'b', 'c', 'A', 'B', 'C')) # 3
-    mapping.append (('a', 'b', 'c', 'A', 'B', 'C')) # 4
-    mapping.append (('a', 'b', 'c', 'A', 'B', 'C')) # 5
-    mapping.append (('a', 'b', 'c', 'A', 'B', 'C')) # 6
-    mapping.append (('a', 'b', 'c', 'A', 'B', 'C')) # 7
-    mapping.append (('a', 'b', 'c', 'A', 'B', 'C')) # 8
-    mapping.append (('a', 'b', 'c', 'A', 'B', 'C')) # 9
-    
+    mapping.append (".,?'\"0-()@/:_") # 0
+    mapping.append (" 1") # 1
+    mapping.append ("abc2ABC") # 2
+    mapping.append ("def3DEF") # 3
+    mapping.append ("ghi4GHI") # 4
+    mapping.append ("jkl5JKL") # 5
+    mapping.append ("mno6MNO") # 6
+    mapping.append ("pqrs7PQRS") # 7
+    mapping.append ("tuv8TUV") # 8
+    mapping.append ("wxyz9WXYZ") # 9
                                 
-    def __init__(self, nextFunction):
+    def __init__(self, nextFunction = None):
         self.nextFunction = nextFunction
         self.Timer = eTimer()
         self.Timer.timeout.get().append(self.nextChar)
+        self.lastKey = -1
+        self.pos = 0
     
     def getKey(self, num):
+        self.Timer.stop()
         self.Timer.start(1000)
-        return self.mapping[num][0]
+        if (self.lastKey != num):
+            self.lastKey = num
+            self.pos = 0
+        else:
+            self.pos += 1
+            if (len(self.mapping[num]) <= self.pos):
+                self.pos = 0
+        return self.mapping[num][self.pos]
+    
+    def nextKey(self):
+        self.Timer.stop()
+        self.lastKey = -1
     
     def nextChar(self):
         self.Timer.stop()
         print "Timer done"
-        self.nextFunction()
+        self.nextKey()
+        if (self.nextFunction != None):
+               self.nextFunction()
         
\ No newline at end of file