add hide_ok option support both globally (precedence) and per plugin, true by default

This commit is contained in:
Von Random 2017-01-13 14:00:37 +03:00
parent 31ece2995a
commit 4834c25da4
4 changed files with 6 additions and 5 deletions

View file

@ -10,6 +10,7 @@ class PluginThreadCommon:
self.thread.daemon = True
self.freq = config.getint(section, 'freq', fallback=1)
self.problem_value = config.getint(section, 'problem', fallback=70)
self.hide_ok = config.getboolean(section, 'hide_ok', fallback=True)
if config.has_option(section, 'color'):
self.status['color'] = config.get(section, 'color')

View file

@ -5,7 +5,6 @@ import plugins
class PluginThread(plugins.PluginThreadCommon):
def __init__(self, section, config):
super(PluginThread, self).__init__(section, config)
self.hide_ok = config.getboolean(section, 'hide_ok', fallback=False)
def main(self):
loads = os.getloadavg()
@ -13,7 +12,7 @@ class PluginThread(plugins.PluginThreadCommon):
self.hide = False
self.status['urgent'] = True
else:
self.hide = self.hide_ok
self.hide = True
self.status['urgent'] = False
loads = [str(i) for i in loads]
self.status['full_text'] = 'LA: ' + ' '.join(loads)