From 3b2d6eb21c4ec353f8eae629b2db908034c70e0a Mon Sep 17 00:00:00 2001 From: Nicolas Hennion Date: Fri, 10 Oct 2014 15:27:57 +0200 Subject: [PATCH] Add short key '2' (or --disable-left-sidebar option) to hide the left sidebar --- docs/glances-doc.rst | 4 ++++ glances/core/glances_main.py | 8 +++++--- glances/outputs/glances_curses.py | 26 ++++++++++++++++---------- glances/plugins/glances_help.py | 3 +++ man/glances.1 | 3 +++ 5 files changed, 31 insertions(+), 13 deletions(-) diff --git a/docs/glances-doc.rst b/docs/glances-doc.rst index db28942e..2af9643f 100644 --- a/docs/glances-doc.rst +++ b/docs/glances-doc.rst @@ -133,6 +133,8 @@ Command-Line Options --disable-fs disable filesystem module --disable-network disable network module --disable-sensors disable sensors module + --disable-left-sidebar + disable left sidebar --disable-process disable process module --disable-process-extended disable extended stats on top process @@ -229,6 +231,8 @@ The following commands (key pressed) are supported while in Glances: Show/hide processes stats ``1`` Switch between global CPU and per-CPU stats +``2`` + Enable/disable left sidebar ``/`` Switch between short name / command line (processes name) diff --git a/glances/core/glances_main.py b/glances/core/glances_main.py index 0f780a03..5f5970f4 100644 --- a/glances/core/glances_main.py +++ b/glances/core/glances_main.py @@ -65,15 +65,17 @@ class GlancesMain(object): dest='enable_history', help=_('enable the history mode')) parser.add_argument('--disable-bold', action='store_false', default=True, dest='disable_bold', help=_('disable bold mode in the terminal')) + parser.add_argument('--disable-network', action='store_true', default=False, + dest='disable_network', help=_('disable network module')) parser.add_argument('--disable-diskio', action='store_true', default=False, dest='disable_diskio', help=_('disable disk I/O module')) parser.add_argument('--disable-fs', action='store_true', default=False, dest='disable_fs', help=_('disable filesystem module')) - parser.add_argument('--disable-network', action='store_true', default=False, - dest='disable_network', help=_('disable network module')) parser.add_argument('--disable-sensors', action='store_true', default=False, dest='disable_sensors', help=_('disable sensors module')) - parser.add_argument('--disable-process', action='store_true', default=False, + parser.add_argument('--disable-left-sidebar', action='store_true', default=False, + dest='disable_left_sidebar', help=_('disable network, disk io, FS and sensors modules')) + parser.add_argument('--disable_left_sidebar', action='store_true', default=False, dest='disable_process', help=_('disable process module')) parser.add_argument('--disable-process-extended', action='store_true', default=False, dest='disable_process_extended', help=_('disable extended stats on top process')) diff --git a/glances/outputs/glances_curses.py b/glances/outputs/glances_curses.py index 33454af6..1c06a6ac 100644 --- a/glances/outputs/glances_curses.py +++ b/glances/outputs/glances_curses.py @@ -232,6 +232,9 @@ class GlancesCurses(object): elif self.pressedkey == ord('1'): # '1' > Switch between CPU and PerCPU information self.args.percpu = not self.args.percpu + elif self.pressedkey == ord('2'): + # '2' > Enable/disable left sidebar + self.args.disable_left_sidebar = not self.args.disable_left_sidebar elif self.pressedkey == ord('/'): # '/' > Switch between short/long name for processes self.args.process_short_name = not self.args.process_short_name @@ -468,16 +471,19 @@ class GlancesCurses(object): # Display left sidebar (NETWORK+DISKIO+FS+SENSORS+Current time) self.init_column() - self.new_line() - self.display_plugin(stats_network) - self.new_line() - self.display_plugin(stats_diskio) - self.new_line() - self.display_plugin(stats_fs) - self.new_line() - self.display_plugin(stats_sensors) - self.new_line() - self.display_plugin(stats_now) + if (not (self.args.disable_network and self.args.disable_diskio \ + and self.args.disable_fs and self.args.disable_sensors)) \ + and not self.args.disable_left_sidebar: + self.new_line() + self.display_plugin(stats_network) + self.new_line() + self.display_plugin(stats_diskio) + self.new_line() + self.display_plugin(stats_fs) + self.new_line() + self.display_plugin(stats_sensors) + self.new_line() + self.display_plugin(stats_now) # If space available... if screen_x > 52: diff --git a/glances/plugins/glances_help.py b/glances/plugins/glances_help.py index 0daa886a..25e4f766 100644 --- a/glances/plugins/glances_help.py +++ b/glances/plugins/glances_help.py @@ -116,6 +116,9 @@ class Plugin(GlancesPlugin): ret.append(self.curse_new_line()) msg = msg_col.format("s", _("Show/hide sensors stats")) ret.append(self.curse_add_line(msg)) + ret.append(self.curse_new_line()) + msg = msg_col.format("2", _("Show/hide left sidebar")) + ret.append(self.curse_add_line(msg)) msg = msg_col2.format("g", _("Generate graphs for current history")) ret.append(self.curse_add_line(msg)) ret.append(self.curse_new_line()) diff --git a/man/glances.1 b/man/glances.1 index 57f9dbcd..0b7d17ea 100644 --- a/man/glances.1 +++ b/man/glances.1 @@ -55,6 +55,9 @@ disable network module .B \-\-disable-sensors disable sensors module .TP +.B \-\-disable-left-sidebar +disable network, disk IO, FS and sensors modules +.TP .B \-\-disable-process disable process module .TP