handle case of empty text
[enigma2.git] / lib / python / Components / ScrollLabel.py
index d5924b8..253353b 100644 (file)
@@ -17,10 +17,21 @@ class ScrollLabel(HTMLComponent, GUIComponent):
                ret = False
                if self.skinAttributes is not None:
                        skin.applyAllAttributes(self.long_text, desktop, self.skinAttributes)
+                       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)
+                       skin.applyAllAttributes(self.scrollbar, desktop, scrollbar_attribs+widget_attribs)
                        ret = True
                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)))