X-Git-Url: http://code.vuplus.com/gitweb/?p=vuplus_dvbapp;a=blobdiff_plain;f=lib%2Fpython%2FComponents%2FLabel.py;h=49e94e6e34ed5c6e5b1f0936fd6c2d2ede0df3d5;hp=4d90badc58b03085fc6aab0eb739ec138c70cb16;hb=36cca1d3f31265929ef3443999ab7fd242b4dae5;hpb=c0d78035b8c76e719bf7c05ff3812eb5a6ce9fe3 diff --git a/lib/python/Components/Label.py b/lib/python/Components/Label.py index 4d90bad..49e94e6 100644 --- a/lib/python/Components/Label.py +++ b/lib/python/Components/Label.py @@ -1,8 +1,8 @@ -from HTMLComponent import * -from GUIComponent import * -from VariableText import * - -from ConditionalWidget import * +from HTMLComponent import HTMLComponent +from GUIComponent import GUIComponent +from VariableText import VariableText +from skin import parseColor +from ConditionalWidget import ConditionalWidget, BlinkingWidget, BlinkingWidgetConditional from enigma import eLabel @@ -37,3 +37,55 @@ class BlinkingLabelConditional(BlinkingWidgetConditional, LabelConditional): def __init__(self, text = ""): LabelConditional.__init__(self, text = text) BlinkingWidgetConditional.__init__(self) + +class MultiColorLabel(Label): + def __init__(self, text=""): + Label.__init__(self,text) + self.foreColors = [] + self.backColors = [] + + def applySkin(self, desktop, screen): + if self.skinAttributes is not None: + foregroundColor = None + backgroundColor = None + attribs = [ ] + for (attrib, value) in self.skinAttributes: + if attrib == "foregroundColors": + colors = value.split(',') + for color in colors: + self.foreColors.append(parseColor(color)) + if not foregroundColor: + foregroundColor = colors[0] + elif attrib == "backgroundColors": + colors = value.split(',') + for color in colors: + self.backColors.append(parseColor(color)) + if not backgroundColor: + backgroundColor = colors[0] + elif attrib == "backgroundColor": + backgroundColor = value + elif attrib == "foregroundColor": + foregroundColor = value + else: + attribs.append((attrib,value)) + if foregroundColor: + attribs.append(("foregroundColor",foregroundColor)) + if backgroundColor: + attribs.append(("backgroundColor",backgroundColor)) + self.skinAttributes = attribs + return GUIComponent.applySkin(self, desktop, screen) + + def setForegroundColorNum(self, x): + if self.instance: + if len(self.foreColors) > x: + self.instance.setForegroundColor(self.foreColors[x]) + else: + print "setForegroundColorNum(%d) failed! defined colors:" %(x), self.foreColors + + def setBackgroundColorNum(self, x): + if self.instance: + if len(self.backColors) > x: + self.instance.setBackgroundColor(self.backColors[x]) + else: + print "setBackgroundColorNum(%d) failed! defined colors:" %(x), self.backColors +