add getSelectionIndex
[enigma2.git] / lib / python / Components / FileList.py
index 7621ccb..3091436 100644 (file)
@@ -2,21 +2,14 @@ from HTMLComponent import *
 from GUIComponent import *
 import re
 
+from os import path as os_path, listdir
 from MenuList import MenuList
 from Components.Harddisk import harddiskmanager
 
-from Tools.Directories import *
+from Tools.Directories import SCOPE_SKIN_IMAGE, resolveFilename
 
-from enigma import *
-
-RT_HALIGN_LEFT = 0
-RT_HALIGN_RIGHT = 1
-RT_HALIGN_CENTER = 2
-RT_HALIGN_BLOCK = 4
-
-RT_VALIGN_TOP = 0
-RT_VALIGN_CENTER = 8
-RT_VALIGN_BOTTOM = 16
+from enigma import RT_HALIGN_LEFT, loadPNG, eListbox, eListboxPythonMultiContent, \
+       eServiceReference, eServiceCenter, gFont
 
 EXTENSIONS = {
                "mp3": "music",
@@ -65,12 +58,16 @@ class FileList(MenuList, HTMLComponent, GUIComponent):
                self.changeDir(directory)
 
                self.l.setFont(0, gFont("Regular", 18))
-               
+               self.l.setItemHeight(23)
+
        def getSelection(self):
                if self.l.getCurrentSelection() is None:
                        return None
                return self.l.getCurrentSelection()[0]
        
+       def getSelectionIndex(self):
+               return self.l.getCurrentSelectionIndex()
+
        def getFileList(self):
                return self.list
        
@@ -111,11 +108,11 @@ class FileList(MenuList, HTMLComponent, GUIComponent):
                        directories.sort()
                        files.sort()
                else:
-                       files = os.listdir(directory)
+                       files = listdir(directory)
                        files.sort()
                        tmpfiles = files[:]
                        for x in tmpfiles:
-                               if os.path.isdir(directory + x):
+                               if os_path.isdir(directory + x):
                                        directories.append(directory + x + "/")
                                        files.remove(x)
                
@@ -193,4 +190,3 @@ class FileList(MenuList, HTMLComponent, GUIComponent):
 
        def postWidgetCreate(self, instance):
                instance.setContent(self.l)
-               instance.setItemHeight(23)