[pypy-svn] r7322 - pypy/trunk/src/pypy/translator/tool/pygame

mgedmin at codespeak.net mgedmin at codespeak.net
Wed Nov 17 15:04:26 CET 2004


Author: mgedmin
Date: Wed Nov 17 15:04:25 2004
New Revision: 7322

Modified:
   pypy/trunk/src/pypy/translator/tool/pygame/graphdisplay.py
Log:
Make edge labels sane in function flow graphs.



Modified: pypy/trunk/src/pypy/translator/tool/pygame/graphdisplay.py
==============================================================================
--- pypy/trunk/src/pypy/translator/tool/pygame/graphdisplay.py	(original)
+++ pypy/trunk/src/pypy/translator/tool/pygame/graphdisplay.py	Wed Nov 17 15:04:25 2004
@@ -258,7 +258,8 @@
             return
         edge = self.viewer.edge_at_position(pos)
         if edge:
-            info = '%s -> %s' % (edge.tail.label, edge.head.label)
+            info = '%s -> %s' % (shortlabel(edge.tail.label),
+                                 shortlabel(edge.head.label))
             self.setstatusbar(info)
             self.sethighlight(obj=edge)
             return
@@ -447,3 +448,8 @@
         # cannot safely close and re-open the display, depending on
         # Pygame version and platform.
         pygame.display.set_mode((self.width,1))
+
+
+def shortlabel(label):
+    """Shorten a graph node label."""
+    return label.replace('\\l', '').splitlines()[0]



More information about the Pypy-commit mailing list