From d120b13dd6d9460fc9a66680ffb42632cb597522 Mon Sep 17 00:00:00 2001 From: Stefan Pluecken Date: Wed, 22 Feb 2006 15:22:30 +0000 Subject: [PATCH] add FileManger plugin reenable plugin icons --- configure.ac | 1 + lib/python/Components/PluginComponent.py | 1 + lib/python/Components/PluginList.py | 8 +-- lib/python/Plugins/FileManager/Makefile.am | 0 lib/python/Plugins/FileManager/__init__.py | 0 lib/python/Plugins/FileManager/plugin.py | 69 ++++++++++++++++++++++ lib/python/Plugins/Makefile.am | 2 +- lib/python/Plugins/Plugin.py | 15 +++-- lib/python/Plugins/update/plugin.py | 2 +- 9 files changed, 88 insertions(+), 10 deletions(-) create mode 100644 lib/python/Plugins/FileManager/Makefile.am create mode 100644 lib/python/Plugins/FileManager/__init__.py create mode 100644 lib/python/Plugins/FileManager/plugin.py diff --git a/configure.ac b/configure.ac index 29a30588..b5a19aad 100644 --- a/configure.ac +++ b/configure.ac @@ -61,6 +61,7 @@ lib/python/Components/Makefile lib/python/Screens/Makefile lib/python/Plugins/Makefile lib/python/Plugins/update/Makefile +lib/python/Plugins/FileManager/Makefile lib/python/Plugins/fpupgrade/Makefile lib/python/Plugins/test/Makefile lib/python/Plugins/tuxboxplugins/Makefile diff --git a/lib/python/Components/PluginComponent.py b/lib/python/Components/PluginComponent.py index bd8a6d07..eeb2c974 100644 --- a/lib/python/Components/PluginComponent.py +++ b/lib/python/Components/PluginComponent.py @@ -56,6 +56,7 @@ class PluginComponent: plugins = [ plugins ] for p in plugins: + p.updateIcon(path) self.addPlugin(p); def getPlugins(self, where): diff --git a/lib/python/Components/PluginList.py b/lib/python/Components/PluginList.py index a8493497..b9b5bcc7 100644 --- a/lib/python/Components/PluginList.py +++ b/lib/python/Components/PluginList.py @@ -22,10 +22,10 @@ def PluginEntryComponent(plugin): res.append((eListboxPythonMultiContent.TYPE_TEXT, 80, 5, 300, 25, 0, RT_HALIGN_LEFT, plugin.name)) res.append((eListboxPythonMultiContent.TYPE_TEXT, 80, 26, 300, 17, 1, RT_HALIGN_LEFT, plugin.description)) -# png = loadPNG(picture) -# if png == None: - - png = loadPNG(resolveFilename(SCOPE_SKIN_IMAGE, "/plugin.png")) + if plugin.icon is None: + png = loadPNG(resolveFilename(SCOPE_SKIN_IMAGE, "/plugin.png")) + else: + png = plugin.icon res.append((eListboxPythonMultiContent.TYPE_PIXMAP, 10, 5, 60, 40, png)) return res diff --git a/lib/python/Plugins/FileManager/Makefile.am b/lib/python/Plugins/FileManager/Makefile.am new file mode 100644 index 00000000..e69de29b diff --git a/lib/python/Plugins/FileManager/__init__.py b/lib/python/Plugins/FileManager/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/lib/python/Plugins/FileManager/plugin.py b/lib/python/Plugins/FileManager/plugin.py new file mode 100644 index 00000000..4b577b02 --- /dev/null +++ b/lib/python/Plugins/FileManager/plugin.py @@ -0,0 +1,69 @@ +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 = """ + + + + + """ + 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/Makefile.am b/lib/python/Plugins/Makefile.am index 6b749de2..66fb252d 100644 --- a/lib/python/Plugins/Makefile.am +++ b/lib/python/Plugins/Makefile.am @@ -1,6 +1,6 @@ installdir = $(LIBDIR)/enigma2/python/Plugins -SUBDIRS = update tuxboxplugins web test fpupgrade +SUBDIRS = update tuxboxplugins web test fpupgrade FileManager install_PYTHON = \ __init__.py Plugin.py diff --git a/lib/python/Plugins/Plugin.py b/lib/python/Plugins/Plugin.py index d3635091..183419c7 100644 --- a/lib/python/Plugins/Plugin.py +++ b/lib/python/Plugins/Plugin.py @@ -1,3 +1,5 @@ +from enigma import loadPNG + class PluginDescriptor: """An object to describe a plugin.""" @@ -31,8 +33,13 @@ class PluginDescriptor: else: self.where = [ where ] self.description = description - if type(fnc) is str: - self.icon = loadPNG("..") - else: - self.icon = icon + + self.iconstr = icon + self.__call__ = fnc + + def updateIcon(self, path): + if type(self.iconstr) is str: + self.icon = loadPNG(path + self.iconstr) + else: + self.icon = None \ No newline at end of file diff --git a/lib/python/Plugins/update/plugin.py b/lib/python/Plugins/update/plugin.py index aca5c674..1d91a558 100644 --- a/lib/python/Plugins/update/plugin.py +++ b/lib/python/Plugins/update/plugin.py @@ -253,4 +253,4 @@ def UpgradeMain(session): session.open(UpdatePluginMenu) def Plugins(): - return PluginDescriptor(name="Softwareupdate", description="Updates your receiver's software", where = PluginDescriptor.WHERE_PLUGINMENU, fnc=UpgradeMain) + return PluginDescriptor(name="Softwareupdate", description="Updates your receiver's software", icon="update.png", where = PluginDescriptor.WHERE_PLUGINMENU, fnc=UpgradeMain) -- 2.30.2