aboutsummaryrefslogtreecommitdiff
path: root/lib/python/Components
diff options
context:
space:
mode:
authorStefan Pluecken <stefan.pluecken@multimedia-labs.de>2006-01-19 02:18:21 +0000
committerStefan Pluecken <stefan.pluecken@multimedia-labs.de>2006-01-19 02:18:21 +0000
commit85f5c84f1e3e4d22fb1939751d39de03877b93d8 (patch)
tree6c98fa2f78e0c89e46d2d2bc445698a715745986 /lib/python/Components
parentd76847392ff5cd26bc154f6c135310644c5c1d08 (diff)
downloadenigma2-85f5c84f1e3e4d22fb1939751d39de03877b93d8.tar.gz
enigma2-85f5c84f1e3e4d22fb1939751d39de03877b93d8.zip
add a small text input component
Diffstat (limited to 'lib/python/Components')
-rw-r--r--lib/python/Components/Input.py46
-rw-r--r--lib/python/Components/Makefile.am2
-rw-r--r--lib/python/Components/PluginComponent.py64
3 files changed, 79 insertions, 33 deletions
diff --git a/lib/python/Components/Input.py b/lib/python/Components/Input.py
new file mode 100644
index 00000000..d3b06612
--- /dev/null
+++ b/lib/python/Components/Input.py
@@ -0,0 +1,46 @@
+from HTMLComponent import *
+from GUIComponent import *
+from VariableText import *
+
+from enigma import eLabel
+
+from Tools.NumericalTextInput import NumericalTextInput
+
+class Input(HTMLComponent, GUIComponent, VariableText):
+ def __init__(self, text=""):
+ GUIComponent.__init__(self)
+ VariableText.__init__(self)
+ self.numericalTextInput = NumericalTextInput(self.right)
+ self.currPos = 0
+ self.text = text
+ self.update()
+
+ def update(self):
+ self.setText(self.text[0:self.currPos] + "_" + self.text[self.currPos] + "_" + self.text[self.currPos + 1:])
+
+ def createWidget(self, parent):
+ return eLabel(parent)
+
+ def getSize(self):
+ s = self.instance.calculateSize()
+ return (s.width(), s.height())
+
+ def right(self):
+ self.currPos += 1
+ if self.currPos == len(self.text):
+ self.text = self.text + " "
+ self.update()
+
+ def left(self):
+ self.currPos -= 1
+ self.update()
+
+ def number(self, number):
+ self.text = self.text[0:self.currPos] + self.numericalTextInput.getKey(number) + self.text[self.currPos + 1:]
+ self.update()
+
+ def show(self):
+ self.instance.show()
+
+ def hide(self):
+ self.instance.hide() \ No newline at end of file
diff --git a/lib/python/Components/Makefile.am b/lib/python/Components/Makefile.am
index 089d7cef..945946dc 100644
--- a/lib/python/Components/Makefile.am
+++ b/lib/python/Components/Makefile.am
@@ -12,5 +12,5 @@ install_PYTHON = \
EpgList.py ScrollLabel.py Timezones.py Language.py HelpMenuList.py \
BlinkingPixmap.py Pixmap.py ConditionalWidget.py Slider.py LanguageList.py \
PluginList.py PluginComponent.py RecordingConfig.py About.py UsageConfig.py \
- FIFOList.py ServiceEventTracker.py
+ FIFOList.py ServiceEventTracker.py Input.py
diff --git a/lib/python/Components/PluginComponent.py b/lib/python/Components/PluginComponent.py
index adfc98a0..26eadd10 100644
--- a/lib/python/Components/PluginComponent.py
+++ b/lib/python/Components/PluginComponent.py
@@ -20,38 +20,38 @@ class PluginComponent:
for x in dir:
path = resolveFilename(SCOPE_PLUGINS, x) + "/"
- try:
- if os.path.exists(path):
- if fileExists(path + "plugin.py"):
- pluginmodule = self.prefix + x + ".plugin"
- print "trying to import " + pluginmodule
- exec "import " + pluginmodule
- plugin = eval(pluginmodule)
- plugins = plugin.getPlugins()
- try: picturepaths = plugin.getPicturePaths()
- except:
- picturepaths = []
- for p in plugins:
- picturepaths.append("")
- try:
- for menuEntry in plugin.getMenuRegistrationList():
- self.menuEntries.append([menuEntry, pluginmodule])
- except:
- pass
-
- for y in range(len(plugins)):
- if len(plugins[y]) < 5:
- list.append((path + picturepaths[y], plugins[y][0] , x, plugins[y][2], plugins[y][3], None, plugins[y][1]))
- else:
- list.append((path + picturepaths[y], plugins[y][0] , x, plugins[y][2], plugins[y][3], plugins[y][4], plugins[y][1]))
- if runAutostartPlugins:
- try: plugin.autostart()
- except: pass
- if runAutoendPlugins:
- try: plugin.autoend()
- except: pass
- except:
- print "Directory", path, "contains a faulty plugin"
+# try:
+ if os.path.exists(path):
+ if fileExists(path + "plugin.py"):
+ pluginmodule = self.prefix + x + ".plugin"
+ print "trying to import " + pluginmodule
+ exec "import " + pluginmodule
+ plugin = eval(pluginmodule)
+ plugins = plugin.getPlugins()
+ try: picturepaths = plugin.getPicturePaths()
+ except:
+ picturepaths = []
+ for p in plugins:
+ picturepaths.append("")
+ try:
+ for menuEntry in plugin.getMenuRegistrationList():
+ self.menuEntries.append([menuEntry, pluginmodule])
+ except:
+ pass
+
+ for y in range(len(plugins)):
+ if len(plugins[y]) < 5:
+ list.append((path + picturepaths[y], plugins[y][0] , x, plugins[y][2], plugins[y][3], None, plugins[y][1]))
+ else:
+ list.append((path + picturepaths[y], plugins[y][0] , x, plugins[y][2], plugins[y][3], plugins[y][4], plugins[y][1]))
+ if runAutostartPlugins:
+ try: plugin.autostart()
+ except: pass
+ if runAutoendPlugins:
+ try: plugin.autoend()
+ except: pass
+# except:
+# print "Directory", path, "contains a faulty plugin"
self.menuUpdate()
return list