save supposed afterEvent config in class Job member (fixes #394 DVDBurn shutdown...
[enigma2.git] / lib / python / Components / FileList.py
index 54bb1acfa078e49f965c63044aa172e75f90a999..841a2fe5fc6ba47be6a8b585648812b29a2cb0c8 100755 (executable)
@@ -3,7 +3,7 @@ from os import path as os_path, listdir
 from MenuList import MenuList
 from Components.Harddisk import harddiskmanager
 
-from Tools.Directories import SCOPE_SKIN_IMAGE, resolveFilename
+from Tools.Directories import SCOPE_CURRENT_SKIN, resolveFilename, fileExists
 
 from enigma import RT_HALIGN_LEFT, eListboxPythonMultiContent, \
        eServiceReference, eServiceCenter, gFont
@@ -23,6 +23,7 @@ EXTENSIONS = {
                "ts": "movie",
                "avi": "movie",
                "divx": "movie",
+               "m4v": "movie",
                "mpg": "movie",
                "mpeg": "movie",
                "mkv": "movie",
@@ -34,12 +35,12 @@ def FileEntryComponent(name, absolute = None, isDir = False):
        res = [ (absolute, isDir) ]
        res.append((eListboxPythonMultiContent.TYPE_TEXT, 35, 1, 470, 20, 0, RT_HALIGN_LEFT, name))
        if isDir:
-               png = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "extensions/directory.png"))
+               png = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "extensions/directory.png"))
        else:
                extension = name.split('.')
                extension = extension[-1].lower()
                if EXTENSIONS.has_key(extension):
-                       png = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "extensions/" + EXTENSIONS[extension] + ".png"))
+                       png = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "extensions/" + EXTENSIONS[extension] + ".png"))
                else:
                        png = None
        if png is not None:
@@ -159,8 +160,11 @@ class FileList(MenuList):
                        directories.sort()
                        files.sort()
                else:
-                       if os_path.exists(directory):
-                               files = listdir(directory)
+                       if fileExists(directory):
+                               try:
+                                       files = listdir(directory)
+                               except:
+                                       files = []
                                files.sort()
                                tmpfiles = files[:]
                                for x in tmpfiles:
@@ -255,12 +259,12 @@ def MultiFileSelectEntryComponent(name, absolute = None, isDir = False, selected
        res = [ (absolute, isDir, selected, name) ]
        res.append((eListboxPythonMultiContent.TYPE_TEXT, 55, 1, 470, 20, 0, RT_HALIGN_LEFT, name))
        if isDir:
-               png = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "extensions/directory.png"))
+               png = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "extensions/directory.png"))
        else:
                extension = name.split('.')
                extension = extension[-1].lower()
                if EXTENSIONS.has_key(extension):
-                       png = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "extensions/" + EXTENSIONS[extension] + ".png"))
+                       png = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "extensions/" + EXTENSIONS[extension] + ".png"))
                else:
                        png = None
        if png is not None:
@@ -268,10 +272,10 @@ def MultiFileSelectEntryComponent(name, absolute = None, isDir = False, selected
 
        if not name.startswith('<'):
                if selected is False:
-                       icon = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/icons/lock_off.png"))
+                       icon = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/lock_off.png"))
                        res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 2, 0, 25, 25, icon))
                else:
-                       icon = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/icons/lock_on.png"))
+                       icon = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/icons/lock_on.png"))
                        res.append((eListboxPythonMultiContent.TYPE_PIXMAP_ALPHATEST, 2, 0, 25, 25, icon))
        
        return res
@@ -373,8 +377,11 @@ class MultiFileSelectList(FileList):
                        directories.sort()
                        files.sort()
                else:
-                       if os_path.exists(directory):
-                               files = listdir(directory)
+                       if fileExists(directory):
+                               try:
+                                       files = listdir(directory)
+                               except:
+                                       files = []
                                files.sort()
                                tmpfiles = files[:]
                                for x in tmpfiles: