changeset 19:60baa5252aa4

hopefully fix formatting a bit
author Jeff Hammel <jhammel@mozilla.com>
date Sun, 02 Jan 2011 20:35:59 -0800
parents 2aeac6508dc3
children f9cf249dd512
files svgsitemap/middleware.py
diffstat 1 files changed, 7 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/svgsitemap/middleware.py
+++ b/svgsitemap/middleware.py
@@ -88,31 +88,34 @@ class SVGSiteMap(object):
                     self.graph.remove_edge(edge[0], edge[1])
                     continue
                 if edge.attr['tooltip']:
                     count = int(edge.attr['tooltip'].split(':', 1)[0].strip())
                 else:
                     label = edge.attr['label']
                     count = int(label)
                     self.label(edge, count)
+                edge.attr['fontsize'] = self.fontsize
                 self.edges[(edge[0], edge[1])] = count
                 if count > self.max:
                     self.max = count
             self.remove_orphans()
+            for node in self.graph.nodes():
+                node.attr['fontsize'] = self.fontsize
             self.set_widths()
         else:
             self.graph = AGraph(name=self.name, splines=False, directed=True)
 
         # make it pretty
         self.graph.graph_attr['name'] = self.name
         self.graph.graph_attr['label'] = self.name
         self.graph.graph_attr['fontname'] = self.fontname
         self.graph.graph_attr['fontcolor'] = self.fontcolor
         self.graph.graph_attr['bgcolor'] = self.bgcolor
-        self.graph.graph_attr['overlap'] = 'false'
+        self.graph.graph_attr['overlap'] = 'compact'
         self.graph.graph_attr['sep'] = '0'
         self.graph.node_attr['color'] = self.nodecolor
         self.graph.node_attr['fontcolor'] = self.fontcolor
         self.graph.node_attr['fontname'] = self.fontname
         self.graph.node_attr['fontsize'] = self.fontsize
         self.graph.node_attr['shape'] = self.shape
         self.graph.edge_attr['color'] = self.edgecolor
         self.graph.edge_attr['fontcolor'] = self.fontcolor
@@ -166,33 +169,35 @@ class SVGSiteMap(object):
                 self.max = count
             self.edges[(from_url, to_url)] = count
             edge = self.graph.get_edge(from_url, to_url)
             self.label(edge, count)
         else:
             count = 1
             self.edges[(from_url, to_url)] = 1
             labeltooltip = '1: %s -> %s' % (from_url, to_url)
-            self.graph.add_edge(from_url, to_url, label='', tooltip=labeltooltip, href='#')
+            self.graph.add_edge(from_url, to_url, label='', tooltip=labeltooltip, href='#', fontsize=self.fontsize)
 
         if count > self.max:
             self.max = count
 
         if self.maxwidth:
             self.set_widths()
 
         for url in from_url, to_url:
             node = self.graph.get_node(url)
             node.attr['label'] = url
             node.attr['href'] = url
+            node.attr['fontsize'] = self.fontsize
 
         self.save()
 
     def label(self, edge, count):
         edge.attr['label'] = ''
+        edge.attr['fontsize'] = self.fontsize
         edge.attr['tooltip'] = '%d: %s -> %s' % (count, edge[0], edge[1])
         edge.attr['labeltooltip'] = edge.attr['tooltip']
         edge.attr['href'] = '#'
 
     def exclude(self, *urls):
         """tell whether the edge is excluded"""
         for pattern in self.excluded:
             for url in urls: