add FileManger plugin
authorStefan Pluecken <stefan.pluecken@multimedia-labs.de>
Wed, 22 Feb 2006 15:22:30 +0000 (15:22 +0000)
committerStefan Pluecken <stefan.pluecken@multimedia-labs.de>
Wed, 22 Feb 2006 15:22:30 +0000 (15:22 +0000)
reenable plugin icons

configure.ac
lib/python/Components/PluginComponent.py
lib/python/Components/PluginList.py
lib/python/Plugins/FileManager/Makefile.am [new file with mode: 0644]
lib/python/Plugins/FileManager/__init__.py [new file with mode: 0644]
lib/python/Plugins/FileManager/plugin.py [new file with mode: 0644]
lib/python/Plugins/Makefile.am
lib/python/Plugins/Plugin.py
lib/python/Plugins/update/plugin.py

index 29a30588ca134a9d5dcd74b93ed07dee4daa84fd..b5a19aad22b2ec65fa44dc14da86cc27629b5068 100644 (file)
@@ -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
index bd8a6d073fd2ee5f6c80381e9657a07cb9a6f1cc..eeb2c97451c0304e3c5175a324b0c2134ec010f1 100644 (file)
@@ -56,6 +56,7 @@ class PluginComponent:
                                                plugins = [ plugins ]
                                        
                                        for p in plugins:
+                                               p.updateIcon(path)
                                                self.addPlugin(p);
 
        def getPlugins(self, where):
index a84934978184d2709342f278574eaf5e7b84f365..b9b5bcc7f92f2994198f7d62be7d0184a08c8af2 100644 (file)
@@ -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 (file)
index 0000000..e69de29
diff --git a/lib/python/Plugins/FileManager/__init__.py b/lib/python/Plugins/FileManager/__init__.py
new file mode 100644 (file)
index 0000000..e69de29
diff --git a/lib/python/Plugins/FileManager/plugin.py b/lib/python/Plugins/FileManager/plugin.py
new file mode 100644 (file)
index 0000000..4b577b0
--- /dev/null
@@ -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 = """
+               <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)
index 6b749de20c7e11e05621e49667beb7f04a3a71e3..66fb252ddd434ca8055bcb4867523e535a809c35 100644 (file)
@@ -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 
index d363509189cc8f4204deebcc76f5171d5d466193..183419c7fe90d357b83574963f3767ed78b73b6a 100644 (file)
@@ -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
index aca5c674c95d7a2be826ba9ce91c503b90ab77f8..1d91a5582d7dbdb65279ee8986f9b087a24def1c 100644 (file)
@@ -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)