fixes bug #362
[enigma2.git] / lib / python / Components / ScrollLabel.py
index c7e41c7cd25f744fb5b2ca9dd21e5948e4abf64e..46d22abc6451c2ebb3878d777a6c4e305b71178a 100644 (file)
@@ -13,11 +13,25 @@ class ScrollLabel(HTMLComponent, GUIComponent):
                self.pages = None
                self.total = None
 
                self.pages = None
                self.total = None
 
-       def applySkin(self, desktop):
-               skin.applyAllAttributes(self.long_text, desktop, self.skinAttributes)
+       def applySkin(self, desktop, parent):
+               ret = False
+               if self.skinAttributes is not None:
+                       skin.applyAllAttributes(self.long_text, desktop, self.skinAttributes, parent.scale)
+                       widget_attribs = [ ]
+                       scrollbar_attribs = [ ]
+                       for (attrib, value) in self.skinAttributes:
+                               if attrib.find("borderColor") != -1 or attrib.find("borderWidth") != -1:
+                                       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, 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())
                lineheight=fontRenderClass.getInstance().getLineHeight( self.long_text.getFont() )
                s = self.long_text.size()
                self.instance.move(self.long_text.position())
                lineheight=fontRenderClass.getInstance().getLineHeight( self.long_text.getFont() )
+               if not lineheight:
+                       lineheight = 30 # assume a random lineheight if nothing is visible
                lines = (int)(s.height() / lineheight)
                self.pageHeight = (int)(lines * lineheight)
                self.instance.resize(eSize(s.width(), self.pageHeight+(int)(lineheight/6)))
                lines = (int)(s.height() / lineheight)
                self.pageHeight = (int)(lines * lineheight)
                self.instance.resize(eSize(s.width(), self.pageHeight+(int)(lineheight/6)))
@@ -29,10 +43,11 @@ class ScrollLabel(HTMLComponent, GUIComponent):
                self.long_text.move(ePoint(0,0))
                self.long_text.resize(eSize(s.width()-30, self.pageHeight*16))
                self.setText(self.message)
                self.long_text.move(ePoint(0,0))
                self.long_text.resize(eSize(s.width()-30, self.pageHeight*16))
                self.setText(self.message)
+               return ret
 
        def setText(self, text):
                self.message = text
 
        def setText(self, text):
                self.message = text
-               if self.long_text is not None:
+               if self.long_text is not None and self.pageHeight:
                        self.long_text.move(ePoint(0,0))
                        self.long_text.setText(self.message)
                        text_height=self.long_text.calculateSize().height()
                        self.long_text.move(ePoint(0,0))
                        self.long_text.setText(self.message)
                        text_height=self.long_text.calculateSize().height()