def Load(self, node): self.sr.leftmargin.width = node.Get('leftmargin', 0) self.sr.rightmargin.width = node.Get('rightmargin', 0) self.sr.line.Flush() Fill(parent=self.sr.line, color=ParseHTMLColor(node.attrs.color or '#88ffffff', 1)) align = uiconst.RELATIVE if node.attrs.width: if unicode(node.attrs.width).endswith('%'): node.attrs.width = self.sr.node.scroll.GetContentWidth() * int( node.attrs.width[:-1]) / 100 self.sr.line.width = int(node.attrs.width) if node.attrs.align and node.attrs.align.lower() in ('left', 'right'): if node.attrs.align.lower() == 'right': align = uiconst.TORIGHT else: align = uiconst.TOLEFT elif node.attrs.align is None: align = uiconst.RELATIVE else: align = uiconst.CENTER else: self.sr.line.left = self.sr.line.width = 0 align = uiconst.TOALL self.sr.line.SetAlign(align)
def ParseBackground(self, k, v): for each in v.split(' '): each = each.replace(' ', '').lower() if each.find('url(') != -1: self.ParseBackgroundImage(None, each) elif each.find('repeat') != -1: self.ParseBackgroundRepeat(None, each) elif v: color = ParseHTMLColor(each, 1, error=1) if color: self.s['background-color'] = color
def ParseColor(self, k, v): if v: v = ParseHTMLColor(v, 1, error=1) if v: self.s[k] = v
def ParseBorderColor(self, k, v): if v: v = ParseHTMLColor(v, 1, error=1) if v: self.s['border-left-color'] = self.s['border-right-color'] = v self.s['border-top-color'] = self.s['border-bottom-color'] = v