mirror of
https://github.com/nicolargo/glances.git
synced 2024-12-23 09:11:49 +03:00
Merge branch 'refactor_curses' into develop
This commit is contained in:
commit
de369be5b3
@ -241,6 +241,13 @@ class Config(object):
|
||||
except NoOptionError:
|
||||
return default
|
||||
|
||||
def get_int_value(self, section, option, default=0):
|
||||
"""Get the int value of an option, if it exists."""
|
||||
try:
|
||||
return self.parser.getint(section, option)
|
||||
except NoOptionError:
|
||||
return int(default)
|
||||
|
||||
def get_float_value(self, section, option, default=0.0):
|
||||
"""Get the float value of an option, if it exists."""
|
||||
try:
|
||||
|
@ -113,7 +113,6 @@ class _GlancesCurses(object):
|
||||
# Load the 'outputs' section of the configuration file
|
||||
# - Init the theme (default is black)
|
||||
self.theme = {'name': 'black'}
|
||||
self.load_config(self.config)
|
||||
|
||||
# Init cursor
|
||||
self._init_cursor()
|
||||
@ -382,32 +381,48 @@ class _GlancesCurses(object):
|
||||
glances_processes.enable_extended()
|
||||
|
||||
if self.args.disable_top:
|
||||
self.args.disable_quicklook = True
|
||||
self.args.disable_cpu = True
|
||||
self.args.disable_mem = True
|
||||
self.args.disable_memswap = True
|
||||
self.args.disable_load = True
|
||||
self.disable_top()
|
||||
else:
|
||||
self.args.disable_quicklook = False
|
||||
self.args.disable_cpu = False
|
||||
self.args.disable_mem = False
|
||||
self.args.disable_memswap = False
|
||||
self.args.disable_load = False
|
||||
self.enable_top()
|
||||
|
||||
if self.args.full_quicklook:
|
||||
self.args.disable_quicklook = False
|
||||
self.args.disable_cpu = True
|
||||
self.args.disable_mem = True
|
||||
self.args.disable_memswap = True
|
||||
self.enable_fullquicklook()
|
||||
else:
|
||||
self.args.disable_quicklook = False
|
||||
self.args.disable_cpu = False
|
||||
self.args.disable_mem = False
|
||||
self.args.disable_memswap = False
|
||||
self.disable_fullquicklook()
|
||||
|
||||
# Return the key code
|
||||
return self.pressedkey
|
||||
|
||||
def disable_top(self):
|
||||
"""Disable the top panel"""
|
||||
self.args.disable_quicklook = True
|
||||
self.args.disable_cpu = True
|
||||
self.args.disable_mem = True
|
||||
self.args.disable_memswap = True
|
||||
self.args.disable_load = True
|
||||
|
||||
def enable_top(self):
|
||||
"""Enable the top panel"""
|
||||
self.args.disable_quicklook = False
|
||||
self.args.disable_cpu = False
|
||||
self.args.disable_mem = False
|
||||
self.args.disable_memswap = False
|
||||
self.args.disable_load = False
|
||||
|
||||
def disable_fullquicklook(self):
|
||||
"""Disable the full quicklook mode"""
|
||||
self.args.disable_quicklook = False
|
||||
self.args.disable_cpu = False
|
||||
self.args.disable_mem = False
|
||||
self.args.disable_memswap = False
|
||||
|
||||
def enable_fullquicklook(self):
|
||||
"""Disable the full quicklook mode"""
|
||||
self.args.disable_quicklook = False
|
||||
self.args.disable_cpu = True
|
||||
self.args.disable_mem = True
|
||||
self.args.disable_memswap = True
|
||||
|
||||
def end(self):
|
||||
"""Shutdown the curses window."""
|
||||
if hasattr(curses, 'echo'):
|
||||
|
Loading…
Reference in New Issue
Block a user