diff --git a/glances/config.py b/glances/config.py index 77375ad0..edec733b 100644 --- a/glances/config.py +++ b/glances/config.py @@ -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: diff --git a/glances/outputs/glances_curses.py b/glances/outputs/glances_curses.py index 865c0d06..15f08288 100644 --- a/glances/outputs/glances_curses.py +++ b/glances/outputs/glances_curses.py @@ -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'):