Merge branch 'bug_249_current_skin_fallback' into experimental
authoracid-burn <acidburn@opendreambox.org>
Wed, 11 Nov 2009 09:56:30 +0000 (10:56 +0100)
committeracid-burn <acidburn@opendreambox.org>
Wed, 11 Nov 2009 09:56:30 +0000 (10:56 +0100)
Conflicts:
lib/python/Components/FileList.py
lib/python/Plugins/Extensions/MediaPlayer/plugin.py

1  2 
lib/python/Components/FileList.py
lib/python/Plugins/Extensions/MediaPlayer/plugin.py

@@@ -3,7 -3,7 +3,7 @@@ from os import path as os_path, listdi
  from MenuList import MenuList
  from Components.Harddisk import harddiskmanager
  
- from Tools.Directories import SCOPE_SKIN_IMAGE, resolveFilename, fileExists
 -from Tools.Directories import SCOPE_CURRENT_SKIN, resolveFilename
++from Tools.Directories import SCOPE_CURRENT_SKIN, resolveFilename, fileExists
  
  from enigma import RT_HALIGN_LEFT, eListboxPythonMultiContent, \
        eServiceReference, eServiceCenter, gFont
@@@ -23,7 -23,6 +23,6 @@@ EXTENSIONS = 
                "ts": "movie",
                "avi": "movie",
                "divx": "movie",
-               "m4v": "movie",
                "mpg": "movie",
                "mpeg": "movie",
                "mkv": "movie",
@@@ -35,12 -34,12 +34,12 @@@ def FileEntryComponent(name, absolute 
        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:
@@@ -160,11 -159,8 +159,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:
@@@ -259,12 -255,12 +258,12 @@@ def MultiFileSelectEntryComponent(name
        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:
  
        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
@@@ -377,11 -373,8 +376,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:
index c1badb2,a2422be..0fc78fb
mode 100644,100755..100755
@@@ -19,7 -19,7 +19,7 @@@ from Components.Playlist import Playlis
  from Components.AVSwitch import AVSwitch
  from Components.Harddisk import harddiskmanager
  from Components.config import config
- from Tools.Directories import fileExists, pathExists, resolveFilename, SCOPE_CONFIG, SCOPE_PLAYLIST, SCOPE_SKIN_IMAGE
+ from Tools.Directories import fileExists, pathExists, resolveFilename, SCOPE_CONFIG, SCOPE_PLAYLIST, SCOPE_CURRENT_SKIN
  from settings import MediaPlayerSettings
  import random
  
@@@ -50,7 -50,7 +50,7 @@@ class MediaPixmap(Pixmap)
                                        noCoverFile = value
                                        break
                if noCoverFile is None:
-                       noCoverFile = resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/no_coverArt.png")
+                       noCoverFile = resolveFilename(SCOPE_CURRENT_SKIN, "skin_default/no_coverArt.png")
                self.noCoverPixmap = LoadPixmap(noCoverFile)
                return Pixmap.applySkin(self, desktop, screen)
  
@@@ -110,7 -110,7 +110,7 @@@ class MediaPlayer(Screen, InfoBarBase, 
  
                # 'None' is magic to start at the list of mountpoints
                defaultDir = config.mediaplayer.defaultDir.getValue()
 -              self.filelist = FileList(defaultDir, matchingPattern = "(?i)^.*\.(mp2|mp3|ogg|ts|m2ts|wav|wave|m3u|pls|e2pls|mpg|vob|avi|divx|mkv|mp4|m4a|dat|flac|mov)", useServiceRef = True, additionalExtensions = "4098:m3u 4098:e2pls 4098:pls")
 +              self.filelist = FileList(defaultDir, matchingPattern = "(?i)^.*\.(mp2|mp3|ogg|ts|m2ts|wav|wave|m3u|pls|e2pls|mpg|vob|avi|divx|m4v|mkv|mp4|m4a|dat|flac|mov)", useServiceRef = True, additionalExtensions = "4098:m3u 4098:e2pls 4098:pls")
                self["filelist"] = self.filelist
  
                self.playlist = MyPlayList()