# HG changeset patch
# User paulb@localhost.localdomain
# Date 1171756252 -3600
# Node ID d2dee1202635d0a6f7d04b67d13729059b784722
# Parent 317dbf48abd6d57be973ce5c9f1472e2e2bd8bb5
Avoid duplicates in lists of invocations.
diff -r 317dbf48abd6 -r d2dee1202635 viewer.py
--- a/viewer.py Sun Feb 18 00:37:57 2007 +0100
+++ b/viewer.py Sun Feb 18 00:50:52 2007 +0100
@@ -525,8 +525,7 @@
self.stream.write(symbol)
self._popup_start()
self.stream.write("
\n")
- self._invocations_list(node._left_call.active())
- self._invocations_list(node._right_call.active())
+ self._invocations_list(node._left_call.active() + node._right_call.active())
self.stream.write("
\n")
self._popup_end()
self.stream.write("\n")
@@ -910,8 +909,7 @@
def _op(self, node):
self.stream.write("\n")
if hasattr(node, "_left_call") and hasattr(node, "_right_call"):
- self._invocations_list(node._left_call.active())
- self._invocations_list(node._right_call.active())
+ self._invocations_list(node._left_call.active() + node._right_call.active())
else:
_node = node._node
if isinstance(_node, Not):
@@ -929,15 +927,29 @@
for node in nodes:
if hasattr(node, "invocations"):
invocations += node.invocations
- for invocation in unique(invocations):
+
+ # Record each link, avoiding duplicates.
+
+ links = {}
+ for invocation in invocations:
fn = getattr(invocation, "copy_of", invocation).full_name()
module = invocation.module.name
name = invocation.name
structures = [x.name for x in invocation.structures]
qualified_name = ".".join([module] + structures + [name])
+
+ # Record the label and the link texts.
+
+ label = self._text(qualified_name)
+ link = (self._url(module), self._url(fn))
+ links[label] = link
+
+ # Produce the list.
+
+ for label, link in links.items():
self.stream.write("
\n")