aboutsummaryrefslogtreecommitdiff
path: root/lib/python
diff options
context:
space:
mode:
authorStefan Pluecken <stefan.pluecken@multimedia-labs.de>2006-02-22 16:32:28 +0000
committerStefan Pluecken <stefan.pluecken@multimedia-labs.de>2006-02-22 16:32:28 +0000
commita0842dd1b96a660acedf4894690c3ab37c24094d (patch)
tree7ba17e9e68c783a074fb903d55f5d5736fd24c3b /lib/python
parent568bc959ef68e29e12afb857d01de2e1f7517e4d (diff)
downloadenigma2-a0842dd1b96a660acedf4894690c3ab37c24094d.tar.gz
enigma2-a0842dd1b96a660acedf4894690c3ab37c24094d.zip
create a Console screen for command executions
Diffstat (limited to 'lib/python')
-rw-r--r--lib/python/Plugins/FileManager/plugin.py69
-rw-r--r--lib/python/Plugins/update/plugin.py3
-rw-r--r--lib/python/Screens/Console.py52
-rw-r--r--lib/python/Screens/Makefile.am3
-rw-r--r--lib/python/Screens/__init__.py2
5 files changed, 57 insertions, 72 deletions
diff --git a/lib/python/Plugins/FileManager/plugin.py b/lib/python/Plugins/FileManager/plugin.py
index 4b577b02..e69de29b 100644
--- a/lib/python/Plugins/FileManager/plugin.py
+++ b/lib/python/Plugins/FileManager/plugin.py
@@ -1,69 +0,0 @@
-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 *
-from Components.Pixmap import Pixmap
-from Components.FileList import FileEntryComponent, FileList
-from Plugins.Plugin import PluginDescriptor
-
-import os
-
-class FileManager(Screen):
- skin = """
- <screen position="100,100" size="550,400" title="Test" >
- <!--widget name="text" position="0,0" size="550,25" font="Regular;20" /-->
- <widget name="list" position="10,0" size="190,250" scrollbarMode="showOnDemand" />
- <widget name="pixmap" position="200,0" size="190,250" />
- </screen>"""
- def __init__(self, session, args = None):
- self.skin = FileManager.skin
- Screen.__init__(self, session)
-
- self["list"] = FileList("/", matchingPattern = "^.*\.(png|avi|mp3|mpeg|ts)")
- self["pixmap"] = Pixmap()
-
- #self["text"] = Input("1234", maxSize=True, type=Input.NUMBER)
-
- self["actions"] = NumberActionMap(["WizardActions", "InputActions"],
- {
- "ok": self.ok,
- "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["text"].left()
-
- def keyRight(self):
- self["text"].right()
-
- def ok(self):
- selection = self["list"].getSelection()
- if selection[1] == True: # isDir
- self["list"].changeDir(selection[0])
- else:
- self["pixmap"].instance.setPixmapFromFile(selection[0])
-
- def keyNumberGlobal(self, number):
- print "pressed", number
- self["text"].number(number)
-
-def main(session):
- session.open(Test)
-
-def Plugins():
- return PluginDescriptor(name="File-Manager", description="Let's you view/edit files in your Dreambox", where = PluginDescriptor.WHERE_PLUGINMENU, fnc=main)
diff --git a/lib/python/Plugins/update/plugin.py b/lib/python/Plugins/update/plugin.py
index 1d91a558..56c1dfd9 100644
--- a/lib/python/Plugins/update/plugin.py
+++ b/lib/python/Plugins/update/plugin.py
@@ -6,6 +6,7 @@ from Components.ScrollLabel import ScrollLabel
from Components.GUIComponent import *
from Components.MenuList import MenuList
from Components.Input import Input
+from Screens.Console import Console
from Plugins.Plugin import PluginDescriptor
import os
@@ -43,7 +44,7 @@ class UpdatePluginMenu(Screen):
def runUpgrade(self, result):
if result:
- self.session.open(Upgrade)
+ self.session.open(Console, ["ipkg update", "ipkg upgrade -force-defaults -force-overwrite"])
class IPKGSource(Screen):
skin = """
diff --git a/lib/python/Screens/Console.py b/lib/python/Screens/Console.py
new file mode 100644
index 00000000..17d706f5
--- /dev/null
+++ b/lib/python/Screens/Console.py
@@ -0,0 +1,52 @@
+from enigma import eConsoleAppContainer
+from Screens.Screen import Screen
+from Components.ActionMap import ActionMap, NumberActionMap
+from Components.ScrollLabel import ScrollLabel
+
+class Console(Screen):
+ #TODO move this to skin.xml
+ skin = """
+ <screen position="100,100" size="550,400" title="Command execution..." >
+ <widget name="text" position="0,0" size="550,400" font="Regular;15" />
+ </screen>"""
+
+ def __init__(self, session, args = None):
+ self.skin = Console.skin
+ Screen.__init__(self, session)
+
+ self["text"] = ScrollLabel("")
+ self["actions"] = ActionMap(["WizardActions", "DirectionActions"],
+ {
+ "ok": self.cancel,
+ "back": self.cancel,
+ "up": self["text"].pageUp,
+ "down": self["text"].pageDown
+ }, -1)
+
+ self.cmdlist = args
+
+ self.container = eConsoleAppContainer()
+ self.run = 0
+ self.container.appClosed.get().append(self.runFinished)
+ self.container.dataAvail.get().append(self.dataAvail)
+ self.onLayoutFinish.append(self.startRun) # dont start before gui is finished
+
+ def startRun(self):
+ self["text"].setText(_("Execution Progress:") + "\n\n")
+ self.container.execute("ipkg update")
+
+ def runFinished(self, retval):
+ self.run += 1
+ if self.run != len(self.cmdlist):
+ self.container.execute(self.cmdlist[self.run])
+ else:
+ str = self["text"].getText()
+ str += _("Execution finished!!");
+ self["text"].setText(str)
+
+ def cancel(self):
+ if self.run == len(self.cmdlist):
+ self.close()
+
+ def dataAvail(self, str):
+ self["text"].setText(self["text"].getText() + str) \ No newline at end of file
diff --git a/lib/python/Screens/Makefile.am b/lib/python/Screens/Makefile.am
index 2629315f..3365e97f 100644
--- a/lib/python/Screens/Makefile.am
+++ b/lib/python/Screens/Makefile.am
@@ -8,5 +8,6 @@ install_PYTHON = \
EpgSelection.py EventView.py Mute.py Standby.py ServiceInfo.py \
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
+ TutorialWizard.py PluginBrowser.py MinuteInput.py Scart.py PVRState.py \
+ Console.py
diff --git a/lib/python/Screens/__init__.py b/lib/python/Screens/__init__.py
index a8e1851c..06378dc3 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"]
+ "PVRState", "Console" ]