commit e26b6b6b854dbb2d688ac4c21d87dd764fe8c3c7
Author: Sambuddha Basu <sambuddhabasu1(a)gmail.com>
Date: Sun Jun 12 22:54:29 2016 -0700
Added colors to the event dialog selection
---
nyx/popups.py | 15 ++++++++++++++-
1 file changed, 14 insertions(+), 1 deletion(-)
diff --git a/nyx/popups.py b/nyx/popups.py
index 9e819da..c588aad 100644
--- a/nyx/popups.py
+++ b/nyx/popups.py
@@ -36,6 +36,13 @@ 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:']
@@ -420,7 +427,13 @@ def select_event_types(initial_selection):
event = events[selection - 10]
if event:
- subwindow.addstr_wrap(1, 1, stem.control.event_description(event), subwindow.width - 1, 1)
+ 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.hline(1, 3, 78)
+ subwindow._addch(0, 3, curses.ACS_LTEE)
+ subwindow._addch(79, 6, curses.ACS_RTEE)
x = subwindow.addstr(1, 4, 'Tor Runlevel:')