projects
/
vuplus_dvbapp
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Merge branch 'obi/master-20110412' into experimental
[vuplus_dvbapp]
/
lib
/
python
/
Screens
/
InputBox.py
diff --git
a/lib/python/Screens/InputBox.py
b/lib/python/Screens/InputBox.py
index
bb8b63d
..
7dd7b12
100644
(file)
--- a/
lib/python/Screens/InputBox.py
+++ b/
lib/python/Screens/InputBox.py
@@
-1,22
+1,21
@@
-from enigma import
*
+from enigma import
eRCInput, getPrevAsciiCode
from Screens.Screen import Screen
from Screens.MessageBox import MessageBox
from Components.ActionMap import NumberActionMap
from Components.Label import Label
from Components.Input import Input
from Screens.Screen import Screen
from Screens.MessageBox import MessageBox
from Components.ActionMap import NumberActionMap
from Components.Label import Label
from Components.Input import Input
-from Components.GUIComponent import *
from Tools.BoundFunction import boundFunction
from time import time
from Tools.BoundFunction import boundFunction
from time import time
-import os
-
class InputBox(Screen):
class InputBox(Screen):
- def __init__(self, session, title = "", windowTitle = _("Input"), **kwargs):
+ def __init__(self, session, title = "", windowTitle = _("Input"),
useableChars = None,
**kwargs):
Screen.__init__(self, session)
self["text"] = Label(title)
self["input"] = Input(**kwargs)
self.onShown.append(boundFunction(self.setTitle, windowTitle))
Screen.__init__(self, session)
self["text"] = Label(title)
self["input"] = Input(**kwargs)
self.onShown.append(boundFunction(self.setTitle, windowTitle))
+ if useableChars is not None:
+ self["input"].setUseableChars(useableChars)
self["actions"] = NumberActionMap(["WizardActions", "InputBoxActions", "InputAsciiActions", "KeyboardInputActions"],
{
self["actions"] = NumberActionMap(["WizardActions", "InputBoxActions", "InputAsciiActions", "KeyboardInputActions"],
{
@@
-25,16
+24,12
@@
class InputBox(Screen):
"back": self.cancel,
"left": self.keyLeft,
"right": self.keyRight,
"back": self.cancel,
"left": self.keyLeft,
"right": self.keyRight,
- "delete": self.keyDelete,
- "moveLeft": self.keyLeft,
- "moveRight": self.keyRight,
- "moveHome": self.keyHome,
- "moveEnd": self.keyEnd,
+ "home": self.keyHome,
+ "end": self.keyEnd,
"deleteForward": self.keyDelete,
"deleteBackward": self.keyBackspace,
"tab": self.keyTab,
"toggleOverwrite": self.keyInsert,
"deleteForward": self.keyDelete,
"deleteBackward": self.keyBackspace,
"tab": self.keyTab,
"toggleOverwrite": self.keyInsert,
- "accept": self.go,
"1": self.keyNumberGlobal,
"2": self.keyNumberGlobal,
"3": self.keyNumberGlobal,
"1": self.keyNumberGlobal,
"2": self.keyNumberGlobal,
"3": self.keyNumberGlobal,
@@
-46,8
+41,11
@@
class InputBox(Screen):
"9": self.keyNumberGlobal,
"0": self.keyNumberGlobal
}, -1)
"9": self.keyNumberGlobal,
"0": self.keyNumberGlobal
}, -1)
- rcinput = eRCInput.getInstance()
- rcinput.setKeyboardMode(rcinput.kmAscii)
+
+ if self["input"].type == Input.TEXT:
+ self.onExecBegin.append(self.setKeyboardModeAscii)
+ else:
+ self.onExecBegin.append(self.setKeyboardModeNone)
def gotAsciiCode(self):
self["input"].handleAscii(getPrevAsciiCode())
def gotAsciiCode(self):
self["input"].handleAscii(getPrevAsciiCode())
@@
-65,13
+63,9
@@
class InputBox(Screen):
self["input"].delete()
def go(self):
self["input"].delete()
def go(self):
- rcinput = eRCInput.getInstance()
- rcinput.setKeyboardMode(rcinput.kmNone)
self.close(self["input"].getText())
def cancel(self):
self.close(self["input"].getText())
def cancel(self):
- rcinput = eRCInput.getInstance()
- rcinput.setKeyboardMode(rcinput.kmNone)
self.close(None)
def keyHome(self):
self.close(None)
def keyHome(self):
@@
-91,7
+85,7
@@
class InputBox(Screen):
class PinInput(InputBox):
def __init__(self, session, service = "", triesEntry = None, pinList = [], *args, **kwargs):
class PinInput(InputBox):
def __init__(self, session, service = "", triesEntry = None, pinList = [], *args, **kwargs):
- InputBox.__init__(self, session = session, text="
9876
", maxSize=True, type=Input.PIN, *args, **kwargs)
+ InputBox.__init__(self, session = session, text="
", maxSize=True, type=Input.PIN, *args, **kwargs)
self.waitTime = 15
self.waitTime = 15
@@
-105,13
+99,20
@@
class PinInput(InputBox):
remaining = (self.triesEntry.time.value + (self.waitTime * 60)) - time()
remainingMinutes = int(remaining / 60)
remainingSeconds = int(remaining % 60)
remaining = (self.triesEntry.time.value + (self.waitTime * 60)) - time()
remainingMinutes = int(remaining / 60)
remainingSeconds = int(remaining % 60)
- self.onFirstExecBegin.append(boundFunction(self.session.openWithCallback, self.closePinCancel, MessageBox, _("You have to wait
for") + " " + str(remainingMinutes) + " " + _("minutes and") + " " + str(remainingSeconds) + " " + _("seconds."
), MessageBox.TYPE_ERROR))
+ self.onFirstExecBegin.append(boundFunction(self.session.openWithCallback, self.closePinCancel, MessageBox, _("You have to wait
%s!") % (str(remainingMinutes) + " " + _("minutes") + ", " + str(remainingSeconds) + " " + _("seconds")
), MessageBox.TYPE_ERROR))
else:
self.setTries(3)
self["tries"] = Label("")
self.onShown.append(self.showTries)
else:
self.setTries(3)
self["tries"] = Label("")
self.onShown.append(self.showTries)
+ def gotAsciiCode(self):
+ if self["input"].currPos == len(self["input"]) - 1:
+ InputBox.gotAsciiCode(self)
+ self.go()
+ else:
+ InputBox.gotAsciiCode(self)
+
def keyNumberGlobal(self, number):
if self["input"].currPos == len(self["input"]) - 1:
InputBox.keyNumberGlobal(self, number)
def keyNumberGlobal(self, number):
if self["input"].currPos == len(self["input"]) - 1:
InputBox.keyNumberGlobal(self, number)
@@
-120,7
+121,7
@@
class PinInput(InputBox):
InputBox.keyNumberGlobal(self, number)
def checkPin(self, pin):
InputBox.keyNumberGlobal(self, number)
def checkPin(self, pin):
- if pin is not None and int(pin) in self.pinList:
+ if pin is not None and
pin.find(" ") == -1 and
int(pin) in self.pinList:
return True
return False
return True
return False
@@
-149,8
+150,6
@@
class PinInput(InputBox):
self.close(None)
def cancel(self):
self.close(None)
def cancel(self):
- rcinput = eRCInput.getInstance()
- rcinput.setKeyboardMode(rcinput.kmNone)
self.closePinCancel()
def getTries(self):
self.closePinCancel()
def getTries(self):
@@
-165,4
+164,4
@@
class PinInput(InputBox):
self.triesEntry.tries.save()
def showTries(self):
self.triesEntry.tries.save()
def showTries(self):
- self["tries"].setText(_("Tries left:") + " " + str(self.getTries()))
\ No newline at end of file
+ self["tries"].setText(_("Tries left:") + " " + str(self.getTries()))