2 ## Picon renderer by Gruffy .. some speedups by Ghost
4 from Renderer import Renderer
5 from enigma import ePixmap
6 from Tools.Directories import pathExists, fileExists, SCOPE_SKIN_IMAGE, resolveFilename
11 searchPaths = ['/usr/share/enigma2/picon/',
17 Renderer.__init__(self)
21 def changed(self, what):
24 if what[0] != self.CHANGED_CLEAR:
25 sname = self.source.text
26 # strip all after last :
27 pos = sname.rfind(':')
29 sname = sname[:pos].rstrip(':').replace(':','_')
30 pngname = self.nameCache.get(sname, "")
32 pngname = self.findPicon(sname)
34 self.nameCache[sname] = pngname
35 if pngname == "": # no picon for service found
36 pngname = self.nameCache.get("default", "")
37 if pngname == "": # no default yet in cache..
38 pngname = self.findPicon("picon_default")
39 if pngname == "": # Fallback to enigma2 logo
40 pngname = resolveFilename(SCOPE_SKIN_IMAGE, "skin_default/enigma2.png")
41 self.nameCache["default"] = pngname
42 if self.pngname != pngname:
43 self.instance.setPixmapFromFile(pngname)
44 self.pngname = pngname
46 def findPicon(self, serviceName):
47 for path in self.searchPaths:
48 pngname = path + serviceName + ".png"
49 if fileExists(pngname):