Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion lib/python/Components/Converter/EventName.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down
25 changes: 13 additions & 12 deletions lib/python/Components/Renderer/RatingIconLabel.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ def __init__(self):
self.colors = {}
self.extendDirection = "right"
self.sidesMargin = 20
self.initialWidth = 0
self.initialXPos = 0

GUI_WIDGET = eLabel

Expand All @@ -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

Expand All @@ -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()
Expand All @@ -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":
Expand Down