From 75a07dd565789fe49f9e4c1bc8dce34ebce2589d Mon Sep 17 00:00:00 2001 From: jaraco Date: Wed, 18 Jun 2008 13:24:26 +0000 Subject: [PATCH] Began work on fine-grained CSS support. --- lib/SVG/__init__.py | 7 +++++++ setup.py | 1 + 2 files changed, 8 insertions(+) diff --git a/lib/SVG/__init__.py b/lib/SVG/__init__.py index 44d034c..19591ce 100644 --- a/lib/SVG/__init__.py +++ b/lib/SVG/__init__.py @@ -6,6 +6,7 @@ __all__ = ('Plot', 'TimeSeries', 'Bar', 'Pie', 'Schedule') from xml.dom import minidom as dom from operator import itemgetter from itertools import islice +from cssutils import css, stylesheets try: import zlib @@ -651,6 +652,12 @@ Copyright © 2008 Jason R. Coombs self.graph_height = self.height - self.border_top - self.border_bottom def get_style(self): + sheet = css.CSSStyleSheet() + master_bg_style = css.CSSStyleDeclaration() + master_bg_style.setProperty('fill', '#ffffff') + rule = css.CSSStyleRule(selectorText=u'.svgBackground', style=master_bg_style) + sheet.insertRule(rule) + result = sheet.cssText result = """/* Copy from here for external style sheet */ .svgBackground{ fill:#ffffff; diff --git a/setup.py b/setup.py index 76ea5bb..b7125c1 100644 --- a/setup.py +++ b/setup.py @@ -16,6 +16,7 @@ setup(name = "svg-chart", package_dir = {'':'lib'}, install_requires=[ 'python-dateutil>=1.4', + 'cssutils>=0.9.4', ], license = "MIT", long_description = """\