[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [nyx/master] Simpler coloring for event popup



commit 78f5e41aafb6904f31e3d94f8f452cbcb110604a
Author: Damian Johnson <atagar@xxxxxxxxxxxxxx>
Date:   Mon Jun 13 08:32:45 2016 -0700

    Simpler coloring for event popup
    
    On reflection using the event colors makes it harder to read the text so just
    opting for bold green (giving the dialog a little color while still being
    readable). Also fixing an issue with addstr_wrap() that caused us to have an
    extra space when wrapping to new lines.
---
 nyx/curses.py |  1 +
 nyx/popups.py | 11 +----------
 2 files changed, 2 insertions(+), 10 deletions(-)

diff --git a/nyx/curses.py b/nyx/curses.py
index f357443..a02adc8 100644
--- a/nyx/curses.py
+++ b/nyx/curses.py
@@ -575,6 +575,7 @@ class _Subwindow(object):
         draw_msg, msg = stem.util.str_tools.crop(msg, width - x), ''  # first word is longer than the line
 
       x = self.addstr(x, y, draw_msg, *attr)
+      msg = msg.lstrip()
 
       if (y - orig_y + 1) >= CONFIG['features.maxLineWrap']:
         break  # maximum number we'll wrap
diff --git a/nyx/popups.py b/nyx/popups.py
index c588aad..3127e67 100644
--- a/nyx/popups.py
+++ b/nyx/popups.py
@@ -36,13 +36,6 @@ from nyx.curses import RED, GREEN, YELLOW, CYAN, WHITE, NORMAL, BOLD, HIGHLIGHT
 import stem.control
 import stem.util.str_tools
 
-from stem.util import conf
-
-
-CONFIG = conf.config_dict('nyx', {
-    'attr.log_color': {},
-})
-
 NO_STATS_MSG = "Usage stats aren't available yet, press any key..."
 
 HEADERS = ['Consensus:', 'Microdescriptor:', 'Server Descriptor:']
@@ -427,9 +420,7 @@ def select_event_types(initial_selection):
       event = events[selection - 10]
 
     if event:
-      color = CONFIG['attr.log_color'].get(event, WHITE) if event in nyx.log.TOR_RUNLEVELS else WHITE
-      subwindow.addstr_wrap(1, 1, stem.control.event_description(event), subwindow.width - 1, 0, color)
-      subwindow._addch(0, 2, curses.ACS_VLINE)
+      subwindow.addstr_wrap(1, 1, stem.control.event_description(event), subwindow.width - 1, 1, GREEN, BOLD)
 
     subwindow.hline(1, 3, 78)
     subwindow._addch(0, 3, curses.ACS_LTEE)



_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits