[Epydoc-commits] SF.net SVN: epydoc: [1761] trunk/epydoc/src/epydoc/docwriter/dotgraph.py
Brought to you by:
edloper
|
From: <ed...@us...> - 2008-02-23 19:50:30
|
Revision: 1761
http://epydoc.svn.sourceforge.net/epydoc/?rev=1761&view=rev
Author: edloper
Date: 2008-02-23 11:50:28 -0800 (Sat, 23 Feb 2008)
Log Message:
-----------
- Added max_width and max_height attributes to DotGraph -- if the graph
is larger than this, then it will be scaled down. Default value is
6 inches wide by 8 inches tall.
Modified Paths:
--------------
trunk/epydoc/src/epydoc/docwriter/dotgraph.py
Modified: trunk/epydoc/src/epydoc/docwriter/dotgraph.py
===================================================================
--- trunk/epydoc/src/epydoc/docwriter/dotgraph.py 2008-02-23 19:33:37 UTC (rev 1760)
+++ trunk/epydoc/src/epydoc/docwriter/dotgraph.py 2008-02-23 19:50:28 UTC (rev 1761)
@@ -84,7 +84,8 @@
DEFAULT_EDGE_DEFAULTS={'fontsize':10, 'fontname': 'Helvetica'}
def __init__(self, title, body='', node_defaults=None,
- edge_defaults=None, caption=None):
+ edge_defaults=None, caption=None,
+ max_width=6, max_height=8):
"""
Create a new `DotGraph`.
"""
@@ -109,7 +110,13 @@
graph.
:type: ``str``"""
+
+ self.max_width = max_width
+ """The maximum width of the graph (in inches)"""
+ self.max_height = max_height
+ """The maximum height of the graph (in inches)"""
+
self.node_defaults = node_defaults or self.DEFAULT_NODE_DEFAULTS
"""Default attribute values for nodes."""
@@ -329,6 +336,7 @@
to render this graph.
"""
lines = ['digraph %s {' % self.uid,
+ 'size="%d,%d"\n' % (self.max_width, self.max_height),
'node [%s]' % ','.join(['%s="%s"' % (k,v) for (k,v)
in self.node_defaults.items()]),
'edge [%s]' % ','.join(['%s="%s"' % (k,v) for (k,v)
@@ -1126,6 +1134,8 @@
return DotGraphEdge(start, end)
if isinstance(classes, ClassDoc): classes = [classes]
+ # [xx] this should be done earlier, and should generate a warning:
+ classes = [c for c in classes if c is not None]
graph = DotGraph('Class Hierarchy for %s' % name_list(classes, context),
body='ranksep=0.3\n',
edge_defaults={'sametail':True, 'dir':'none'})
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|