Skip to content

Commit

Permalink
[ServiceList]
Browse files Browse the repository at this point in the history
* fix print_exception
* fix resolveColor
  • Loading branch information
jbleyel committed Sep 1, 2024
1 parent d608e41 commit b2a95b4
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions lib/python/Components/ServiceList.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@

from Components.GUIComponent import GUIComponent
from Components.config import config
from Components.MultiContent import __resolveColor, MultiContentEntryProgress, MultiContentEntryText, MultiContentEntryRectangle, MultiContentEntryLinearGradient, MultiContentEntryLinearGradientAlphaBlend
from Components.MultiContent import MultiContentEntryProgress, MultiContentEntryText, MultiContentEntryRectangle, MultiContentEntryLinearGradient, MultiContentEntryLinearGradientAlphaBlend
from Components.Renderer.Picon import getPiconName
import NavigationInstance
from ServiceReference import ServiceReference
Expand Down Expand Up @@ -1203,6 +1203,15 @@ def buildEntry(self, service, status):
# 128 isFolder
# 256 isInBouquet

def resolveColor(color):
if isinstance(color, str):
try:
return parseColor(color).argb()
except Exception as err:
print(f"[ServiceList] Error: Resolve color '{err}'")
return None
return color

def getRecordColors(foreColor, foreColorSelected, status, defaults, attributes):
if self.recordIndicatorMode == 2 and (status & 2) == 0: # don't set extra colors if marked
isRecorded = status & 16
Expand Down Expand Up @@ -1365,9 +1374,9 @@ def getColor(defaults, attributes, serviceAvail, marked):
pixmapFlags = item.get("pixmapFlags", 0)

if backgroundColor:
backgroundColor = __resolveColor(backgroundColor)
backgroundColor = resolveColor(backgroundColor)
if backgroundColorSelected:
backgroundColorSelected = __resolveColor(backgroundColorSelected)
backgroundColorSelected = resolveColor(backgroundColorSelected)

if itemIndex == 2: # Picon
picon = self.buildOptionEntryServicePicon(service)
Expand Down Expand Up @@ -1405,6 +1414,6 @@ def getColor(defaults, attributes, serviceAvail, marked):

except Exception:
import traceback
traceback.print_exception()
traceback.print_exc()

return res

0 comments on commit b2a95b4

Please sign in to comment.