|
|
@ -637,23 +637,24 @@ class Graph(object): |
|
|
|
self.graph_height = self.height - self.border_top - self.border_bottom |
|
|
|
self.graph_height = self.height - self.border_top - self.border_bottom |
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
@staticmethod |
|
|
|
def load_resource_stylesheet(name): |
|
|
|
def load_resource_stylesheet(name, subs=dict()): |
|
|
|
css_stream = pkg_resources.resource_stream('svg.charts', name) |
|
|
|
css_stream = pkg_resources.resource_stream('svg.charts', name) |
|
|
|
css_string = css_stream.read() |
|
|
|
css_string = css_stream.read() |
|
|
|
|
|
|
|
css_string = css_string % subs |
|
|
|
sheet = cssutils.parseString(css_string) |
|
|
|
sheet = cssutils.parseString(css_string) |
|
|
|
return sheet |
|
|
|
return sheet |
|
|
|
|
|
|
|
|
|
|
|
def get_stylesheet(self): |
|
|
|
def get_stylesheet(self): |
|
|
|
cssutils.log.setLevel(99) # disable log messages |
|
|
|
cssutils.log.setLevel(30) # disable INFO log messages |
|
|
|
sheet = self.load_resource_stylesheet('graph.css') |
|
|
|
# allow css to include class variables: |
|
|
|
child_sheet = self.load_resource_stylesheet(self.css_file) |
|
|
|
class_vars = class_dict(self) |
|
|
|
|
|
|
|
sheet = self.load_resource_stylesheet('graph.css', class_vars) |
|
|
|
|
|
|
|
child_sheet = self.load_resource_stylesheet(self.css_file, class_vars) |
|
|
|
map(sheet.add, child_sheet) |
|
|
|
map(sheet.add, child_sheet) |
|
|
|
return sheet |
|
|
|
return sheet |
|
|
|
|
|
|
|
|
|
|
|
def get_style(self): |
|
|
|
def get_style(self): |
|
|
|
sheet = self.get_stylesheet().cssText |
|
|
|
return self.get_stylesheet().cssText |
|
|
|
sheet = sheet % class_dict(self) |
|
|
|
|
|
|
|
return sheet |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
@property |
|
|
|
@property |
|
|
|
def css_file(self): |
|
|
|
def css_file(self): |
|
|
|