diff --git a/doc/AUTOMATICBUTTONS b/doc/AUTOMATICBUTTONS
index fdefc5cf5b8..c0f84cd0ead 100644
--- a/doc/AUTOMATICBUTTONS
+++ b/doc/AUTOMATICBUTTONS
@@ -24,13 +24,15 @@ in the screens correctly as if we had added them manually to every single screen
alignment="left"
zPosition="2"
spacing="10"
- spacingPixmapText="10" />
+ spacingPixmapText="10"
+ buttonCornerRadius="6" />
Attributes:
connection: comma separated list of the buttons this widget will control.
pixmaps: comma separated list that contains "key_name" then a ":" then the path to the graphic to be used.
spacing: is the spacing between the text and the next button.
spacingPixmapText: is the spacing between the graphic and the text.
+ buttonCornerRadius (optional): add rounding to corners.
By default the foreground text color will be the same as the default listbox text color. But this can be altered for each
button with the "textColors" attribute.
@@ -52,7 +54,8 @@ Example widget with colored text:
alignment="left"
zPosition="2"
spacing="10"
- spacingPixmapText="10" />
+ spacingPixmapText="10"
+ buttonCornerRadius="6" />
It is also possible to have colored text and no graphics:
@@ -67,7 +70,41 @@ It is also possible to have colored text and no graphics:
transparent="1"
alignment="left"
zPosition="2"
- spacing="10" />
+ spacing="10"
+ buttonCornerRadius="6" />
+
+Superimpose text over the graphic rather that have the graphic to the side of the text.
+
+
+
+Superimpose texted over a coloured background (no graphic).
+
+
=========================================================================================================================================================================
@@ -85,7 +122,7 @@ It is also possible to have colored text and no graphics:
Attributes:
connection: comma separated list of the buttons this widget will control.
pixmaps: comma separated list that contains "key_name" then a ":" then the path to the graphic to be used.
- spacing: is the spacing between the text and the next button.
+ spacing: is the spacing between buttons.
In "connection" and "pixmap" add the buttons you want this widget to display.
diff --git a/lib/python/Components/Addons/ColorButtonsSequence.py b/lib/python/Components/Addons/ColorButtonsSequence.py
index 160d4218cec..7606844a2e2 100644
--- a/lib/python/Components/Addons/ColorButtonsSequence.py
+++ b/lib/python/Components/Addons/ColorButtonsSequence.py
@@ -1,10 +1,10 @@
from Components.Addons.GUIAddon import GUIAddon
-from enigma import eListbox, eListboxPythonMultiContent, BT_ALIGN_CENTER, RT_VALIGN_CENTER, RT_HALIGN_LEFT, eSize, getDesktop, gFont
+from enigma import eListbox, eListboxPythonMultiContent, BT_ALIGN_CENTER, RT_VALIGN_CENTER, RT_HALIGN_LEFT, RT_HALIGN_CENTER, BT_SCALE, eSize, getDesktop, gFont
from skin import parseScale, parseColor, parseFont, applySkinFactor
-from Components.MultiContent import MultiContentEntryPixmapAlphaBlend
+from Components.MultiContent import MultiContentEntryPixmapAlphaBlend, MultiContentEntryText
from Components.Label import Label
from Tools.Directories import resolveFilename, SCOPE_GUISKIN
@@ -26,7 +26,9 @@ def __init__(self):
self.colorIndicatorStyle = "pixmap"
self.orientations = {"orHorizontal": eListbox.orHorizontal, "orVertical": eListbox.orVertical}
self.orientation = eListbox.orHorizontal
+ self.renderType = "ImageTextRight" # Currently supported are ImageTextRight, ImageTextOver and ColorTextOver
self.alignment = "left"
+ self.cornerRadius = 0
self.pixmaps = {}
self.colors = {}
self.textRenderer = Label("")
@@ -62,9 +64,15 @@ def buildEntry(self, sequence):
for x, val in sequence.items():
textColor = self.foreColor
+ buttonBgColor = self.foreColor
+
if x in self.colors:
- textColor = parseColor(self.colors[x]).argb()
- if x in self.pixmaps:
+ if self.renderType == "ImageTextRight":
+ textColor = parseColor(self.colors[x]).argb()
+ else:
+ buttonBgColor = parseColor(self.colors[x]).argb()
+
+ if self.renderType != "ImageTextOver" and x in self.pixmaps:
pic = LoadPixmap(resolveFilename(SCOPE_GUISKIN, self.pixmaps[x]))
if pic:
pixd_size = pic.size()
@@ -92,11 +100,34 @@ def buildEntry(self, sequence):
if textWidth < (minSectorWidth - self.spacingButtons - (self.spacingPixmapText if pic else 0) - pixd_width):
textWidth = minSectorWidth - self.spacingButtons - (self.spacingPixmapText if pic else 0) - pixd_width
if buttonText:
- if textColor is not None:
- res.append((eListboxPythonMultiContent.TYPE_TEXT, xPos, yPos, textWidth, height - 2, 0, RT_HALIGN_LEFT | RT_VALIGN_CENTER, buttonText, textColor))
+ textFlags = RT_HALIGN_LEFT | RT_VALIGN_CENTER
+ textPaddings = 0
+ backColor = None
+ if self.renderType in ["ColorTextOver", "ImageTextOver"]:
+ textFlags = RT_HALIGN_CENTER | RT_VALIGN_CENTER
+ textPaddings = self.spacingPixmapText
+ backColor = buttonBgColor
+
+ if self.renderType == "ImageTextOver":
+ if x in self.pixmaps:
+ pic = LoadPixmap(resolveFilename(SCOPE_GUISKIN, self.pixmaps[x]))
+ if pic:
+ res.append(MultiContentEntryPixmapAlphaBlend(
+ pos=(xPos, yPos),
+ size=(textWidth + textPaddings * 2, height),
+ png=pic,
+ backcolor=0x000000, backcolor_sel=None, flags=BT_SCALE, corner_radius=self.cornerRadius))
+ res.append(MultiContentEntryText(
+ pos=(xPos + textPaddings, yPos), size=(textWidth, height - 2),
+ font=0, flags=textFlags,
+ text=buttonText, color=textColor, color_sel=textColor))
else:
- res.append((eListboxPythonMultiContent.TYPE_TEXT, xPos, yPos, textWidth, height - 2, 0, RT_HALIGN_LEFT | RT_VALIGN_CENTER, buttonText))
- xPos += textWidth + self.spacingButtons
+ res.append(MultiContentEntryText(
+ pos=(xPos, yPos), size=(textWidth + textPaddings * 2, height - 2),
+ font=0, flags=textFlags,
+ text=buttonText, color=textColor, color_sel=textColor, backcolor=backColor, corner_radius=self.cornerRadius))
+
+ xPos += textWidth + textPaddings * 2 + self.spacingButtons
if xPos > width and self.layoutStyle != "fluid":
self.layoutStyle = "fluid"
return self.buildEntry(sequence)
@@ -138,11 +169,15 @@ def applySkin(self, desktop, parent):
self.instance.setOrientation(eListbox.orHorizontal)
self.l.setOrientation(eListbox.orHorizontal)
elif attrib == "font":
- self.font = parseFont(value, ((1, 1), (1, 1)))
+ self.font = parseFont(value, parent.scale)
elif attrib == "foregroundColor":
self.foreColor = parseColor(value).argb()
elif attrib == "textColors":
self.colors = dict(item.split(':') for item in value.split(','))
+ elif attrib == "buttonCornerRadius":
+ self.cornerRadius = parseScale(value)
+ elif attrib == "renderType":
+ self.renderType = value
else:
attribs.append((attrib, value))
self.skinAttributes = attribs
diff --git a/lib/python/Components/Addons/MainMenu.py b/lib/python/Components/Addons/MainMenu.py
index 3105951295e..f401406e00c 100644
--- a/lib/python/Components/Addons/MainMenu.py
+++ b/lib/python/Components/Addons/MainMenu.py
@@ -27,7 +27,6 @@ def __init__(self):
self.longestMenuTextWidth = 0
self.minWidth = 100
self.maxWidth = 700
-
def onContainerShown(self):
self.textRenderer.GUIcreate(self.relatedScreen.instance)
@@ -35,11 +34,10 @@ def onContainerShown(self):
self.constructMenu()
GUI_WIDGET = eListbox
-
-
+
def getDesktopWith(self):
return getDesktop(0).size().width()
-
+
def _calcTextWidth(self, text, font=None, size=None):
if size:
self.textRenderer.instance.resize(size)
@@ -80,20 +78,16 @@ def moveSelection(self, index):
def selectionChanged(self):
if self.instance and hasattr(self, "source"):
self.source.setConnectedGuiElement(self)
-
- def setFont(self, value):
- self.font = parseFont(value, ((1, 1), (1, 1)))
- self.l.setFont(0, self.font)
def setMinWidth(self, value):
self.minWidth = parseScale(value)
def setMaxWidth(self, value):
self.maxWidth = parseScale(value)
-
+
def setIconSize(self, value):
self.iconSize = parseScale(value)
-
+
def setForegroundColor(self, value):
self.foregroundColor = parseColor(value).argb()
@@ -123,8 +117,8 @@ def constructMenu(self):
if textWidth > self.longestMenuTextWidth:
self.longestMenuTextWidth = textWidth
curSize = self.instance.size()
- dest_width = self.iconSize + 20*2 + 10
- dest_width += self.longestMenuTextWidth
+ dest_width = self.iconSize + 20 * 2 + 10
+ dest_width += self.longestMenuTextWidth
if dest_width > self.maxWidth:
dest_width = self.maxWidth
if dest_width > self.minWidth:
@@ -136,7 +130,7 @@ def applySkin(self, desktop, parent):
attribs = []
for (attrib, value) in self.skinAttributes[:]:
if attrib == "font":
- self.font = parseFont(value, ((1, 1), (1, 1)))
+ self.font = parseFont(value, parent.scale)
elif attrib == "foregroundColor":
self.foregroundColor = parseColor(value).argb()
elif attrib == "foregroundColorSelected":
diff --git a/lib/python/Components/Addons/Pager.py b/lib/python/Components/Addons/Pager.py
index 374f7dddb12..880b1a1100e 100644
--- a/lib/python/Components/Addons/Pager.py
+++ b/lib/python/Components/Addons/Pager.py
@@ -42,7 +42,7 @@ def onContainerShown(self):
if isinstance(onSelectionChanged, list) and self.initPager not in onSelectionChanged:
onSelectionChanged.append(self.initPager)
-
+
self.initPager()
GUI_WIDGET = eListbox
@@ -251,7 +251,7 @@ def applySkin(self, desktop, parent):
elif attrib == "showIcons":
self.showIcons = value
elif attrib == "maxPages":
- self.max_pages = parseScale(value)
+ self.max_pages = int(value)
elif attrib == "orientation":
self.orientation = self.orientations.get(value, self.orientations["orHorizontal"])
if self.orientation == eListbox.orHorizontal:
diff --git a/lib/python/Components/Addons/ScreenHeader.py b/lib/python/Components/Addons/ScreenHeader.py
index 05c627363f2..0a686ecf027 100644
--- a/lib/python/Components/Addons/ScreenHeader.py
+++ b/lib/python/Components/Addons/ScreenHeader.py
@@ -9,7 +9,6 @@
from Components.Pixmap import Pixmap
-
class ScreenHeader(GUIAddon):
def __init__(self):
GUIAddon.__init__(self)
@@ -47,19 +46,19 @@ def buildEntry(self, sequence):
textItemsOffset = -1
res = [None]
-
+
for idx, x in enumerate(sequence):
if isinstance(x, StaticText):
textItemsCount += 1
if textItemsOffset == -1:
textItemsOffset = idx
-
+
isOneItem = textItemsCount == 1
-
+
itemHeight = self.instance.size().height()
-
+
for idx, x in enumerate(sequence):
- if not isinstance(x, StaticText): # assume it is Pixmap
+ if not isinstance(x, StaticText): # assume it is Pixmap
if x.pixmap:
itemHeight = self.instance.size().height()
pix_size = x.pixmap.size()
@@ -81,7 +80,7 @@ def buildEntry(self, sequence):
elif idx == 1 + textItemsOffset:
yPos = self.instance.size().height() * 2 // 3 - 5
itemHeight = self.instance.size().height() // 3
-
+
fontIndex = 2 if isOneItem and idx == textItemsOffset else idx - textItemsOffset
res.append(MultiContentEntryText(
@@ -114,11 +113,11 @@ def applySkin(self, desktop, parent):
attribs = []
for (attrib, value) in self.skinAttributes[:]:
if attrib == "titleFont":
- self.titleFont = parseFont(value, ((1, 1), (1, 1)))
+ self.titleFont = parseFont(value, parent.scale)
if attrib == "titleSingleFont":
- self.titleSingleFont = parseFont(value, ((1, 1), (1, 1)))
+ self.titleSingleFont = parseFont(value, parent.scale)
elif attrib == "pathFont":
- self.pathFont = parseFont(value, ((1, 1), (1, 1)))
+ self.pathFont = parseFont(value, parent.scale)
elif attrib == "titleForegroundColor":
self.titleForeground = parseColor(value).argb()
elif attrib == "pathForegroundColor":
diff --git a/lib/python/Components/Addons/ServiceInfoBar.py b/lib/python/Components/Addons/ServiceInfoBar.py
index 54b3ad847c8..b326ec54def 100644
--- a/lib/python/Components/Addons/ServiceInfoBar.py
+++ b/lib/python/Components/Addons/ServiceInfoBar.py
@@ -1,17 +1,15 @@
-from Components.Addons.GUIAddon import GUIAddon
-
from enigma import eListbox, eListboxPythonMultiContent, BT_ALIGN_CENTER, iPlayableService, iRecordableService, eServiceReference, iServiceInformation, gFont, RT_HALIGN_LEFT, RT_VALIGN_CENTER, RT_VALIGN_TOP, RT_HALIGN_CENTER, eTimer, getDesktop, eSize, eStreamServer
from skin import parseScale, applySkinFactor, parseColor, parseFont, parameters
-from Components.MultiContent import MultiContentEntryPixmapAlphaBlend, MultiContentEntryText
-from Components.ServiceEventTracker import ServiceEventTracker
+from Components.Addons.GUIAddon import GUIAddon
+from Components.Converter.PliExtraInfo import createCurrentCaidLabel
from Components.Converter.ServiceInfo import getVideoHeight
from Components.Converter.VAudioInfo import StdAudioDesc
-from Components.Converter.PliExtraInfo import createCurrentCaidLabel
from Components.Label import Label
+from Components.MultiContent import MultiContentEntryPixmapAlphaBlend, MultiContentEntryText
+from Components.ServiceEventTracker import ServiceEventTracker
from Components.Sources.StreamService import StreamServiceList
from Components.NimManager import nimmanager
-from Components.config import config
from Screens.InfoBarGenerics import hasActiveSubservicesForCurrentChannel
from Tools.Directories import resolveFilename, SCOPE_GUISKIN
from Tools.LoadPixmap import LoadPixmap
@@ -106,8 +104,9 @@ def gotRecordEvent(self, service, event):
self.updateAddon()
def scheduleAddonUpdate(self):
- self.refreshAddon.stop()
- self.refreshAddon.start(350)
+ if hasattr(self, "refreshAddon"):
+ self.refreshAddon.stop()
+ self.refreshAddon.start(300)
def checkCrypto_update(self):
if NavigationInstance.instance is not None:
@@ -145,11 +144,11 @@ def detectVisible(self, key):
service = self.nav.getCurrentService()
info = service and service.info()
isRef = isinstance(service, eServiceReference)
- #self.current_info = info
+ # self.current_info = info
if not info:
return None
video_height = None
- video_aspect = None
+ # video_aspect = None
video_height = getVideoHeight(info)
if key == "videoRes":
if video_height >= 720 and video_height < 1500:
@@ -348,7 +347,7 @@ def applySkin(self, desktop, parent):
elif attrib == "autoresizeMode":
self.autoresizeMode = value
elif attrib == "font":
- self.font = parseFont(value, ((1, 1), (1, 1)))
+ self.font = parseFont(value, parent.scale)
elif attrib == "foregroundColor":
self.foreColor = parseColor(value).argb()
elif attrib == "textBackColor":