diff --git a/lib/python/Components/Converter/EventName.py b/lib/python/Components/Converter/EventName.py index cd427b6047a..b059d2693d1 100644 --- a/lib/python/Components/Converter/EventName.py +++ b/lib/python/Components/Converter/EventName.py @@ -343,7 +343,7 @@ def getText(self): rating = c[self.RATNORMAL].get(age, c[self.RATDEFAULT](age)) ageText = rating[self.RATSHORT].strip().replace("+", "") color = rating[self.RATCOLOR] - return "%s;%s" % (ageText, hex(color)) + return f"{ageText};#{color:08X}" elif self.type == self.FORMAT_STRING: begin = event.getBeginTime() end = begin + event.getDuration() diff --git a/lib/python/Components/Renderer/RatingIconLabel.py b/lib/python/Components/Renderer/RatingIconLabel.py index 5ee8331b86e..874f45f7828 100644 --- a/lib/python/Components/Renderer/RatingIconLabel.py +++ b/lib/python/Components/Renderer/RatingIconLabel.py @@ -9,6 +9,8 @@ def __init__(self): self.colors = {} self.extendDirection = "right" self.sidesMargin = 20 + self.initialWidth = 0 + self.initialXPos = 0 GUI_WIDGET = eLabel @@ -28,6 +30,8 @@ def applySkin(self, desktop, parent): attribs.append((attrib, value)) self.skinAttributes = attribs result = Renderer.applySkin(self, desktop, parent) + self.initialWidth = self.instance.size().width() + self.initialXPos = self.instance.position().x() self.changed((self.CHANGED_DEFAULT,)) return result @@ -51,16 +55,13 @@ def changed(self, what): self.hideLabel() return ageText = split_text[0] - color = int(split_text[1], 16) + color = parseColor(split_text[1]) else: - try: - age = int(self.source.text.replace("+", "")) - if age <= 15: - age += 3 - ageText = str(age) - color = self.colors.get(age, 0x10000000) - except: - pass + age = int(self.source.text.replace("+", "")) + if age <= 15: + age += 3 + ageText = str(age) + color = self.colors.get(age, 0x10000000) size = self.instance.size() pos = self.instance.position() @@ -69,11 +70,11 @@ def changed(self, what): textSize = self.instance.calculateSize() self.instance.setNoWrap(0) newWidth = textSize.width() + self.sidesMargin - if newWidth < size.width(): - newWidth = size.width() + if newWidth < self.initialWidth: + newWidth = self.initialWidth if self.extendDirection == "left": - rightEdgePos = pos.x() + size.width() + rightEdgePos = self.initialXPos + self.initialWidth self.move(rightEdgePos - newWidth, pos.y()) if self.extendDirection != "none":