always initialize diseqc.data to make compiler happy
[enigma2.git] / skin.py
diff --git a/skin.py b/skin.py
index a40952041530cfe4428d6eeb5359ab0724896c5b..58426c0f18f052332f78b1da24a7318bcde92ba6 100644 (file)
--- a/skin.py
+++ b/skin.py
@@ -14,13 +14,10 @@ def dump(x, i=0):
        except:
                None
 
+from Tools.Directories import resolveFilename, SCOPE_SKIN
+
 # read the skin
-try:
-       # first we search in the current path
-       skinfile = file('data/skin.xml', 'r')
-except:
-       # if not found in the current path, we use the global datadir-path
-       skinfile = file('/usr/share/enigma2/skin.xml', 'r')
+skinfile = file(resolveFilename(SCOPE_SKIN, 'skin.xml'), 'r')
 dom = xml.dom.minidom.parseString(skinfile.read())
 skinfile.close()
 
@@ -74,13 +71,9 @@ def applySingleAttribute(guiObject, desktop, attrib, value):
                elif attrib == 'zPosition':
                        guiObject.setZPosition(int(value))
                elif attrib == "pixmap":
-                       ptr = gPixmapPtr()
-                       if loadPNG(ptr, value):
-                               raise "loading PNG failed!"
-                       x = ptr
-                       ptr = ptr.__deref__()
-                       desktop.makeCompatiblePixmap(ptr)
-                       guiObject.setPixmap(ptr)
+                       ptr = loadPNG(value)
+                       desktop.makeCompatiblePixmap(ptr.__deref__())
+                       guiObject.setPixmap(ptr.__deref__())
                        # guiObject.setPixmapFromFile(value)
                elif attrib == "alphatest": # used by ePixmap
                        guiObject.setAlphatest(
@@ -128,6 +121,18 @@ def applySingleAttribute(guiObject, desktop, attrib, value):
                        guiObject.setForegroundColor(parseColor(value))
                elif attrib == "selectionDisabled":
                        guiObject.setSelectionEnable(0)
+               elif attrib == "transparent":
+                       guiObject.setTransparent(int(value))
+               elif attrib == "borderColor":
+                       guiObject.setBorderColor(parseColor(value))
+               elif attrib == "borderWidth":
+                       guiObject.setBorderWidth(int(value))
+               elif attrib == "scrollbarMode":
+                       guiObject.setScrollbarMode(
+                               { "showOnDemand": guiObject.showOnDemand,
+                                       "showAlways": guiObject.showAlways,
+                                       "showNever": guiObject.showNever
+                               }[value])
                elif attrib != 'name':
                        print "unsupported attribute " + attrib + "=" + value
        except int:
@@ -141,12 +146,6 @@ def applyAllAttributes(guiObject, desktop, attributes):
 def loadSkin(desktop):
        print "loading skin..."
        
-       def getPNG(x):
-               g = gPixmapPtr()
-               loadPNG(g, x)
-               g = g.grabRef()
-               return g
-       
        skin = dom.childNodes[0]
        assert skin.tagName == "skin", "root element in skin must be 'skin'!"
        
@@ -163,7 +162,7 @@ def loadSkin(desktop):
        for windowstyle in elementsWithTag(skin.childNodes, "windowstyle"):
                style = eWindowStyleSkinned()
                
-               style.setTitleFont(gFont("Arial", 20));
+               style.setTitleFont(gFont("Regular", 20));
                style.setTitleOffset(eSize(20, 5));
                
                for borderset in elementsWithTag(windowstyle.childNodes, "borderset"):
@@ -172,11 +171,11 @@ def loadSkin(desktop):
                                bpName = str(pixmap.getAttribute("pos"))
                                filename = str(pixmap.getAttribute("filename"))
                                
-                               png = getPNG(filename)
+                               png = loadPNG(filename)
                                
                                # adapt palette
-                               desktop.makeCompatiblePixmap(png)
-                               style.setPixmap(eWindowStyleSkinned.__dict__[bsName], eWindowStyleSkinned.__dict__[bpName], png)
+                               desktop.makeCompatiblePixmap(png.__deref__())
+                               style.setPixmap(eWindowStyleSkinned.__dict__[bsName], eWindowStyleSkinned.__dict__[bpName], png.__deref__())
 
                for color in elementsWithTag(windowstyle.childNodes, "color"):
                        type = str(color.getAttribute("name"))