aboutsummaryrefslogtreecommitdiff
path: root/lib/python/Components
diff options
context:
space:
mode:
Diffstat (limited to 'lib/python/Components')
-rw-r--r--lib/python/Components/GUIComponent.py17
-rw-r--r--lib/python/Components/GUISkin.py44
-rw-r--r--lib/python/Components/Renderer/Picon.py4
-rw-r--r--lib/python/Components/Renderer/Pig.py6
-rw-r--r--lib/python/Components/ScrollLabel.py8
-rw-r--r--lib/python/Components/ServiceList.py4
6 files changed, 57 insertions, 26 deletions
diff --git a/lib/python/Components/GUIComponent.py b/lib/python/Components/GUIComponent.py
index a3b1b9e1..b67937e4 100644
--- a/lib/python/Components/GUIComponent.py
+++ b/lib/python/Components/GUIComponent.py
@@ -1,6 +1,6 @@
import skin
-from enigma import ePoint
+from enigma import ePoint, eSize
class GUIComponent(object):
""" GUI component """
@@ -29,14 +29,14 @@ class GUIComponent(object):
self.__dict__.clear()
# this works only with normal widgets - if you don't have self.instance, override this.
- def applySkin(self, desktop):
+ def applySkin(self, desktop, parent):
if not self.visible:
self.instance.hide()
if self.skinAttributes is None:
return False
- skin.applyAllAttributes(self.instance, desktop, self.skinAttributes)
+ skin.applyAllAttributes(self.instance, desktop, self.skinAttributes, parent.scale)
return True
def move(self, x, y = None):
@@ -45,10 +45,13 @@ class GUIComponent(object):
self.instance.move(x)
else:
self.instance.move(ePoint(int(x), int(y)))
-
- def resize(self, size):
- self.instance.resize(size)
-
+
+ def resize(self, x, y = None):
+ if y is None:
+ self.instance.resize(x)
+ else:
+ self.instance.resize(eSize(int(x), int(y)))
+
def setZPosition(self, z):
self.instance.setZPosition(z)
diff --git a/lib/python/Components/GUISkin.py b/lib/python/Components/GUISkin.py
index ce4d397d..9eb4a80b 100644
--- a/lib/python/Components/GUISkin.py
+++ b/lib/python/Components/GUISkin.py
@@ -8,20 +8,24 @@ class GUISkin:
def __init__(self):
self.onLayoutFinish = [ ]
self.summaries = CList()
+ self.instance = None
+ self.desktop = None
- def createGUIScreen(self, parent, desktop):
+ def createGUIScreen(self, parent, desktop, updateonly = False):
for val in self.renderer:
if isinstance(val, GUIComponent):
- val.GUIcreate(parent)
- if not val.applySkin(desktop):
+ if not updateonly:
+ val.GUIcreate(parent)
+ if not val.applySkin(desktop, self):
print "warning, skin is missing renderer", val, "in", self
for key in self:
val = self[key]
if isinstance(val, GUIComponent):
- val.GUIcreate(parent)
+ if not updateonly:
+ val.GUIcreate(parent)
depr = val.deprecationInfo
- if val.applySkin(desktop):
+ if val.applySkin(desktop, self):
if depr:
print "WARNING: OBSOLETE COMPONENT '%s' USED IN SKIN. USE '%s' INSTEAD!" % (key, depr[0])
print "OBSOLETE COMPONENT WILL BE REMOVED %s, PLEASE UPDATE!" % (depr[1])
@@ -29,9 +33,10 @@ class GUISkin:
print "warning, skin is missing element", key, "in", self
for w in self.additionalWidgets:
- w.instance = w.widget(parent)
- # w.instance.thisown = 0
- applyAllAttributes(w.instance, desktop, w.skinAttributes)
+ if not updateonly:
+ w.instance = w.widget(parent)
+ # w.instance.thisown = 0
+ applyAllAttributes(w.instance, desktop, w.skinAttributes, self.scale)
for f in self.onLayoutFinish:
if type(f) is not type(self.close): # is this the best way to do this?
@@ -60,3 +65,26 @@ class GUISkin:
self.instance.setTitle(title)
self.title = title
self.summaries.setTitle(title)
+
+ def setDesktop(self, desktop):
+ self.desktop = desktop
+
+ def applySkin(self):
+ z = 0
+ title = ""
+ baseres = (720, 576) # FIXME: a skin might have set another resolution, which should be the base res
+ for (key, value) in self.skinAttributes:
+ if key == "zPosition":
+ z = int(value)
+ elif key == "title":
+ title = value
+ elif key == "baseResolution":
+ baseres = tuple([int(x) for x in value.split(',')])
+ self.scale = ((baseres[0], baseres[0]), (baseres[1], baseres[1]))
+
+ if not self.instance:
+ from enigma import eWindow
+ self.instance = eWindow(self.desktop, z)
+ self.title = title
+ applyAllAttributes(self.instance, self.desktop, self.skinAttributes, self.scale)
+ self.createGUIScreen(self.instance, self.desktop)
diff --git a/lib/python/Components/Renderer/Picon.py b/lib/python/Components/Renderer/Picon.py
index ca934c8e..de19c9aa 100644
--- a/lib/python/Components/Renderer/Picon.py
+++ b/lib/python/Components/Renderer/Picon.py
@@ -16,7 +16,7 @@ class Picon(Renderer):
self.nameCache = { }
self.pngname = ""
- def applySkin(self, desktop):
+ def applySkin(self, desktop, parent):
attribs = [ ]
for (attrib, value) in self.skinAttributes:
if attrib == "path":
@@ -24,7 +24,7 @@ class Picon(Renderer):
else:
attribs.append((attrib,value))
self.skinAttributes = attribs
- return Renderer.applySkin(self, desktop)
+ return Renderer.applySkin(self, desktop, parent)
GUI_WIDGET = ePixmap
diff --git a/lib/python/Components/Renderer/Pig.py b/lib/python/Components/Renderer/Pig.py
index 99488e4a..23e1393d 100644
--- a/lib/python/Components/Renderer/Pig.py
+++ b/lib/python/Components/Renderer/Pig.py
@@ -14,10 +14,10 @@ class Pig(Renderer):
def postWidgetCreate(self, instance):
instance.setDecoder(0)
- def applySkin(self, desktop):
- ret = Renderer.applySkin(self, desktop)
+ def applySkin(self, desktop, parent):
+ ret = Renderer.applySkin(self, desktop, parent)
if ret:
- self.Position = self.instance.position()
+ self.Position = self.instance.position() # fixme, scaling!
self.Size = self.instance.size()
return ret
diff --git a/lib/python/Components/ScrollLabel.py b/lib/python/Components/ScrollLabel.py
index 253353bb..46d22abc 100644
--- a/lib/python/Components/ScrollLabel.py
+++ b/lib/python/Components/ScrollLabel.py
@@ -13,10 +13,10 @@ class ScrollLabel(HTMLComponent, GUIComponent):
self.pages = None
self.total = None
- def applySkin(self, desktop):
+ def applySkin(self, desktop, parent):
ret = False
if self.skinAttributes is not None:
- skin.applyAllAttributes(self.long_text, desktop, self.skinAttributes)
+ skin.applyAllAttributes(self.long_text, desktop, self.skinAttributes, parent.scale)
widget_attribs = [ ]
scrollbar_attribs = [ ]
for (attrib, value) in self.skinAttributes:
@@ -24,8 +24,8 @@ class ScrollLabel(HTMLComponent, GUIComponent):
scrollbar_attribs.append((attrib,value))
if attrib.find("transparent") != -1 or attrib.find("backgroundColor") != -1:
widget_attribs.append((attrib,value))
- skin.applyAllAttributes(self.instance, desktop, widget_attribs)
- skin.applyAllAttributes(self.scrollbar, desktop, scrollbar_attribs+widget_attribs)
+ skin.applyAllAttributes(self.instance, desktop, widget_attribs, parent.scale)
+ skin.applyAllAttributes(self.scrollbar, desktop, scrollbar_attribs+widget_attribs, parent.scale)
ret = True
s = self.long_text.size()
self.instance.move(self.long_text.position())
diff --git a/lib/python/Components/ServiceList.py b/lib/python/Components/ServiceList.py
index ced4b0c3..059b8906 100644
--- a/lib/python/Components/ServiceList.py
+++ b/lib/python/Components/ServiceList.py
@@ -45,7 +45,7 @@ class ServiceList(HTMLComponent, GUIComponent):
self.mode = self.MODE_NORMAL
self.onSelectionChanged = [ ]
- def applySkin(self, desktop):
+ def applySkin(self, desktop, parent):
attribs = [ ]
if self.skinAttributes is not None:
attribs = [ ]
@@ -63,7 +63,7 @@ class ServiceList(HTMLComponent, GUIComponent):
else:
attribs.append((attrib, value))
self.skinAttributes = attribs
- return GUIComponent.applySkin(self, desktop)
+ return GUIComponent.applySkin(self, desktop, parent)
def connectSelChanged(self, fnc):
if not fnc in self.onSelectionChanged: