Add a new tag to disable the top menu (--disable-top and '5' shortcut) (issue #766)

This commit is contained in:
nicolargo 2016-01-10 09:40:53 +01:00
parent c4ae40cce3
commit d75a9ee9d7
3 changed files with 30 additions and 7 deletions

View File

@ -128,9 +128,12 @@ Start the client browser (browser mode):\n\
dest='disable_raid', help='disable RAID module')
parser.add_argument('--disable-docker', action='store_true', default=False,
dest='disable_docker', help='disable Docker module')
parser.add_argument('-5', '--disable-top', action='store_true',
default=False, dest='disable_top',
help='disable top menu (QL, CPU, MEM, SWAP and LOAD)')
parser.add_argument('-2', '--disable-left-sidebar', action='store_true',
default=False, dest='disable_left_sidebar',
help='disable network, disk I/O, FS and sensors modules (py3sensors needed)')
help='disable network, disk I/O, FS and sensors modules')
parser.add_argument('--disable-process', action='store_true', default=False,
dest='disable_process', help='disable process module')
parser.add_argument('--disable-log', action='store_true', default=False,
@ -276,17 +279,21 @@ Start the client browser (browser mode):\n\
# Manage full quicklook option
if args.full_quicklook:
logger.info("Disable QuickLook menu")
args.disable_quicklook = False
args.disable_cpu = True
args.disable_mem = True
args.disable_swap = True
args.disable_load = False
else:
args.disable_quicklook = False
args.disable_cpu = False
args.disable_mem = False
args.disable_swap = False
args.disable_load = False
# Manage disable_top option
if args.disable_top:
logger.info("Disable top menu")
args.disable_quicklook = True
args.disable_cpu = True
args.disable_mem = True
args.disable_swap = True
args.disable_load = True
# Control parameter and exit if it is not OK
self.args = args

View File

@ -305,6 +305,21 @@ class _GlancesCurses(object):
self.args.disable_cpu = False
self.args.disable_mem = False
self.args.disable_swap = False
elif self.pressedkey == ord('5'):
# '5' > Enable/disable top menu
self.args.disable_top = not self.args.disable_top
if self.args.disable_top:
self.args.disable_quicklook = False
self.args.disable_cpu = False
self.args.disable_mem = False
self.args.disable_swap = False
self.args.disable_load = False
else:
self.args.disable_quicklook = True
self.args.disable_cpu = True
self.args.disable_mem = True
self.args.disable_swap = True
self.args.disable_load = True
elif self.pressedkey == ord('/'):
# '/' > Switch between short/long name for processes
self.args.process_short_name = not self.args.process_short_name

View File

@ -22,6 +22,7 @@
from glances.cpu_percent import cpu_percent
from glances.outputs.glances_bars import Bar
from glances.plugins.glances_plugin import GlancesPlugin
from glances.logger import logger
import psutil