- switchtimer added to RecordingTimer
[enigma2.git] / lib / python / Plugins / Extensions / FileManager / plugin.py
1 from enigma import *
2 from Screens.Screen import Screen
3 from Screens.MessageBox import MessageBox
4 from Components.ActionMap import NumberActionMap
5 from Components.Label import Label
6 from Components.Input import Input
7 from Components.GUIComponent import *
8 from Components.Pixmap import Pixmap
9 from Components.FileList import FileEntryComponent, FileList
10 from Plugins.Plugin import PluginDescriptor
11
12 import os
13
14 class FileManager(Screen):
15         skin = """
16                 <screen position="100,100" size="550,400" title="Test" >
17                         <!--widget name="text" position="0,0" size="550,25" font="Regular;20" /-->
18                         <widget name="list" position="10,0" size="190,250" scrollbarMode="showOnDemand" />
19                         <widget name="pixmap" position="200,0" size="190,250" alphatest="on" />
20                 </screen>"""
21         def __init__(self, session, args = None):
22                 self.skin = FileManager.skin
23                 Screen.__init__(self, session)
24
25                 self["list"] = FileList("/", matchingPattern = "^.*\.(png|avi|mp3|mpeg|ts)", useServiceRef = True)
26                 self["pixmap"] = Pixmap()
27                 
28                 #self["text"] = Input("1234", maxSize=True, type=Input.NUMBER)
29                                 
30                 self["actions"] = NumberActionMap(["WizardActions", "InputActions"],
31                 {
32                         "ok": self.ok,
33                         "back": self.close,
34 #                       "left": self.keyLeft,
35 #                       "right": self.keyRight,
36                         "1": self.keyNumberGlobal,
37                         "2": self.keyNumberGlobal,
38                         "3": self.keyNumberGlobal,
39                         "4": self.keyNumberGlobal,
40                         "5": self.keyNumberGlobal,
41                         "6": self.keyNumberGlobal,
42                         "7": self.keyNumberGlobal,
43                         "8": self.keyNumberGlobal,
44                         "9": self.keyNumberGlobal,
45                         "0": self.keyNumberGlobal
46                 }, -1)
47                 
48         def keyLeft(self):
49                 self["text"].left()
50         
51         def keyRight(self):
52                 self["text"].right()
53         
54         def ok(self):
55                 
56                 if self["list"].canDescent(): # isDir
57                         self["list"].descent()
58                 else:
59                         self["pixmap"].instance.setPixmapFromFile(self["list"].getSelection())
60         
61         def keyNumberGlobal(self, number):
62                 print "pressed", number
63                 self["text"].number(number)
64
65 def main(session, **kwargs):
66         session.open(FileManager)
67
68 def Plugins(**kwargs):
69         return PluginDescriptor(name="File-Manager", description="Let's you view/edit files in your Dreambox", where = PluginDescriptor.WHERE_PLUGINMENU, fnc=main)