From f953c513e2de8b828e8bd5d7830e9595fc3d2b40 Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Sat, 27 Mar 2010 21:08:44 -0400 Subject: [PATCH] Add titles to regions (Firefox, and possibly others) use them for tooltips. Use world.name as template.name and SVG . --- pyrisk/graphics.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/pyrisk/graphics.py b/pyrisk/graphics.py index df63232..6e47f2a 100644 --- a/pyrisk/graphics.py +++ b/pyrisk/graphics.py @@ -48,7 +48,7 @@ class TemplateLibrary (object): region_pointlists,route_pointlists,continent_colors,line_colors = \ self._get_data(name) regions = self._generate_regions(region_pointlists, route_pointlists) - return Template('template', regions, continent_colors, line_colors) + return Template(name, regions, continent_colors, line_colors) def _get_data(self, name): dirname = os.path.join(self.template_dir, name.lower()) try: @@ -370,8 +370,9 @@ class WorldRenderer (object): % (float(width)/self.dpcm, float(height)/self.dpcm, width, height), ' xmlns="http://www.w3.org/2000/svg" version="1.1">', - '<desc>PyRisk world: %s</desc>' % template, - ] + '<title>%s' % template, + 'A PyRisk world snapshot', + ] drawn_rts = {} for r in template.regions: t = self._matching_territory(world, r) @@ -382,8 +383,9 @@ class WorldRenderer (object): b_col_attr = 'stroke="%s" stroke-width="%d"' \ % (template.line_colors['border'], self.line_width) lines.extend([ - '' % r, - '' % ' '.join(['%d,%d' % ((region_pos[id(r)]+p) *(1,-1) # svg y value increases down -- 2.26.2