[Epydoc-commits] SF.net SVN: epydoc: [1173] trunk/epydoc/src/epydoc/docwriter/dotgraph.py
Brought to you by:
edloper
From: <ed...@us...> - 2006-04-05 19:47:42
|
Revision: 1173 Author: edloper Date: 2006-04-05 12:47:34 -0700 (Wed, 05 Apr 2006) ViewCVS: http://svn.sourceforge.net/epydoc/?rev=1173&view=rev Log Message: ----------- - Better unicode support for dotgraphs (encode on write, and decode cmapx files on read) Modified Paths: -------------- trunk/epydoc/src/epydoc/docwriter/dotgraph.py Modified: trunk/epydoc/src/epydoc/docwriter/dotgraph.py =================================================================== --- trunk/epydoc/src/epydoc/docwriter/dotgraph.py 2006-04-05 17:19:53 UTC (rev 1172) +++ trunk/epydoc/src/epydoc/docwriter/dotgraph.py 2006-04-05 19:47:34 UTC (rev 1173) @@ -214,8 +214,12 @@ try: result, err = run_subprocess([DOT_COMMAND, '-T%s' % language], self.to_dotfile()) + # Decode into unicode, if necessary. + if language == 'cmapx' and result is not None: + result = result.decode('utf-8') except OSError, e: log.warning("Unable to render Graphviz dot graph:\n%s" % e) + log.debug(self.to_dotfile()) return None return result @@ -239,8 +243,10 @@ for edge in self.edges: lines.append(edge.to_dotfile()) lines.append('}') - return '\n'.join(lines) + # Default dot input encoding is UTF-8 + return u'\n'.join(lines).encode('utf-8') + class DotGraphNode: _next_id = 0 def __init__(self, label=None, **attribs): @@ -357,8 +363,7 @@ def import_graph(modules, docindex, linker, context=None, **options): graph = DotGraph('Import Graph', - node_defaults={'shape':'box', 'width': 0, 'height': 0}, - edge_defaults={'sametail':True}) + node_defaults={'shape':'box', 'width': 0, 'height': 0}) # Options if options.get('dir', 'RL') != 'TB': # default: right-to-left. @@ -429,8 +434,7 @@ func_set.update(docindex.callees.get(func_doc, ())) graph = DotGraph('Call Graph for %s' % name_list(api_docs, context), - node_defaults={'shape':'box', 'width': 0, 'height': 0}, - edge_defaults={'sametail':True}) + node_defaults={'shape':'box', 'width': 0, 'height': 0}) # Options if options.get('dir', 'LR') != 'TB': # default: left-to-right This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |