signal Standby-state into session globals
[enigma2.git] / skin.py
diff --git a/skin.py b/skin.py
index c8805f01d74b8703c97ab2f6f667826bded5db87..a37716f1e1f2be0ddbbcacbe4fe206063d33e4b3 100644 (file)
--- a/skin.py
+++ b/skin.py
@@ -10,7 +10,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, SCOPE_CURRENT_SKIN, fileExists
+from Tools.Directories import resolveFilename, SCOPE_SKIN, SCOPE_SKIN_IMAGE, SCOPE_FONTS, SCOPE_CURRENT_SKIN, SCOPE_CONFIG, fileExists
 from Tools.Import import my_import
 from Tools.LoadPixmap import LoadPixmap
 
 from Tools.Import import my_import
 from Tools.LoadPixmap import LoadPixmap
 
@@ -26,16 +26,16 @@ def dump(x, i=0):
 
 class SkinError(Exception):
        def __init__(self, message):
 
 class SkinError(Exception):
        def __init__(self, message):
-               self.message = message
+               self.msg = message
 
        def __str__(self):
 
        def __str__(self):
-               return "{%s}: %s" % (config.skin.primary_skin, self.message)
+               return "{%s}: %s" % (config.skin.primary_skin, self.msg)
 
 dom_skins = [ ]
 
 
 dom_skins = [ ]
 
-def loadSkin(name):
+def loadSkin(name, scope = SCOPE_SKIN):
        # read the skin
        # read the skin
-       filename = resolveFilename(SCOPE_SKIN, name)
+       filename = resolveFilename(scope, name)
        mpath = path.dirname(filename) + "/"
        dom_skins.append((mpath, xml.etree.cElementTree.parse(filename).getroot()))
 
        mpath = path.dirname(filename) + "/"
        dom_skins.append((mpath, xml.etree.cElementTree.parse(filename).getroot()))
 
@@ -54,6 +54,11 @@ config.skin = ConfigSubsection()
 config.skin.primary_skin = ConfigText(default = "skin.xml")
 
 profile("LoadSkin")
 config.skin.primary_skin = ConfigText(default = "skin.xml")
 
 profile("LoadSkin")
+try:
+       loadSkin('skin_user.xml', SCOPE_CONFIG)
+except (SkinError, IOError, AssertionError), err:
+       print "not loading user skin: ", err
+
 try:
        loadSkin(config.skin.primary_skin.value)
 except (SkinError, IOError, AssertionError), err:
 try:
        loadSkin(config.skin.primary_skin.value)
 except (SkinError, IOError, AssertionError), err:
@@ -93,7 +98,7 @@ def collectAttributes(skinAttributes, node, skin_path_prefix=None, ignore=[]):
                attrib = a[0]
                value = a[1]
 
                attrib = a[0]
                value = a[1]
 
-               if attrib in ["pixmap", "pointer", "seek_pointer", "backgroundPixmap", "selectionPixmap"]:
+               if attrib in ("pixmap", "pointer", "seek_pointer", "backgroundPixmap", "selectionPixmap"):
                        value = resolveFilename(SCOPE_SKIN_IMAGE, value, path_prefix=skin_path_prefix)
 
                if attrib not in ignore:
                        value = resolveFilename(SCOPE_SKIN_IMAGE, value, path_prefix=skin_path_prefix)
 
                if attrib not in ignore:
@@ -126,7 +131,7 @@ def applySingleAttribute(guiObject, desktop, attrib, value, scale = ((1,1),(1,1)
                        guiObject.setFont(parseFont(value, scale))
                elif attrib == 'zPosition':
                        guiObject.setZPosition(int(value))
                        guiObject.setFont(parseFont(value, scale))
                elif attrib == 'zPosition':
                        guiObject.setZPosition(int(value))
-               elif attrib in ["pixmap", "backgroundPixmap", "selectionPixmap"]:
+               elif attrib in ("pixmap", "backgroundPixmap", "selectionPixmap"):
                        ptr = loadPixmap(value, desktop) # this should already have been filename-resolved.
                        if attrib == "pixmap":
                                guiObject.setPixmap(ptr)
                        ptr = loadPixmap(value, desktop) # this should already have been filename-resolved.
                        if attrib == "pixmap":
                                guiObject.setPixmap(ptr)