Revision: 5736
          http://matplotlib.svn.sourceforge.net/matplotlib/?rev=5736&view=rev
Author:   mdboom
Date:     2008-07-11 07:36:49 -0700 (Fri, 11 Jul 2008)

Log Message:
-----------
Minor updates to inheritance diagram.

Modified Paths:
--------------
    trunk/matplotlib/doc/sphinxext/inheritance_diagram.py

Modified: trunk/matplotlib/doc/sphinxext/inheritance_diagram.py
===================================================================
--- trunk/matplotlib/doc/sphinxext/inheritance_diagram.py       2008-07-11 
12:18:43 UTC (rev 5735)
+++ trunk/matplotlib/doc/sphinxext/inheritance_diagram.py       2008-07-11 
14:36:49 UTC (rev 5736)
@@ -145,8 +145,9 @@
         """
         module = cls.__module__
         if module == '__builtin__':
-            return cls.__name__
-        fullname = '.'.join([module, cls.__name__])
+            fullname = cls.__name__
+        else:
+            fullname = "%s.%s" % (module, cls.__name__)
         if parts == 0:
             return fullname
         name_parts = fullname.split('.')
@@ -299,6 +300,9 @@
     node['content'] = " ".join(class_names)
     return [node]
 
+def get_graph_hash(node):
+    return md5(node['content'] + str(node['parts'])).hexdigest()[-10:]
+
 def html_output_graph(self, node):
     """
     Output the graph for HTML.  This will insert a PNG with clickable
@@ -307,11 +311,9 @@
     graph = node['graph']
     parts = node['parts']
 
-    # Determine where to write the PNG to.  This follows
-    # the same procedure as mathpng.py
-    name = 'inheritance%s' % md5(
-        node['content'] + str(node['parts'])).hexdigest()[-10:]
-    png_path = '_static/%s.png' % name
+    graph_hash = get_graph_hash(node)
+    name = "inheritance%s" % graph_hash
+    png_path = os.path.join('_static', name + ".png")
 
     path = '_static'
     source = self.document.attributes['source']
@@ -346,24 +348,14 @@
     graph = node['graph']
     parts = node['parts']
 
-    # Determine where to write the PNG to.  This follows
-    # the same procedure as mathpng.py
-    name = 'inheritance%s' % md5(
-        node['content'] + str(node['parts'])).hexdigest()[-10:]
-    pdf_path = '_static/%s.pdf' % name
+    graph_hash = get_graph_hash(node)
+    name = "inheritance%s"
+    pdf_path = os.path.join('_static', name + ".pdf")
 
-    path = '_static'
-    source = self.document.attributes['source']
-    count = source.split('/doc/')[-1].count('/')
-    for i in range(count):
-        if os.path.exists(path): break
-        path = '../'+path
-    path = '../'+path #specifically added for matplotlib
+    graph.run_dot(['-Tpdf', '-o%s' % pdf_path],
+                  name, parts, graph_options={'size': '"6.0,6.0"'})
+    return '\\includegraphics{../../%s}' % pdf_path
 
-    graph.run_dot(['-Tpdf', '-o%s' % pdf_path], name, parts,
-                  graph_options={'size': '"6.0,6.0"'})
-    return '\\includegraphics{../../_static/%s.pdf}' % name
-
 def visit_inheritance_diagram(inner_func):
     """
     This is just a wrapper around html/latex_output_graph to make it


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Matplotlib-checkins mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/matplotlib-checkins

Reply via email to