diff options
| author | Andreas Monzner <andreas.monzner@multimedia-labs.de> | 2006-08-24 12:16:56 +0000 |
|---|---|---|
| committer | Andreas Monzner <andreas.monzner@multimedia-labs.de> | 2006-08-24 12:16:56 +0000 |
| commit | 65e19746f08f1287005861692322cdf868b06dc6 (patch) | |
| tree | 67674e5b2a111f7674f80b3957e10358b914b5d5 /lib/python/Tools/NumericalTextInput.py | |
| parent | e09309bd7f69dbc98f471e28e01e2ad21ab7a757 (diff) | |
| download | enigma2-65e19746f08f1287005861692322cdf868b06dc6.tar.gz enigma2-65e19746f08f1287005861692322cdf868b06dc6.zip | |
some NumericalInput and uncode/utf-8 fixes
Diffstat (limited to 'lib/python/Tools/NumericalTextInput.py')
| -rw-r--r-- | lib/python/Tools/NumericalTextInput.py | 36 |
1 files changed, 23 insertions, 13 deletions
diff --git a/lib/python/Tools/NumericalTextInput.py b/lib/python/Tools/NumericalTextInput.py index 1acd2548..87ac5486 100644 --- a/lib/python/Tools/NumericalTextInput.py +++ b/lib/python/Tools/NumericalTextInput.py @@ -3,9 +3,11 @@ from enigma import * from Components.Language import language class NumericalTextInput: - def __init__(self, nextFunction = None): + def __init__(self, nextFunc=None): self.mapping = [] self.lang = language.getLanguage() + self.useableChars=None + self.nextFunction=nextFunc if self.lang == 'de_DE': self.mapping.append (u".,?'\"0-()@/:_") # 0 @@ -40,22 +42,34 @@ class NumericalTextInput: self.mapping.append (u"pqrs7PQRS") # 7 self.mapping.append (u"tuv8TUV") # 8 self.mapping.append (u"wxyz9WXYZ") # 9 - - self.nextFunction = nextFunction + self.Timer = eTimer() self.Timer.timeout.get().append(self.nextChar) self.lastKey = -1 - self.pos = 0 + self.pos = -1 + + def setUseableChars(self, useable): + self.useableChars = useable def getKey(self, num): + cnt=0 self.Timer.start(1000, True) if (self.lastKey != num): self.lastKey = num - self.pos = 0 - else: + self.pos = -1 + while(True): self.pos += 1 if (len(self.mapping[num]) <= self.pos): self.pos = 0 + if self.useableChars: + pos = self.useableChars.find(self.mapping[num][self.pos]) + if pos == -1: + cnt += 1 + if cnt < len(self.mapping[num]): + continue + else: + return None + break return self.mapping[num][self.pos] def nextKey(self): @@ -63,10 +77,6 @@ class NumericalTextInput: self.lastKey = -1 def nextChar(self): - print "Timer done" - try: - self.nextKey() - if (self.nextFunction != None): - self.nextFunction() - except AttributeError: - print "Text Input object deleted with running nextChar timer?" + self.nextKey() + if self.nextFunction: + self.nextFunction() |
