[tor-commits] [nyx/master] Drop placement_label attribute

atagar at torproject.org atagar at torproject.org
Tue Sep 22 17:08:42 UTC 2015


commit 91b7b48d639b116f5fe40f69e7408a0655767443
Author: Damian Johnson <atagar at torproject.org>
Date:   Thu Sep 17 09:45:33 2015 -0700

    Drop placement_label attribute
    
    Moving another rendering attribute into the draw method where it's used.
---
 nyx/connection_panel.py |   25 ++++++++++++-------------
 1 file changed, 12 insertions(+), 13 deletions(-)

diff --git a/nyx/connection_panel.py b/nyx/connection_panel.py
index 78a5e2c..d92c7f6 100644
--- a/nyx/connection_panel.py
+++ b/nyx/connection_panel.py
@@ -258,18 +258,6 @@ class CircLine(ConnectionLine):
     self.circuit = circ
     self._fingerprint = fingerprint
 
-    circ_path = [path_entry[0] for path_entry in circ.path]
-    circ_index = circ_path.index(fingerprint)
-
-    if circ_index == len(circ_path) - 1:
-      placement_type = 'Exit' if circ.status == 'BUILT' else 'Extending'
-    elif circ_index == 0:
-      placement_type = 'Guard'
-    else:
-      placement_type = 'Middle'
-
-    self.placement_label = '%i / %s' % (circ_index + 1, placement_type)
-
   def get_fingerprint(self, default = None):
     return self._fingerprint
 
@@ -769,7 +757,18 @@ class ConnectionPanel(panel.Panel, threading.Thread):
       self.addstr(y, x, get_destination_label(line, 25), attr)
       self.addstr(y, x + 25, str_tools.crop(line.get_nickname('UNKNOWN'), 25, 0), attr)
       self.addstr(y, x + 53, get_etc_content(line, width - x - 19 - 53), attr)
-      self.addstr(y, width - 14, line.placement_label, attr)
+
+      circ_path = [path_entry[0] for path_entry in line.circuit.path]
+      circ_index = circ_path.index(line.get_fingerprint())
+
+      if circ_index == len(circ_path) - 1:
+        placement_type = 'Exit' if line.circuit.status == 'BUILT' else 'Extending'
+      elif circ_index == 0:
+        placement_type = 'Guard'
+      else:
+        placement_type = 'Middle'
+
+      self.addstr(y, width - 14, '%i / %s' % (circ_index + 1, placement_type), attr)
 
   def stop(self):
     """





More information about the tor-commits mailing list