From a01b52be8469eb9fd10d2f31870d7d9970c5d974 Mon Sep 17 00:00:00 2001 From: Andreas Monzner Date: Tue, 10 Jun 2008 09:49:13 +0000 Subject: add MultiPixmap... like MultiColorLabel --- lib/python/Components/Pixmap.py | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) (limited to 'lib/python/Components/Pixmap.py') diff --git a/lib/python/Components/Pixmap.py b/lib/python/Components/Pixmap.py index f6ecaf0c..02eeb870 100644 --- a/lib/python/Components/Pixmap.py +++ b/lib/python/Components/Pixmap.py @@ -3,6 +3,10 @@ from GUIComponent import GUIComponent from enigma import ePixmap, eTimer +from Tools.Directories import resolveFilename, SCOPE_SKIN_IMAGE +from os import path +from skin import loadPixmap + class Pixmap(GUIComponent): GUI_WIDGET = ePixmap @@ -76,3 +80,36 @@ class MovingPixmap(Pixmap): else: self.moving = False self.startMoving() + +class MultiPixmap(Pixmap): + def __init__(self): + Pixmap.__init__(self) + self.pixmaps = [] + + def applySkin(self, desktop, screen): + if self.skinAttributes is not None: + skin_path_prefix = getattr(screen, "skin_path", path) + pixmap = None + attribs = [ ] + for (attrib, value) in self.skinAttributes: + if attrib == "pixmaps": + pixmaps = value.split(',') + for pixmap in pixmaps: + self.pixmaps.append(loadPixmap(resolveFilename(SCOPE_SKIN_IMAGE, pixmap, path_prefix=skin_path_prefix), desktop) ) + if not pixmap: + pixmap = resolveFilename(SCOPE_SKIN_IMAGE, pixmaps[0], path_prefix=skin_path_prefix) + elif attrib == "pixmap": + pixmap = resolveFilename(SCOPE_SKIN_IMAGE, value, path_prefix=skin_path_prefix) + else: + attribs.append((attrib,value)) + if pixmap: + attribs.append(("pixmap", pixmap)) + self.skinAttributes = attribs + return GUIComponent.applySkin(self, desktop, screen) + + def setPixmapNum(self, x): + if self.instance: + if len(self.pixmaps) > x: + self.instance.setPixmap(self.pixmaps[x]) + else: + print "setPixmapNum(%d) failed! defined pixmaps:" %(x), self.pixmaps -- cgit v1.2.3