From e67fb54e0ee3aa1c6955a385698ae4fb1d5ae26c Mon Sep 17 00:00:00 2001 From: Nicolargo Date: Thu, 4 Sep 2014 18:58:22 +0200 Subject: [PATCH] Correct bug Windows console --- glances/outputs/glances_colorconsole.py | 2 -- glances/outputs/glances_curses.py | 17 +++++++++++++++-- 2 files changed, 15 insertions(+), 4 deletions(-) diff --git a/glances/outputs/glances_colorconsole.py b/glances/outputs/glances_colorconsole.py index 4a4d3cc9..7a9c8018 100644 --- a/glances/outputs/glances_colorconsole.py +++ b/glances/outputs/glances_colorconsole.py @@ -126,8 +126,6 @@ class WCurseLight(object): COLOR_BLUE = colorconsole.terminal.colors["LBLUE"] COLOR_MAGENTA = colorconsole.terminal.colors["LPURPLE"] COLOR_BLACK = colorconsole.terminal.colors["BLACK"] - COLOR_MAGENTA = colorconsole.terminal.colors["MAGENTA"] - COLOR_CYAN = colorconsole.terminal.colors["CYAN"] A_UNDERLINE = 0 A_BOLD = 0 COLOR_PAIRS = 9 diff --git a/glances/outputs/glances_curses.py b/glances/outputs/glances_curses.py index 1ae9ce55..1d5fe796 100644 --- a/glances/outputs/glances_curses.py +++ b/glances/outputs/glances_curses.py @@ -89,8 +89,21 @@ class GlancesCurses(object): curses.init_pair(6, curses.COLOR_RED, -1) curses.init_pair(7, curses.COLOR_GREEN, -1) curses.init_pair(8, curses.COLOR_BLUE, -1) - curses.init_pair(9, curses.COLOR_MAGENTA, -1) - curses.init_pair(10, curses.COLOR_CYAN, -1) + try: + curses.init_pair(9, curses.COLOR_MAGENTA, -1) + except: + if args.theme_white: + curses.init_pair(9, curses.COLOR_BLACK, -1) + else: + curses.init_pair(9, curses.COLOR_WHITE, -1) + try: + curses.init_pair(10, curses.COLOR_CYAN, -1) + except: + if args.theme_white: + curses.init_pair(10, curses.COLOR_BLACK, -1) + else: + curses.init_pair(10, curses.COLOR_WHITE, -1) + else: self.hascolors = False