-from enigma import *
import xml.dom.minidom
-from xml.dom import EMPTY_NAMESPACE
-from Tools.Import import my_import
-import os
+from os import path
+
+from enigma import eSize, ePoint, gFont, eWindow, eLabel, ePixmap, eWindowStyleManager, \
+ loadPNG, addFont, gRGB, eWindowStyleSkinned
from Components.config import ConfigSubsection, ConfigText, config
-from Components.Element import Element
from Components.Converter.Converter import Converter
+from Tools.Directories import resolveFilename, SCOPE_SKIN, SCOPE_SKIN_IMAGE, SCOPE_FONTS
+from Tools.Import import my_import
from Tools.XMLTools import elementsWithTag, mergeText
except:
None
-from Tools.Directories import resolveFilename, SCOPE_SKIN, SCOPE_SKIN_IMAGE, SCOPE_FONTS
-
class SkinError(Exception):
def __init__(self, message):
self.message = message
def loadSkin(name):
# read the skin
filename = resolveFilename(SCOPE_SKIN, name)
- path = os.path.dirname(filename) + "/"
- dom_skins.append((path, xml.dom.minidom.parse(filename)))
+ mpath = path.dirname(filename) + "/"
+ dom_skins.append((mpath, xml.dom.minidom.parse(filename)))
# we do our best to always select the "right" value
# skins are loaded in order of priority: skin with
try:
loadSkin(config.skin.primary_skin.value)
-except SkinError, err:
+except (SkinError, IOError, AssertionError), err:
print "SKIN ERROR:", err
print "defaulting to standard skin..."
loadSkin('skin.xml')
guiObject.setZPosition(int(value))
elif attrib == "pixmap":
ptr = loadPixmap(value) # this should already have been filename-resolved.
- # that __deref__ still scares me!
- desktop.makeCompatiblePixmap(ptr.__deref__())
- guiObject.setPixmap(ptr.__deref__())
+ desktop.makeCompatiblePixmap(ptr)
+ guiObject.setPixmap(ptr)
# guiObject.setPixmapFromFile(value)
elif attrib == "alphatest": # used by ePixmap
guiObject.setAlphatest(
(name, pos) = value.split(':')
pos = parsePosition(pos)
ptr = loadPixmap(name)
- desktop.makeCompatiblePixmap(ptr.__deref__())
- guiObject.setPointer({"pointer": 0, "seek_pointer": 1}[attrib], ptr.__deref__(), pos)
+ desktop.makeCompatiblePixmap(ptr)
+ guiObject.setPointer({"pointer": 0, "seek_pointer": 1}[attrib], ptr, pos)
elif attrib == 'shadowOffset':
guiObject.setShadowOffset(parsePosition(value))
+ elif attrib == 'noWrap':
+ guiObject.setNoWrap(1)
else:
raise "unsupported attribute " + attrib + "=" + value
except int:
png = loadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, filename, path_prefix=path_prefix))
# adapt palette
- desktop.makeCompatiblePixmap(png.__deref__())
- style.setPixmap(eWindowStyleSkinned.__dict__[bsName], eWindowStyleSkinned.__dict__[bpName], png.__deref__())
+ desktop.makeCompatiblePixmap(png)
+ style.setPixmap(eWindowStyleSkinned.__dict__[bsName], eWindowStyleSkinned.__dict__[bpName], png)
for color in elementsWithTag(windowstyle.childNodes, "color"):
type = str(color.getAttribute("name"))
except:
raise ("Unknown color %s" % (type))
- x = eWindowStyleManagerPtr()
- eWindowStyleManager.getInstance(x)
+ x = eWindowStyleManager.getInstance()
x.setStyle(id, style)
def loadSkinData(desktop):
return None, None
def readSkin(screen, skin, name, desktop):
+
myscreen, path = lookupScreen(name)
# otherwise try embedded skin
screen.additionalWidgets = [ ]
screen.renderer = [ ]
+ visited_components = set()
+
# now walk all widgets
for widget in elementsWithTag(myscreen.childNodes, "widget"):
# ok, we either have 1:1-mapped widgets ('old style'), or 1:n-mapped
wname = widget.getAttribute('name')
wsource = widget.getAttribute('source')
+
if wname is None and wsource is None:
print "widget has no name and no source!"
continue
if wname:
+ visited_components.add(wname)
+
# get corresponding 'gui' object
try:
attributes = screen[wname].skinAttributes = [ ]
raise SkinError("component with name '" + wname + "' was not found in skin of screen '" + name + "'!")
# assert screen[wname] is not Source
-
+
# and collect attributes for this
collectAttributes(attributes, widget, skin_path_prefix, ignore=['name'])
elif wsource:
screen.renderer.append(renderer)
+ from Components.GUIComponent import GUIComponent
+ nonvisited_components = [x for x in set(screen.keys()) - visited_components if isinstance(x, GUIComponent)]
+
+ assert not nonvisited_components, "the following components in %s don't have a skin entry: %s" % (name, ', '.join(nonvisited_components))
+
# now walk additional objects
for widget in elementsWithTag(myscreen.childNodes, lambda x: x != "widget"):
if widget.tagName == "applet":