class CSSElement(SVGBase): def __init__(self, **kwargs): """kwargs should be a dictionary of dictionaries. Top level keys are CSS selectors, and inner dicts hold the style key : value pairs. >>> from svgplotlib.SVG import SVG >>> cssdict = { '#boxId' : { 'border_color' : 'blue', ... 'border' : '1px solid' } } >>> svg = SVG() >>> svg.Style( **cssdict ) """ from svgplotlib.SVG.CSS import CSS #attrib = MangleDict(kwargs) parent = kwargs.pop( 'parent' ) mroargs = { 'root' : kwargs.pop('root') } super(CSSElement,self).__init__('style', type='text/css', **mroargs) self.styles = CSS(**kwargs) self.text = self.styles.__repr__() parent.append(self.element) def append(self, *args, **kwargs): self.styles.update( *args, **kwargs ) self.text = self.styles.__repr__() @property def text(self): return '<![CDATA[\n{0}\n]]>'.format(self.styles) @text.setter def text(self,value): self.element.text = value @text.deleter def text(self): del(self.element.text)
def __init__(self, **kwargs): """kwargs should be a dictionary of dictionaries. Top level keys are CSS selectors, and inner dicts hold the style key : value pairs. >>> from svgplotlib.SVG import SVG >>> cssdict = { '#boxId' : { 'border_color' : 'blue', ... 'border' : '1px solid' } } >>> svg = SVG() >>> svg.Style( **cssdict ) """ from svgplotlib.SVG.CSS import CSS #attrib = MangleDict(kwargs) parent = kwargs.pop('parent') mroargs = {'root': kwargs.pop('root')} super(CSSElement, self).__init__('style', type='text/css', **mroargs) self.styles = CSS(**kwargs) self.text = self.styles.__repr__() parent.append(self.element)
class CSSElement(SVGBase): def __init__(self, **kwargs): """kwargs should be a dictionary of dictionaries. Top level keys are CSS selectors, and inner dicts hold the style key : value pairs. >>> from svgplotlib.SVG import SVG >>> cssdict = { '#boxId' : { 'border_color' : 'blue', ... 'border' : '1px solid' } } >>> svg = SVG() >>> svg.Style( **cssdict ) """ from svgplotlib.SVG.CSS import CSS #attrib = MangleDict(kwargs) parent = kwargs.pop('parent') mroargs = {'root': kwargs.pop('root')} super(CSSElement, self).__init__('style', type='text/css', **mroargs) self.styles = CSS(**kwargs) self.text = self.styles.__repr__() parent.append(self.element) def append(self, *args, **kwargs): self.styles.update(*args, **kwargs) self.text = self.styles.__repr__() @property def text(self): return '<![CDATA[\n{0}\n]]>'.format(self.styles) @text.setter def text(self, value): self.element.text = value @text.deleter def text(self): del (self.element.text)
def __init__(self, **kwargs): """kwargs should be a dictionary of dictionaries. Top level keys are CSS selectors, and inner dicts hold the style key : value pairs. >>> from svgplotlib.SVG import SVG >>> cssdict = { '#boxId' : { 'border_color' : 'blue', ... 'border' : '1px solid' } } >>> svg = SVG() >>> svg.Style( **cssdict ) """ from svgplotlib.SVG.CSS import CSS #attrib = MangleDict(kwargs) parent = kwargs.pop( 'parent' ) mroargs = { 'root' : kwargs.pop('root') } super(CSSElement,self).__init__('style', type='text/css', **mroargs) self.styles = CSS(**kwargs) self.text = self.styles.__repr__() parent.append(self.element)