[tor-commits] [nyx/master] Drop nyx.connections.entries

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


commit 5f1eae854617f42b15b8dffcff953a49b2076467
Author: Damian Johnson <atagar at torproject.org>
Date:   Mon Aug 31 10:22:03 2015 -0700

    Drop nyx.connections.entries
    
    Moving the last class to conn_enties, and dropping the submodule.
---
 nyx/connections/circ_entry.py |    4 +--
 nyx/connections/conn_entry.py |   71 ++++++++++++++++++++++++++++++++++++++---
 nyx/connections/entries.py    |   69 ---------------------------------------
 3 files changed, 69 insertions(+), 75 deletions(-)

diff --git a/nyx/connections/circ_entry.py b/nyx/connections/circ_entry.py
index d2b1ef6..7cf087f 100644
--- a/nyx/connections/circ_entry.py
+++ b/nyx/connections/circ_entry.py
@@ -15,7 +15,7 @@ import nyx.util.tracker
 import nyx.util.ui_tools
 import nyx.connection_panel
 
-from nyx.connections import conn_entry, entries
+from nyx.connections import conn_entry
 
 from stem.util import str_tools
 
@@ -125,7 +125,7 @@ class CircLine(conn_entry.ConnectionLine):
       listing_type - primary attribute we're listing connections by
     """
 
-    return entries.ConnectionPanelLine.get_listing_entry(self, width, current_time, listing_type)
+    return conn_entry.ConnectionPanelLine.get_listing_entry(self, width, current_time, listing_type)
 
   def _get_listing_entry(self, width, current_time, listing_type):
     line_format = nyx.util.ui_tools.get_color(nyx.connection_panel.CATEGORY_COLOR[self._entry.get_type()])
diff --git a/nyx/connections/conn_entry.py b/nyx/connections/conn_entry.py
index 1f26f4c..366ecba 100644
--- a/nyx/connections/conn_entry.py
+++ b/nyx/connections/conn_entry.py
@@ -10,7 +10,6 @@ import nyx.util.tracker
 import nyx.util.ui_tools
 
 from nyx.util import tor_controller
-from nyx.connections import entries
 from nyx.connection_panel import Category
 
 from stem.util import conf, connection, str_tools
@@ -32,13 +31,77 @@ CONFIG = conf.config_dict('nyx', {
 })
 
 
-class ConnectionLine(entries.ConnectionPanelLine):
+class ConnectionPanelLine:
+  """
+  Individual line in the connection panel listing.
+  """
+
+  def __init__(self):
+    # cache for displayed information
+    self._listing_cache = None
+    self._listing_cache_args = (None, None)
+
+    self._details_cache = None
+    self._details_cache_args = None
+
+    self._descriptor_cache = None
+    self._descriptor_cache_args = None
+
+  def get_listing_prefix(self):
+    """
+    Provides a list of characters to be appended before the listing entry.
+    """
+
+    return ()
+
+  def get_listing_entry(self, width, current_time, listing_type):
+    """
+    Provides a [(msg, attr)...] tuple list for contents to be displayed in the
+    connection panel listing.
+
+    Arguments:
+      width       - available space to display in
+      current_time - unix timestamp for what the results should consider to be
+                    the current time (this may be ignored due to caching)
+    """
+
+    if self._listing_cache_args != (width, listing_type):
+      self._listing_cache = self._get_listing_entry(width, current_time, listing_type)
+      self._listing_cache_args = (width, listing_type)
+
+    return self._listing_cache
+
+  def _get_listing_entry(self, width, current_time, listing_type):
+    # implementation of get_listing_entry
+    return None
+
+  def get_details(self, width):
+    """
+    Provides a list of [(msg, attr)...] tuple listings with detailed
+    information for this connection.
+
+    Arguments:
+      width - available space to display in
+    """
+
+    if self._details_cache_args != width:
+      self._details_cache = self._get_details(width)
+      self._details_cache_args = width
+
+    return self._details_cache
+
+  def _get_details(self, width):
+    # implementation of get_details
+    return []
+
+
+class ConnectionLine(ConnectionPanelLine):
   """
   Display component of the ConnectionEntry.
   """
 
   def __init__(self, entry, conn, include_port=True, include_expanded_addresses=True):
-    entries.ConnectionPanelLine.__init__(self)
+    ConnectionPanelLine.__init__(self)
 
     self._entry = entry
     self.connection = conn
@@ -105,7 +168,7 @@ class ConnectionLine(entries.ConnectionPanelLine):
 
     # fetch our (most likely cached) display entry for the listing
 
-    my_listing = entries.ConnectionPanelLine.get_listing_entry(self, width, current_time, listing_type)
+    my_listing = ConnectionPanelLine.get_listing_entry(self, width, current_time, listing_type)
 
     # fill in the current uptime and return the results
 
diff --git a/nyx/connections/entries.py b/nyx/connections/entries.py
deleted file mode 100644
index 57c7e84..0000000
--- a/nyx/connections/entries.py
+++ /dev/null
@@ -1,69 +0,0 @@
-"""
-Interface for entries in the connection panel. These consist of two parts: the
-entry itself (ie, Tor connection, client circuit, etc) and the lines it
-consists of in the listing.
-"""
-
-
-class ConnectionPanelLine:
-  """
-  Individual line in the connection panel listing.
-  """
-
-  def __init__(self):
-    # cache for displayed information
-    self._listing_cache = None
-    self._listing_cache_args = (None, None)
-
-    self._details_cache = None
-    self._details_cache_args = None
-
-    self._descriptor_cache = None
-    self._descriptor_cache_args = None
-
-  def get_listing_prefix(self):
-    """
-    Provides a list of characters to be appended before the listing entry.
-    """
-
-    return ()
-
-  def get_listing_entry(self, width, current_time, listing_type):
-    """
-    Provides a [(msg, attr)...] tuple list for contents to be displayed in the
-    connection panel listing.
-
-    Arguments:
-      width       - available space to display in
-      current_time - unix timestamp for what the results should consider to be
-                    the current time (this may be ignored due to caching)
-    """
-
-    if self._listing_cache_args != (width, listing_type):
-      self._listing_cache = self._get_listing_entry(width, current_time, listing_type)
-      self._listing_cache_args = (width, listing_type)
-
-    return self._listing_cache
-
-  def _get_listing_entry(self, width, current_time, listing_type):
-    # implementation of get_listing_entry
-    return None
-
-  def get_details(self, width):
-    """
-    Provides a list of [(msg, attr)...] tuple listings with detailed
-    information for this connection.
-
-    Arguments:
-      width - available space to display in
-    """
-
-    if self._details_cache_args != width:
-      self._details_cache = self._get_details(width)
-      self._details_cache_args = width
-
-    return self._details_cache
-
-  def _get_details(self, width):
-    # implementation of get_details
-    return []





More information about the tor-commits mailing list