2 ## Picon renderer by Gruffy .. some speedups by Ghost
4 from Renderer import Renderer
5 from enigma import ePixmap, eEnv
6 from Tools.Directories import fileExists, SCOPE_SKIN_IMAGE, SCOPE_CURRENT_SKIN, resolveFilename
9 searchPaths = (eEnv.resolve('${datadir}/enigma2/%s/'),
14 Renderer.__init__(self)
19 def applySkin(self, desktop, parent):
21 for (attrib, value) in self.skinAttributes:
25 attribs.append((attrib,value))
26 self.skinAttributes = attribs
27 return Renderer.applySkin(self, desktop, parent)
31 def changed(self, what):
34 if what[0] != self.CHANGED_CLEAR:
35 sname = self.source.text
36 # strip all after last :
37 pos = sname.rfind(':')
39 sname = sname[:pos].rstrip(':').replace(':','_')
40 pngname = self.nameCache.get(sname, "")
42 pngname = self.findPicon(sname)
44 self.nameCache[sname] = pngname
45 if pngname == "": # no picon for service found
46 pngname = self.nameCache.get("default", "")
47 if pngname == "": # no default yet in cache..
48 pngname = self.findPicon("picon_default")
50 tmp = resolveFilename(SCOPE_CURRENT_SKIN, "picon_default.png")
54 pngname = resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/picon_default.png")
55 self.nameCache["default"] = pngname
56 if self.pngname != pngname:
57 self.instance.setPixmapFromFile(pngname)
58 self.pngname = pngname
60 def findPicon(self, serviceName):
61 for path in self.searchPaths:
62 pngname = (path % self.path) + serviceName + ".png"
63 if fileExists(pngname):