From 25af0959901af864a874a0576c051e9c07b49ab4 Mon Sep 17 00:00:00 2001 From: fraoustin Date: Tue, 20 Aug 2013 19:24:49 +0200 Subject: [PATCH 01/22] Update glances.py add client console for windows --- glances/glances.py | 127 ++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 125 insertions(+), 2 deletions(-) diff --git a/glances/glances.py b/glances/glances.py index e15d4a56..338d3b88 100644 --- a/glances/glances.py +++ b/glances/glances.py @@ -88,6 +88,128 @@ if not is_Windows: print('Curses module not found. Glances cannot start.') sys.exit(1) +is_ColorConsole = False +############### ADD BY FAO #################################################### +if is_Windows: + try: + import colorconsole, colorconsole.terminal + + class Screen(): + + COLOR_DEFAULT_WIN = '0F'#07'#'0F' + COLOR_BK_DEFAULT = colorconsole.terminal.colors["BLACK"] + COLOR_FG_DEFAULT = colorconsole.terminal.colors["WHITE"] + + def __init__(self, nc): + self.nc = nc + self.term = colorconsole.terminal.get_terminal() + if os.name == "nt": + os.system('color %s' % self.COLOR_DEFAULT_WIN) + self.term.clear() + + def subwin(self, x, y): + return self + + def keypad(self, id): + return None + + def nodelay(self, id): + return None + + def getch(self): + return 27 + #return self.term.getch() + + def erase(self): + self.reset() + return None + + def addnstr(self, y, x, msg, ln, typo= 0): + try: + fgs, bks = self.nc.colors[typo] + except: + fgs, bks = self.COLOR_FG_DEFAULT, self.COLOR_BK_DEFAULT + self.term.set_color(fg=fgs, bk=bks) + self.term.print_at(x, y, msg.ljust(ln)) + self.term.set_color(fg=self.COLOR_FG_DEFAULT, bk=self.COLOR_BK_DEFAULT) + + def getmaxyx(self): + x = self.term._Terminal__get_console_info().srWindow.Right - self.term._Terminal__get_console_info().srWindow.Left +1 + y = self.term._Terminal__get_console_info().srWindow.Bottom - self.term._Terminal__get_console_info().srWindow.Top +1 + return [y,x] + + def reset(self): + self.term.clear() + self.term.reset() + return None + + def restore_buffered_mode(self): + self.term.restore_buffered_mode() + return None + + class WCurseLight(): + + COLOR_WHITE = colorconsole.terminal.colors["WHITE"] + COLOR_RED = colorconsole.terminal.colors["RED"] + COLOR_GREEN = colorconsole.terminal.colors["GREEN"] + COLOR_BLUE = colorconsole.terminal.colors["LBLUE"] + COLOR_MAGENTA = colorconsole.terminal.colors["LPURPLE"] + COLOR_BLACK = colorconsole.terminal.colors["BLACK"] + A_UNDERLINE = 0 + A_BOLD = 0 + COLOR_PAIRS = 9 + colors = {} + + def __init__(self): + self.term = Screen(self) + + def initscr(self): + return self.term + + def start_color(self): + return None + + def use_default_colors(self): + return None + + def noecho(self): + return None + + def cbreak(self): + return None + + def curs_set(self, y): + return None + + def has_colors(self): + return True + + def echo(self): + return None + + def nocbreak(self): + return None + + def endwin(self): + self.term.reset() + self.term.restore_buffered_mode() + return None + + def napms(self, t): + time.sleep(t/1000 if t > 1000 else 1) + + def init_pair(self, id, fg, bk): + self.colors[id] = [max(fg, 0), max(bk, 0)] + + def color_pair(self, id): + return id + + curses = WCurseLight() + is_ColorConsole = True + except Exception: + pass + + try: # psutil is the main library used to grab stats import psutil @@ -4191,8 +4313,9 @@ def main(): html_tag = False csv_tag = False client_tag = False - if is_Windows: - # Force server mode for Windows OS + print is_Windows, is_ColorConsole + if is_Windows and not is_ColorConsole: + # Force server mode for Windows OS without Colorconsole server_tag = True else: server_tag = False From 500d6ca8e0b8f49677e1f68930b5496fe9839fff Mon Sep 17 00:00:00 2001 From: fraoustin Date: Tue, 20 Aug 2013 19:28:48 +0200 Subject: [PATCH 02/22] Update README.rst add colorconsole for windows --- README.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/README.rst b/README.rst index c63bdbb8..7eea7490 100644 --- a/README.rst +++ b/README.rst @@ -126,6 +126,7 @@ Otherwise, you have to follow these steps: - Install Python for Windows: http://www.python.org/getit/ - Install the psutil library: https://code.google.com/p/psutil/downloads/list +- Install the colorconsole library: http://code.google.com/p/colorconsole/downloads/list - Download Glances from here: http://nicolargo.github.io/glances/ Source From c32b09141b599d47024977e2435cf0da17f07584 Mon Sep 17 00:00:00 2001 From: fraoustin Date: Tue, 20 Aug 2013 19:31:39 +0200 Subject: [PATCH 03/22] Update README.rst --- README.rst | 1 + 1 file changed, 1 insertion(+) diff --git a/README.rst b/README.rst index c63bdbb8..7eea7490 100644 --- a/README.rst +++ b/README.rst @@ -126,6 +126,7 @@ Otherwise, you have to follow these steps: - Install Python for Windows: http://www.python.org/getit/ - Install the psutil library: https://code.google.com/p/psutil/downloads/list +- Install the colorconsole library: http://code.google.com/p/colorconsole/downloads/list - Download Glances from here: http://nicolargo.github.io/glances/ Source From 002f65353cb55e54ca3fc01c60890c311662d258 Mon Sep 17 00:00:00 2001 From: fraoustin Date: Tue, 20 Aug 2013 19:33:49 +0200 Subject: [PATCH 04/22] Update requirements.txt add colorconsole --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index bca35be9..4b9a2506 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1,2 @@ psutil==1.0.1 +colorconsole==0.6 From 3a4b11fd8537f3deb1a4213aacf2c2bf2ff6aedf Mon Sep 17 00:00:00 2001 From: fraoustin Date: Tue, 20 Aug 2013 19:37:12 +0200 Subject: [PATCH 05/22] Update glances.py --- glances/glances.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/glances/glances.py b/glances/glances.py index 338d3b88..3a10ca14 100644 --- a/glances/glances.py +++ b/glances/glances.py @@ -89,7 +89,6 @@ if not is_Windows: sys.exit(1) is_ColorConsole = False -############### ADD BY FAO #################################################### if is_Windows: try: import colorconsole, colorconsole.terminal @@ -4313,7 +4312,6 @@ def main(): html_tag = False csv_tag = False client_tag = False - print is_Windows, is_ColorConsole if is_Windows and not is_ColorConsole: # Force server mode for Windows OS without Colorconsole server_tag = True From 01054d493497f9e88f6598e10f311976deee8d51 Mon Sep 17 00:00:00 2001 From: fraoustin Date: Wed, 21 Aug 2013 16:44:03 +0200 Subject: [PATCH 06/22] Update glances.py Add manage keyboard for windows (q,h,u, ...) --- glances/glances.py | 211 +++++++++++++++++++++++++++++++++++++++------ 1 file changed, 184 insertions(+), 27 deletions(-) diff --git a/glances/glances.py b/glances/glances.py index e15d4a56..ef4ffad2 100644 --- a/glances/glances.py +++ b/glances/glances.py @@ -88,6 +88,162 @@ if not is_Windows: print('Curses module not found. Glances cannot start.') sys.exit(1) +is_ColorConsole = False +if is_Windows: + try: + import colorconsole, colorconsole.terminal + import threading + import msvcrt + + try: + # Python 2 + import Queue as queue + except ImportError: + # Python 3 + import queue + + class ListenGetch(threading.Thread): + def __init__(self, nom = ''): + threading.Thread.__init__(self) + self.Terminated = False + self.q = queue.Queue() + + def run(self): + while not self.Terminated: + char = msvcrt.getch() + self.q.put(char) + + def stop(self): + self.Terminated = True + msvcrt.putch(' ') + while not self.q.empty(): + self.q.get() + + def get(self, default=None): + try: + return ord(self.q.get_nowait()) + except: + return default + + class Screen(): + + COLOR_DEFAULT_WIN = '0F'#07'#'0F' + COLOR_BK_DEFAULT = colorconsole.terminal.colors["BLACK"] + COLOR_FG_DEFAULT = colorconsole.terminal.colors["WHITE"] + + def __init__(self, nc): + self.nc = nc + self.term = colorconsole.terminal.get_terminal() + if os.name == "nt": + os.system('color %s' % self.COLOR_DEFAULT_WIN) + self.listen = ListenGetch() + self.listen.start() + + self.term.clear() + + def subwin(self, x, y): + return self + + def keypad(self, id): + return None + + def nodelay(self, id): + return None + + def getch(self): + return self.listen.get(27) + #return self.term.getch() + + def erase(self): + self.reset() + return None + + def addnstr(self, y, x, msg, ln, typo= 0): + try: + fgs, bks = self.nc.colors[typo] + except: + fgs, bks = self.COLOR_FG_DEFAULT, self.COLOR_BK_DEFAULT + self.term.set_color(fg=fgs, bk=bks) + self.term.print_at(x, y, msg.ljust(ln)) + self.term.set_color(fg=self.COLOR_FG_DEFAULT, bk=self.COLOR_BK_DEFAULT) + + def getmaxyx(self): + x = self.term._Terminal__get_console_info().srWindow.Right - self.term._Terminal__get_console_info().srWindow.Left +1 + y = self.term._Terminal__get_console_info().srWindow.Bottom - self.term._Terminal__get_console_info().srWindow.Top +1 + return [y,x] + + def reset(self): + self.term.clear() + self.term.reset() + return None + + def restore_buffered_mode(self): + self.term.restore_buffered_mode() + return None + + class WCurseLight(): + + COLOR_WHITE = colorconsole.terminal.colors["WHITE"] + COLOR_RED = colorconsole.terminal.colors["RED"] + COLOR_GREEN = colorconsole.terminal.colors["GREEN"] + COLOR_BLUE = colorconsole.terminal.colors["LBLUE"] + COLOR_MAGENTA = colorconsole.terminal.colors["LPURPLE"] + COLOR_BLACK = colorconsole.terminal.colors["BLACK"] + A_UNDERLINE = 0 + A_BOLD = 0 + COLOR_PAIRS = 9 + colors = {} + + def __init__(self): + self.term = Screen(self) + + def initscr(self): + return self.term + + def start_color(self): + return None + + def use_default_colors(self): + return None + + def noecho(self): + return None + + def cbreak(self): + return None + + def curs_set(self, y): + return None + + def has_colors(self): + return True + + def echo(self): + return None + + def nocbreak(self): + return None + + def endwin(self): + self.term.reset() + self.term.restore_buffered_mode() + self.term.listen.stop() + + def napms(self, t): + time.sleep(t/1000 if t > 1000 else 1) + + def init_pair(self, id, fg, bk): + self.colors[id] = [max(fg, 0), max(bk, 0)] + + def color_pair(self, id): + return id + + curses = WCurseLight() + is_ColorConsole = True + except Exception: + pass + + try: # psutil is the main library used to grab stats import psutil @@ -2258,31 +2414,32 @@ class glancesScreen: # Get stats for processes (used in another functions for logs) processcount = stats.getProcessCount() processlist = stats.getProcessList(screen.getProcessSortedBy()) - - # Display stats - self.displaySystem(stats.getHost(), stats.getSystem()) - cpu_offset = self.displayCpu(stats.getCpu(), stats.getPerCpu(), processlist) - load_offset = self.displayLoad(stats.getLoad(), stats.getCore(), processlist, cpu_offset) - self.displayMem(stats.getMem(), stats.getMemSwap(), processlist, load_offset) - network_count = self.displayNetwork(stats.getNetwork(), error=stats.network_error_tag) - sensors_count = self.displaySensors(stats.getSensors(), - self.network_y + network_count) - hddtemp_count = self.displayHDDTemp(stats.getHDDTemp(), - self.network_y + network_count + sensors_count) - diskio_count = self.displayDiskIO(stats.getDiskIO(), - offset_y=self.network_y + sensors_count + - network_count + hddtemp_count, - error=stats.diskio_error_tag) - fs_count = self.displayFs(stats.getFs(), - self.network_y + sensors_count + - network_count + diskio_count + - hddtemp_count) - log_count = self.displayLog(self.network_y + sensors_count + network_count + - diskio_count + fs_count + - hddtemp_count) - self.displayProcess(processcount, processlist, stats.getSortedBy(), - log_count=log_count, core=stats.getCore(), cs_status=cs_status) - self.displayCaption(cs_status=cs_status) + + if not self.help_tag: + # Display stats + self.displaySystem(stats.getHost(), stats.getSystem()) + cpu_offset = self.displayCpu(stats.getCpu(), stats.getPerCpu(), processlist) + load_offset = self.displayLoad(stats.getLoad(), stats.getCore(), processlist, cpu_offset) + self.displayMem(stats.getMem(), stats.getMemSwap(), processlist, load_offset) + network_count = self.displayNetwork(stats.getNetwork(), error=stats.network_error_tag) + sensors_count = self.displaySensors(stats.getSensors(), + self.network_y + network_count) + hddtemp_count = self.displayHDDTemp(stats.getHDDTemp(), + self.network_y + network_count + sensors_count) + diskio_count = self.displayDiskIO(stats.getDiskIO(), + offset_y=self.network_y + sensors_count + + network_count + hddtemp_count, + error=stats.diskio_error_tag) + fs_count = self.displayFs(stats.getFs(), + self.network_y + sensors_count + + network_count + diskio_count + + hddtemp_count) + log_count = self.displayLog(self.network_y + sensors_count + network_count + + diskio_count + fs_count + + hddtemp_count) + self.displayProcess(processcount, processlist, stats.getSortedBy(), + log_count=log_count, core=stats.getCore(), cs_status=cs_status) + self.displayCaption(cs_status=cs_status) self.displayHelp(core=stats.getCore()) self.displayBat(stats.getBatPercent()) self.displayNow(stats.getNow()) @@ -4191,8 +4348,8 @@ def main(): html_tag = False csv_tag = False client_tag = False - if is_Windows: - # Force server mode for Windows OS + if is_Windows and not is_ColorConsole: + # Force server mode for Windows OS without Colorconsole server_tag = True else: server_tag = False From e5a7935d32da0141dc7de11e47b2c65cbfaa511c Mon Sep 17 00:00:00 2001 From: fraoustin Date: Wed, 21 Aug 2013 21:32:13 +0200 Subject: [PATCH 07/22] Update glances.py add manage keyboard for terminal windows add correction for multicpu --- glances/glances.py | 94 ++++++++++++++++++++++++++++++++-------------- 1 file changed, 65 insertions(+), 29 deletions(-) diff --git a/glances/glances.py b/glances/glances.py index 3a10ca14..775c9884 100644 --- a/glances/glances.py +++ b/glances/glances.py @@ -92,6 +92,38 @@ is_ColorConsole = False if is_Windows: try: import colorconsole, colorconsole.terminal + import threading + import msvcrt + + try: + # Python 2 + import Queue as queue + except ImportError: + # Python 3 + import queue + + class ListenGetch(threading.Thread): + def __init__(self, nom = ''): + threading.Thread.__init__(self) + self.Terminated = False + self.q = queue.Queue() + + def run(self): + while not self.Terminated: + char = msvcrt.getch() + self.q.put(char) + + def stop(self): + self.Terminated = True + msvcrt.putch(' ') + while not self.q.empty(): + self.q.get() + + def get(self, default=None): + try: + return ord(self.q.get_nowait()) + except: + return default class Screen(): @@ -104,6 +136,9 @@ if is_Windows: self.term = colorconsole.terminal.get_terminal() if os.name == "nt": os.system('color %s' % self.COLOR_DEFAULT_WIN) + self.listen = ListenGetch() + self.listen.start() + self.term.clear() def subwin(self, x, y): @@ -116,7 +151,7 @@ if is_Windows: return None def getch(self): - return 27 + return self.listen.get(27) #return self.term.getch() def erase(self): @@ -192,7 +227,7 @@ if is_Windows: def endwin(self): self.term.reset() self.term.restore_buffered_mode() - return None + self.term.listen.stop() def napms(self, t): time.sleep(t/1000 if t > 1000 else 1) @@ -2379,31 +2414,32 @@ class glancesScreen: # Get stats for processes (used in another functions for logs) processcount = stats.getProcessCount() processlist = stats.getProcessList(screen.getProcessSortedBy()) - - # Display stats - self.displaySystem(stats.getHost(), stats.getSystem()) - cpu_offset = self.displayCpu(stats.getCpu(), stats.getPerCpu(), processlist) - load_offset = self.displayLoad(stats.getLoad(), stats.getCore(), processlist, cpu_offset) - self.displayMem(stats.getMem(), stats.getMemSwap(), processlist, load_offset) - network_count = self.displayNetwork(stats.getNetwork(), error=stats.network_error_tag) - sensors_count = self.displaySensors(stats.getSensors(), - self.network_y + network_count) - hddtemp_count = self.displayHDDTemp(stats.getHDDTemp(), - self.network_y + network_count + sensors_count) - diskio_count = self.displayDiskIO(stats.getDiskIO(), - offset_y=self.network_y + sensors_count + - network_count + hddtemp_count, - error=stats.diskio_error_tag) - fs_count = self.displayFs(stats.getFs(), - self.network_y + sensors_count + - network_count + diskio_count + - hddtemp_count) - log_count = self.displayLog(self.network_y + sensors_count + network_count + - diskio_count + fs_count + - hddtemp_count) - self.displayProcess(processcount, processlist, stats.getSortedBy(), - log_count=log_count, core=stats.getCore(), cs_status=cs_status) - self.displayCaption(cs_status=cs_status) + + if not self.help_tag: + # Display stats + self.displaySystem(stats.getHost(), stats.getSystem()) + cpu_offset = self.displayCpu(stats.getCpu(), stats.getPerCpu(), processlist) + load_offset = self.displayLoad(stats.getLoad(), stats.getCore(), processlist, cpu_offset) + self.displayMem(stats.getMem(), stats.getMemSwap(), processlist, cpu_offset) + network_count = self.displayNetwork(stats.getNetwork(), error=stats.network_error_tag) + sensors_count = self.displaySensors(stats.getSensors(), + self.network_y + network_count) + hddtemp_count = self.displayHDDTemp(stats.getHDDTemp(), + self.network_y + network_count + sensors_count) + diskio_count = self.displayDiskIO(stats.getDiskIO(), + offset_y=self.network_y + sensors_count + + network_count + hddtemp_count, + error=stats.diskio_error_tag) + fs_count = self.displayFs(stats.getFs(), + self.network_y + sensors_count + + network_count + diskio_count + + hddtemp_count) + log_count = self.displayLog(self.network_y + sensors_count + network_count + + diskio_count + fs_count + + hddtemp_count) + self.displayProcess(processcount, processlist, stats.getSortedBy(), + log_count=log_count, core=stats.getCore(), cs_status=cs_status) + self.displayCaption(cs_status=cs_status) self.displayHelp(core=stats.getCore()) self.displayBat(stats.getBatPercent()) self.displayNow(stats.getNow()) @@ -2480,13 +2516,13 @@ class glancesScreen: # Do you want it ? # If yes then tag_percpu = True if self.percpu_tag: - tag_percpu = screen_x > self.cpu_x + 79 + (len(percpu) - 1) * 10 + tag_percpu = screen_x > self.cpu_x + 79 + max(0,(len(percpu) - 3)) * 10 else: tag_percpu = False # compute x offset if tag_percpu: - offset_x = (len(percpu) - 1) * 8 + offset_x = max(0,(len(percpu) - 3)) * 8 elif tag_extendedcpu: offset_x = 16 else: From c0c34d2dd0b65d44f7801be57e58b406271393ca Mon Sep 17 00:00:00 2001 From: fraoustin Date: Wed, 21 Aug 2013 21:32:48 +0200 Subject: [PATCH 08/22] Update glances.py add manage keyboard for terminal windows add correction for multicpu --- glances/glances.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/glances/glances.py b/glances/glances.py index ef4ffad2..775c9884 100644 --- a/glances/glances.py +++ b/glances/glances.py @@ -2420,7 +2420,7 @@ class glancesScreen: self.displaySystem(stats.getHost(), stats.getSystem()) cpu_offset = self.displayCpu(stats.getCpu(), stats.getPerCpu(), processlist) load_offset = self.displayLoad(stats.getLoad(), stats.getCore(), processlist, cpu_offset) - self.displayMem(stats.getMem(), stats.getMemSwap(), processlist, load_offset) + self.displayMem(stats.getMem(), stats.getMemSwap(), processlist, cpu_offset) network_count = self.displayNetwork(stats.getNetwork(), error=stats.network_error_tag) sensors_count = self.displaySensors(stats.getSensors(), self.network_y + network_count) @@ -2516,13 +2516,13 @@ class glancesScreen: # Do you want it ? # If yes then tag_percpu = True if self.percpu_tag: - tag_percpu = screen_x > self.cpu_x + 79 + (len(percpu) - 1) * 10 + tag_percpu = screen_x > self.cpu_x + 79 + max(0,(len(percpu) - 3)) * 10 else: tag_percpu = False # compute x offset if tag_percpu: - offset_x = (len(percpu) - 1) * 8 + offset_x = max(0,(len(percpu) - 3)) * 8 elif tag_extendedcpu: offset_x = 16 else: From 65a34b7fa48fa0d518aaa194aca99b369724d1da Mon Sep 17 00:00:00 2001 From: fraoustin Date: Thu, 22 Aug 2013 10:12:01 +0200 Subject: [PATCH 09/22] Update glances.py correction of min offset --- glances/glances.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glances/glances.py b/glances/glances.py index 775c9884..58e159e9 100644 --- a/glances/glances.py +++ b/glances/glances.py @@ -2522,7 +2522,7 @@ class glancesScreen: # compute x offset if tag_percpu: - offset_x = max(0,(len(percpu) - 3)) * 8 + offset_x = max(16,(len(percpu) - 3)) * 8 elif tag_extendedcpu: offset_x = 16 else: From c8dd63ab09559ebd8a6179925b346ad8e654a9b9 Mon Sep 17 00:00:00 2001 From: fraoustin Date: Thu, 22 Aug 2013 10:12:41 +0200 Subject: [PATCH 10/22] Update glances.py correction of min offset --- glances/glances.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glances/glances.py b/glances/glances.py index 775c9884..58e159e9 100644 --- a/glances/glances.py +++ b/glances/glances.py @@ -2522,7 +2522,7 @@ class glancesScreen: # compute x offset if tag_percpu: - offset_x = max(0,(len(percpu) - 3)) * 8 + offset_x = max(16,(len(percpu) - 3)) * 8 elif tag_extendedcpu: offset_x = 16 else: From e38e96c6679063fb4fb20bd669f05144335ed049 Mon Sep 17 00:00:00 2001 From: fraoustin Date: Thu, 22 Aug 2013 10:46:02 +0200 Subject: [PATCH 11/22] Update glances.py --- glances/glances.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/glances/glances.py b/glances/glances.py index 58e159e9..95ef1130 100644 --- a/glances/glances.py +++ b/glances/glances.py @@ -2516,13 +2516,13 @@ class glancesScreen: # Do you want it ? # If yes then tag_percpu = True if self.percpu_tag: - tag_percpu = screen_x > self.cpu_x + 79 + max(0,(len(percpu) - 3)) * 10 + tag_percpu = screen_x > self.cpu_x + 79 + (len(percpu) - 1) * 10 else: tag_percpu = False # compute x offset if tag_percpu: - offset_x = max(16,(len(percpu) - 3)) * 8 + offset_x = (len(percpu) - 1) * 8 elif tag_extendedcpu: offset_x = 16 else: From bc872f61cc3d05ec1abbada289309f372a3b869e Mon Sep 17 00:00:00 2001 From: fraoustin Date: Thu, 22 Aug 2013 10:46:25 +0200 Subject: [PATCH 12/22] Update glances.py --- glances/glances.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/glances/glances.py b/glances/glances.py index 58e159e9..95ef1130 100644 --- a/glances/glances.py +++ b/glances/glances.py @@ -2516,13 +2516,13 @@ class glancesScreen: # Do you want it ? # If yes then tag_percpu = True if self.percpu_tag: - tag_percpu = screen_x > self.cpu_x + 79 + max(0,(len(percpu) - 3)) * 10 + tag_percpu = screen_x > self.cpu_x + 79 + (len(percpu) - 1) * 10 else: tag_percpu = False # compute x offset if tag_percpu: - offset_x = max(16,(len(percpu) - 3)) * 8 + offset_x = (len(percpu) - 1) * 8 elif tag_extendedcpu: offset_x = 16 else: From 77661d5919487d800e3e43fba285947a208c1704 Mon Sep 17 00:00:00 2001 From: fraoustin Date: Fri, 23 Aug 2013 19:01:38 +0200 Subject: [PATCH 13/22] del colorconsole --- requirements.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 4b9a2506..bca35be9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1 @@ psutil==1.0.1 -colorconsole==0.6 From 3f4259eaa67d740e4ac7f7ebcc8630ec6d59652c Mon Sep 17 00:00:00 2001 From: fraoustin Date: Fri, 23 Aug 2013 19:04:21 +0200 Subject: [PATCH 14/22] add colorconsole for platform windows --- setup.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 4cb5512e..c7a42f50 100755 --- a/setup.py +++ b/setup.py @@ -28,6 +28,11 @@ data_files.append((etc_path, ['glances/conf/glances.conf'])) for mo in glob.glob('i18n/*/LC_MESSAGES/*.mo'): data_files.append((os.path.dirname(mo).replace('i18n/', 'share/locale/'), [mo])) +if sys.platform.startswith('win'): + requires = ['psutil>=0.5.1', 'colorconsole==0.6'] +else: + requires = ['psutil>=0.5.1'] + setup( name='Glances', version='1.7.1', @@ -39,7 +44,7 @@ setup( # Alternative download_url='https://s3.amazonaws.com/glances/glances-1.7.1.tar.gz', license="LGPL", keywords="cli curses monitoring system", - install_requires=['psutil>=0.5.1'], + install_requires=requires, extras_require={ 'HTML': ['jinja2'], 'SENSORS': ['pysensors'], From d22d1b32003b4d2fb32d4f096396b99f8b23f4fa Mon Sep 17 00:00:00 2001 From: fraoustin Date: Tue, 20 Aug 2013 19:24:49 +0200 Subject: [PATCH 15/22] Update glances.py add client console for windows --- glances/glances.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/glances/glances.py b/glances/glances.py index 95ef1130..364b0165 100644 --- a/glances/glances.py +++ b/glances/glances.py @@ -1548,13 +1548,13 @@ class GlancesStats: if psutil_net_io_counters: # psutil >= 1.0.0 try: - get_net_io_counters = psutil.net_io_counters(pernic=True) + get_net_io_counters = psutil.net_io_counters(pernic=True) except IOError: self.network_error_tag = True else: # psutil < 1.0.0 try: - get_net_io_counters = psutil.network_io_counters(pernic=True) + get_net_io_counters = psutil.network_io_counters(pernic=True) except IOError: self.network_error_tag = True @@ -1564,7 +1564,7 @@ class GlancesStats: except IOError: self.network_error_tag = True except UnboundLocalError: - self.network_error_tag = True + self.network_error_tag = True else: self.network_new = get_net_io_counters for net in self.network_new: From 81e890557ab62e7a17c7d740984fce8422ccf2db Mon Sep 17 00:00:00 2001 From: fraoustin Date: Tue, 20 Aug 2013 19:33:49 +0200 Subject: [PATCH 16/22] Update requirements.txt add colorconsole --- requirements.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/requirements.txt b/requirements.txt index bca35be9..4b9a2506 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1,2 @@ psutil==1.0.1 +colorconsole==0.6 From 138b68798eabce707c52e8e67546469a9ab9e28d Mon Sep 17 00:00:00 2001 From: fraoustin Date: Wed, 21 Aug 2013 21:32:13 +0200 Subject: [PATCH 17/22] Update glances.py add manage keyboard for terminal windows add correction for multicpu --- glances/glances.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/glances/glances.py b/glances/glances.py index 364b0165..348a4b46 100644 --- a/glances/glances.py +++ b/glances/glances.py @@ -2516,13 +2516,13 @@ class glancesScreen: # Do you want it ? # If yes then tag_percpu = True if self.percpu_tag: - tag_percpu = screen_x > self.cpu_x + 79 + (len(percpu) - 1) * 10 + tag_percpu = screen_x > self.cpu_x + 79 + max(0,(len(percpu) - 3)) * 10 else: tag_percpu = False # compute x offset if tag_percpu: - offset_x = (len(percpu) - 1) * 8 + offset_x = max(0,(len(percpu) - 3)) * 8 elif tag_extendedcpu: offset_x = 16 else: From ade2e368fb18bd7af0a13b94f3ae9a8bfcf52ed2 Mon Sep 17 00:00:00 2001 From: fraoustin Date: Thu, 22 Aug 2013 10:12:41 +0200 Subject: [PATCH 18/22] Update glances.py correction of min offset --- glances/glances.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/glances/glances.py b/glances/glances.py index 348a4b46..2d5617c6 100644 --- a/glances/glances.py +++ b/glances/glances.py @@ -2522,7 +2522,7 @@ class glancesScreen: # compute x offset if tag_percpu: - offset_x = max(0,(len(percpu) - 3)) * 8 + offset_x = max(16,(len(percpu) - 3)) * 8 elif tag_extendedcpu: offset_x = 16 else: From dfaecaf5034880e99df44e7ea7f13b8884da69fb Mon Sep 17 00:00:00 2001 From: fraoustin Date: Thu, 22 Aug 2013 10:46:02 +0200 Subject: [PATCH 19/22] Update glances.py --- glances/glances.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/glances/glances.py b/glances/glances.py index 2d5617c6..364b0165 100644 --- a/glances/glances.py +++ b/glances/glances.py @@ -2516,13 +2516,13 @@ class glancesScreen: # Do you want it ? # If yes then tag_percpu = True if self.percpu_tag: - tag_percpu = screen_x > self.cpu_x + 79 + max(0,(len(percpu) - 3)) * 10 + tag_percpu = screen_x > self.cpu_x + 79 + (len(percpu) - 1) * 10 else: tag_percpu = False # compute x offset if tag_percpu: - offset_x = max(16,(len(percpu) - 3)) * 8 + offset_x = (len(percpu) - 1) * 8 elif tag_extendedcpu: offset_x = 16 else: From 13e5b3f447e9537a776454cd63e880745cd91c88 Mon Sep 17 00:00:00 2001 From: fraoustin Date: Fri, 23 Aug 2013 19:01:38 +0200 Subject: [PATCH 20/22] del colorconsole --- requirements.txt | 1 - 1 file changed, 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 4b9a2506..bca35be9 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,2 +1 @@ psutil==1.0.1 -colorconsole==0.6 From 78bc42d7651768e8321cffdb121007dbba9b1979 Mon Sep 17 00:00:00 2001 From: fraoustin Date: Fri, 23 Aug 2013 19:04:21 +0200 Subject: [PATCH 21/22] add colorconsole for platform windows --- setup.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 4cb5512e..c7a42f50 100755 --- a/setup.py +++ b/setup.py @@ -28,6 +28,11 @@ data_files.append((etc_path, ['glances/conf/glances.conf'])) for mo in glob.glob('i18n/*/LC_MESSAGES/*.mo'): data_files.append((os.path.dirname(mo).replace('i18n/', 'share/locale/'), [mo])) +if sys.platform.startswith('win'): + requires = ['psutil>=0.5.1', 'colorconsole==0.6'] +else: + requires = ['psutil>=0.5.1'] + setup( name='Glances', version='1.7.1', @@ -39,7 +44,7 @@ setup( # Alternative download_url='https://s3.amazonaws.com/glances/glances-1.7.1.tar.gz', license="LGPL", keywords="cli curses monitoring system", - install_requires=['psutil>=0.5.1'], + install_requires=requires, extras_require={ 'HTML': ['jinja2'], 'SENSORS': ['pysensors'], From f902f259a376bf4c3a3176fdc2644225154a5bba Mon Sep 17 00:00:00 2001 From: fraoustin Date: Fri, 23 Aug 2013 20:38:34 +0200 Subject: [PATCH 22/22] rebase --- cdmxyufg.44w.txt | 0 icsnme5v.ryt.txt | 0 ppkkosxe.gxv.txt | 0 3 files changed, 0 insertions(+), 0 deletions(-) create mode 100644 cdmxyufg.44w.txt create mode 100644 icsnme5v.ryt.txt create mode 100644 ppkkosxe.gxv.txt diff --git a/cdmxyufg.44w.txt b/cdmxyufg.44w.txt new file mode 100644 index 00000000..e69de29b diff --git a/icsnme5v.ryt.txt b/icsnme5v.ryt.txt new file mode 100644 index 00000000..e69de29b diff --git a/ppkkosxe.gxv.txt b/ppkkosxe.gxv.txt new file mode 100644 index 00000000..e69de29b