diff options
Diffstat (limited to 'glances/plugins/glances_load.py')
-rw-r--r-- | glances/plugins/glances_load.py | 24 |
1 files changed, 21 insertions, 3 deletions
diff --git a/glances/plugins/glances_load.py b/glances/plugins/glances_load.py index c689173d..aa6e8a13 100644 --- a/glances/plugins/glances_load.py +++ b/glances/plugins/glances_load.py @@ -2,7 +2,7 @@ # # This file is part of Glances. # -# Copyright (C) 2014 Nicolargo <nicolas@nicolargo.com> +# Copyright (C) 2015 Nicolargo <nicolas@nicolargo.com> # # Glances is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as published by @@ -111,8 +111,26 @@ class Plugin(GlancesPlugin): # Update the history list self.update_stats_history() + # Update the view + self.update_views() + return self.stats + def update_views(self): + """Update stats views""" + # Call the father's method + GlancesPlugin.update_views(self) + + # Add specifics informations + try: + # Alert and log + self.views['min15']['decoration'] = self.get_alert_log(self.stats['min15'], max=100 * self.stats['cpucore']) + # Alert only + self.views['min5']['decoration'] = self.get_alert(self.stats['min5'], max=100 * self.stats['cpucore']) + except KeyError: + # try/except mandatory for Windows compatibility (no load stats) + pass + def msg_curse(self, args=None): """Return the dict to display in the curse interface.""" # Init the return message @@ -144,7 +162,7 @@ class Plugin(GlancesPlugin): ret.append(self.curse_add_line(msg)) msg = '{0:>6.2f}'.format(self.stats['min5']) ret.append(self.curse_add_line( - msg, self.get_alert(self.stats['min5'], max=100 * self.stats['cpucore']))) + msg, self.get_views(key='min5', option='decoration'))) # New line ret.append(self.curse_new_line()) # 15min load @@ -152,6 +170,6 @@ class Plugin(GlancesPlugin): ret.append(self.curse_add_line(msg)) msg = '{0:>6.2f}'.format(self.stats['min15']) ret.append(self.curse_add_line( - msg, self.get_alert_log(self.stats['min15'], max=100 * self.stats['cpucore']))) + msg, self.get_views(key='min15', option='decoration'))) return ret |