Fix load & memory display in curses and web server mode

Use the longest string as reference and alignment point.
pull/367/head
Alessio Sergi 2014-05-28 11:33:22 +02:00
parent 388406048f
commit 9ae4effd9b
2 changed files with 9 additions and 9 deletions

View File

@ -120,11 +120,11 @@ class Plugin(GlancesPlugin):
# Build the string message
# Header
msg = "{0:4}".format(_("LOAD"))
msg = "{0:8}".format(_("LOAD"))
ret.append(self.curse_add_line(msg, "TITLE"))
# Core number
if self.stats['cpucore'] > 0:
msg = _("{0:>5}-core").format(self.stats['cpucore'])
msg = _("{0:>1}-core").format(self.stats['cpucore'])
ret.append(self.curse_add_line(msg))
# New line
ret.append(self.curse_new_line())

View File

@ -152,47 +152,47 @@ class Plugin(GlancesPlugin):
ret.append(self.curse_add_line(msg))
# Active memory usage
if 'active' in self.stats:
msg = " {0:8}".format(_("active")[0:7]+':')
msg = " {0:9}".format(_("active:"))
ret.append(self.curse_add_line(msg, optional=True))
msg = "{0:>7}".format(self.auto_unit(self.stats['active']))
ret.append(self.curse_add_line(msg, optional=True))
# New line
ret.append(self.curse_new_line())
# Total memory usage
msg = "{0:6}".format(_("total")[0:5]+':')
msg = "{0:6}".format(_("total:"))
ret.append(self.curse_add_line(msg))
msg = "{0:>7}".format(self.auto_unit(self.stats['total']))
ret.append(self.curse_add_line(msg))
# Inactive memory usage
if 'inactive' in self.stats:
msg = " {0:8}".format(_("inactive")[0:7]+':')
msg = " {0:9}".format(_("inactive:"))
ret.append(self.curse_add_line(msg, optional=True))
msg = "{0:>7}".format(self.auto_unit(self.stats['inactive']))
ret.append(self.curse_add_line(msg, optional=True))
# New line
ret.append(self.curse_new_line())
# Used memory usage
msg = "{0:6}".format(_("used")[0:5]+':')
msg = "{0:6}".format(_("used:"))
ret.append(self.curse_add_line(msg))
msg = "{0:>7}".format(self.auto_unit(self.stats['used']))
ret.append(self.curse_add_line(
msg, self.get_alert_log(self.stats['used'], max=self.stats['total'])))
# Buffers memory usage
if 'buffers' in self.stats:
msg = " {0:8}".format(_("buffers")[0:7]+':')
msg = " {0:9}".format(_("buffers:"))
ret.append(self.curse_add_line(msg, optional=True))
msg = "{0:>7}".format(self.auto_unit(self.stats['buffers']))
ret.append(self.curse_add_line(msg, optional=True))
# New line
ret.append(self.curse_new_line())
# Free memory usage
msg = "{0:6}".format(_("free")[0:5]+':')
msg = "{0:6}".format(_("free:"))
ret.append(self.curse_add_line(msg))
msg = "{0:>7}".format(self.auto_unit(self.stats['free']))
ret.append(self.curse_add_line(msg))
# Cached memory usage
if 'cached' in self.stats:
msg = " {0:8}".format(_("cached")[0:7]+':')
msg = " {0:9}".format(_("cached:"))
ret.append(self.curse_add_line(msg, optional=True))
msg = "{0:>7}".format(self.auto_unit(self.stats['cached']))
ret.append(self.curse_add_line(msg, optional=True))