search font in current skin path when not found in font dir
authorAndreas Monzner <andreas.monzner@multimedia-labs.de>
Thu, 17 Apr 2008 18:14:37 +0000 (18:14 +0000)
committerAndreas Monzner <andreas.monzner@multimedia-labs.de>
Thu, 17 Apr 2008 18:14:37 +0000 (18:14 +0000)
skin.py

diff --git a/skin.py b/skin.py
index 26c0820..2c84afb 100644 (file)
--- a/skin.py
+++ b/skin.py
@@ -11,7 +11,7 @@ from enigma import eSize, ePoint, gFont, eWindow, eLabel, ePixmap, eWindowStyleM
 from Components.config import ConfigSubsection, ConfigText, config
 from Components.Converter.Converter import Converter
 from Components.Sources.Source import Source, ObsoleteSource
 from Components.config import ConfigSubsection, ConfigText, config
 from Components.Converter.Converter import Converter
 from Components.Sources.Source import Source, ObsoleteSource
-from Tools.Directories import resolveFilename, SCOPE_SKIN, SCOPE_SKIN_IMAGE, SCOPE_FONTS
+from Tools.Directories import resolveFilename, SCOPE_SKIN, SCOPE_SKIN_IMAGE, SCOPE_FONTS, fileExists
 from Tools.Import import my_import
 from Tools.LoadPixmap import LoadPixmap
 
 from Tools.Import import my_import
 from Tools.LoadPixmap import LoadPixmap
 
@@ -265,7 +265,14 @@ def loadSingleSkinData(desktop, dom_skin, path_prefix):
                        name = str(font.getAttribute("name") or "Regular")
                        scale = int(font.getAttribute("scale") or "100")
                        is_replacement = font.getAttribute("replacement") != ""
                        name = str(font.getAttribute("name") or "Regular")
                        scale = int(font.getAttribute("scale") or "100")
                        is_replacement = font.getAttribute("replacement") != ""
-                       addFont(resolveFilename(SCOPE_FONTS, filename, path_prefix=path_prefix), name, scale, is_replacement)
+                       resolved_font = resolveFilename(SCOPE_FONTS, filename, path_prefix=path_prefix)
+                       if not fileExists(resolved_font): #when font is not available look at current skin path
+                               pos = config.skin.primary_skin.value.rfind('/')
+                               if pos != -1:
+                                       skin_path = resolveFilename(SCOPE_SKIN, config.skin.primary_skin.value[:pos+1]+filename, path_prefix=path_prefix)
+                                       if fileExists(skin_path):
+                                               resolved_font = skin_path
+                       addFont(resolved_font, name, scale, is_replacement)
        
        for windowstyle in elementsWithTag(skin.childNodes, "windowstyle"):
                style = eWindowStyleSkinned()
        
        for windowstyle in elementsWithTag(skin.childNodes, "windowstyle"):
                style = eWindowStyleSkinned()