diff options
| author | Stefan Pluecken <stefan.pluecken@multimedia-labs.de> | 2006-02-25 04:05:35 +0000 |
|---|---|---|
| committer | Stefan Pluecken <stefan.pluecken@multimedia-labs.de> | 2006-02-25 04:05:35 +0000 |
| commit | 714488394a5c552b175f69682ac2001f8f1b6345 (patch) | |
| tree | 0189089b5a013566aa1778876528dcf0df4c5308 | |
| parent | 842dabf727814691bfd949ac4d910ce04c32b887 (diff) | |
| download | enigma2-714488394a5c552b175f69682ac2001f8f1b6345.tar.gz enigma2-714488394a5c552b175f69682ac2001f8f1b6345.zip | |
add InputBox screen for textual input
| -rw-r--r-- | data/skin.xml | 4 | ||||
| -rw-r--r-- | lib/python/Plugins/DemoPlugins/TestPlugin/plugin.py | 13 | ||||
| -rw-r--r-- | lib/python/Screens/InputBox.py | 50 | ||||
| -rw-r--r-- | lib/python/Screens/Makefile.am | 2 | ||||
| -rw-r--r-- | lib/python/Screens/__init__.py | 2 |
5 files changed, 68 insertions, 3 deletions
diff --git a/data/skin.xml b/data/skin.xml index 88af192e..92dfa0bb 100644 --- a/data/skin.xml +++ b/data/skin.xml @@ -338,6 +338,10 @@ <widget name="scan_state" position="10,40" size="280,60" font="Regular;20" /> <widget name="servicelist" position="10,110" size="280,175" selectionDisabled="1" /> </screen> + <screen name="InputBox" position="100,100" size="550,400" title="Input" > + <widget name="text" position="0,0" size="550,25" font="Regular;20" /> + <widget name="input" position="0,30" size="550,25" font="Regular;20" /> + </screen>""" <screen name="TimerEdit" position="70,100" size="590,335" title="Timer Edit"> <widget name="description" position="10,10" size="580,40" font="Regular;25" /> <widget name="lbegin" position="405,102" size="103,30" font="Regular;25" foregroundColor="red" /> diff --git a/lib/python/Plugins/DemoPlugins/TestPlugin/plugin.py b/lib/python/Plugins/DemoPlugins/TestPlugin/plugin.py index 5991f594..856c2f3b 100644 --- a/lib/python/Plugins/DemoPlugins/TestPlugin/plugin.py +++ b/lib/python/Plugins/DemoPlugins/TestPlugin/plugin.py @@ -7,6 +7,7 @@ from Components.Input import Input from Components.GUIComponent import * from Components.Pixmap import Pixmap from Components.FileList import FileEntryComponent, FileList +from Screens.InputBox import InputBox from Plugins.Plugin import PluginDescriptor import os @@ -45,6 +46,11 @@ class Test(Screen): "0": self.keyNumberGlobal }, -1) + self.onShown.append(self.openTest) + + def openTest(self): + self.session.open(InputBox) + def keyLeft(self): self["text"].left() @@ -63,7 +69,12 @@ class Test(Screen): self["text"].number(number) def main(session): - session.open(Test) + session.openWithCallback(test, InputBox, title="Hallo", text="1234", maxSize=True, type=Input.NUMBER) + +def test(returnValue): + print "You entered", returnValue def Plugins(): return PluginDescriptor(name="Test", description="plugin to test some capabilities", where = PluginDescriptor.WHERE_PLUGINMENU, fnc=main) + +
\ No newline at end of file diff --git a/lib/python/Screens/InputBox.py b/lib/python/Screens/InputBox.py new file mode 100644 index 00000000..6771a517 --- /dev/null +++ b/lib/python/Screens/InputBox.py @@ -0,0 +1,50 @@ +from enigma import * +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 * + +import os + +class InputBox(Screen): + def __init__(self, session, title = "", **kwargs): + Screen.__init__(self, session) + + self["text"] = Label(title) + self["input"] = Input(**kwargs) + + self["actions"] = NumberActionMap(["WizardActions", "InputActions"], + { + "ok": self.go, + "back": self.close, + "left": self.keyLeft, + "right": self.keyRight, + "1": self.keyNumberGlobal, + "2": self.keyNumberGlobal, + "3": self.keyNumberGlobal, + "4": self.keyNumberGlobal, + "5": self.keyNumberGlobal, + "6": self.keyNumberGlobal, + "7": self.keyNumberGlobal, + "8": self.keyNumberGlobal, + "9": self.keyNumberGlobal, + "0": self.keyNumberGlobal + }, -1) + + def keyLeft(self): + self["input"].left() + + def keyRight(self): + self["input"].right() + + def keyNumberGlobal(self, number): + print "pressed", number + self["input"].number(number) + + def go(self): + self.close(self["input"].getText()) + + def cancel(self): + self.close(None)
\ No newline at end of file diff --git a/lib/python/Screens/Makefile.am b/lib/python/Screens/Makefile.am index 3365e97f..63eecb18 100644 --- a/lib/python/Screens/Makefile.am +++ b/lib/python/Screens/Makefile.am @@ -9,5 +9,5 @@ install_PYTHON = \ AudioSelection.py InfoBarGenerics.py HelpMenu.py Wizard.py __init__.py \ Dish.py SubserviceSelection.py LanguageSelection.py StartWizard.py \ TutorialWizard.py PluginBrowser.py MinuteInput.py Scart.py PVRState.py \ - Console.py + Console.py InputBox.py diff --git a/lib/python/Screens/__init__.py b/lib/python/Screens/__init__.py index 06378dc3..d5323bb8 100644 --- a/lib/python/Screens/__init__.py +++ b/lib/python/Screens/__init__.py @@ -5,4 +5,4 @@ __all__ = ["ChannelSelection", "ClockDisplay", "ConfigMenu", "Satconfig", "Scanconfig", "Ci.py", "Volume.py", "Mute.py", "EpgSelection", "EventView", "Standby", "ServiceInfo", "AudioSelection", "SubserviceSelection", "InfoBarGenerics", "HelpMenu", "Wizard", - "PVRState", "Console" ] + "PVRState", "Console", "InputBox" ] |
