Converter/ValueToPixmap.py, Renderer/Pixmap.py: use cache for LoadPixmap inside Value...
authorMladen Horvat <acid-burn@opendreambox.org>
Tue, 19 Apr 2011 10:08:09 +0000 (12:08 +0200)
committerMladen Horvat <acid-burn@opendreambox.org>
Tue, 19 Apr 2011 10:08:09 +0000 (12:08 +0200)
lib/python/Components/Converter/ValueToPixmap.py
lib/python/Components/Renderer/Pixmap.py

index 2ab695a..ed9f770 100644 (file)
@@ -24,11 +24,11 @@ class ValueToPixmap(Converter, object):
                        if val in (None, ""):
                                return None
                if self.type == self.PATH:
-                       return LoadPixmap(val)
+                       return LoadPixmap(cached=True, path=val)
                if self.type == self.LANGUAGE_CODE:
-                       png = LoadPixmap(resolveFilename(SCOPE_CURRENT_SKIN, "countries/" + val[3:].lower() + ".png"))
+                       png = LoadPixmap(cached=True, path=resolveFilename(SCOPE_CURRENT_SKIN, "countries/" + val[3:].lower() + ".png"))
                        if png == None:
-                               png = LoadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, "countries/missing.png"))
+                               png = LoadPixmap(cached=True, path=resolveFilename(SCOPE_SKIN_IMAGE, "countries/missing.png"))
                        return png
                return None                     
        
index d67cd55..7c6b579 100644 (file)
@@ -3,4 +3,17 @@ from Renderer import Renderer
 from enigma import ePixmap
 
 class Pixmap(Renderer):
+       def __init__(self):
+               Renderer.__init__(self)
+
        GUI_WIDGET = ePixmap
+
+       def postWidgetCreate(self, instance):
+               self.changed((self.CHANGED_DEFAULT,))
+
+       def changed(self, what):
+               if what[0] != self.CHANGED_CLEAR:
+                       if self.source and hasattr(self.source, "pixmap"):
+                               if self.instance:
+                                       self.instance.setPixmap(self.source.pixmap)
+