[tor-commits] [nyx/master] Drop daemon_panels() method

atagar at torproject.org atagar at torproject.org
Fri Sep 16 06:18:14 UTC 2016


commit ed0fcdc3a1d8e8b489bc22420bcf7cc004a7097e
Author: Damian Johnson <atagar at torproject.org>
Date:   Thu Sep 15 19:00:50 2016 -0700

    Drop daemon_panels() method
    
    This is only used internally so just doing the isinstance() checks where we
    need 'em.
---
 nyx/__init__.py   | 20 ++++++++------------
 nyx/controller.py |  7 +------
 2 files changed, 9 insertions(+), 18 deletions(-)

diff --git a/nyx/__init__.py b/nyx/__init__.py
index db78bd4..33da167 100644
--- a/nyx/__init__.py
+++ b/nyx/__init__.py
@@ -23,7 +23,6 @@ Tor curses monitoring application.
     |
     |- header_panel - provides the header panel
     |- page_panels - provides panels on a page
-    |- daemon_panels - provides daemon panels
     |
     |- is_paused - checks if the interface is paused
     |- set_paused - sets paused state
@@ -309,6 +308,10 @@ class Interface(object):
     if CONFIG['features.panels.show.interpreter']:
       self._page_panels.append([nyx.panel.interpreter.InterpreterPanel()])
 
+    for panel in self:
+      if isinstance(panel, nyx.panel.DaemonPanel):
+        panel.start()
+
   def get_page(self):
     """
     Provides the page we're showing.
@@ -364,15 +367,6 @@ class Interface(object):
 
     return list(self._page_panels[self._page if page_number is None else page_number])
 
-  def daemon_panels(self):
-    """
-    Provides panels that are daemons.
-
-    :returns: **list** of DaemonPanel in the interface
-    """
-
-    return [panel for panel in self if isinstance(panel, nyx.panel.DaemonPanel)]
-
   def is_paused(self):
     """
     Checks if the interface is configured to be paused.
@@ -434,10 +428,12 @@ class Interface(object):
     """
 
     def halt_panels():
-      for panel in self.daemon_panels():
+      daemons = [panel for panel in self if isinstance(panel, nyx.panel.DaemonPanel)]
+
+      for panel in daemons():
         panel.stop()
 
-      for panel in self.daemon_panels():
+      for panel in daemons():
         panel.join()
 
     halt_thread = threading.Thread(target = halt_panels)
diff --git a/nyx/controller.py b/nyx/controller.py
index 980f44c..d304527 100644
--- a/nyx/controller.py
+++ b/nyx/controller.py
@@ -40,8 +40,6 @@ def start_nyx():
   Main draw loop context.
   """
 
-  interface = nyx_interface()
-
   if not CONFIG['features.acsSupport']:
     nyx.curses.disable_acs()
 
@@ -51,10 +49,7 @@ def start_nyx():
     if not key.startswith('msg.') and not key.startswith('dedup.'):
       log.notice('Unused configuration entry: %s' % key)
 
-  # tells daemon panels to start
-
-  for panel in interface.daemon_panels():
-    panel.start()
+  interface = nyx_interface()
 
   # logs the initialization time
 





More information about the tor-commits mailing list