mirror of
https://github.com/nicolargo/glances.git
synced 2026-03-14 20:07:23 -04:00
Fix string format conflicts
This commit is contained in:
@@ -336,7 +336,7 @@ class glancesCurses:
|
||||
self.display_plugin(stats_processcount)
|
||||
self.display_plugin(stats_monitor)
|
||||
self.display_plugin(stats_processlist,
|
||||
max_y=(screen_y - self.get_stats_display_height(stats_alert) - 3))
|
||||
max_y=(screen_y - self.get_stats_display_height(stats_alert) - 2))
|
||||
self.display_plugin(stats_alert)
|
||||
|
||||
return True
|
||||
|
||||
@@ -42,7 +42,7 @@ class Plugin(GlancesPlugin):
|
||||
# Enter -1 to right align
|
||||
self.column_curse = 1
|
||||
# Enter -1 to diplay bottom
|
||||
self.line_curse = 5
|
||||
self.line_curse = -1
|
||||
|
||||
def update(self):
|
||||
"""
|
||||
|
||||
@@ -97,13 +97,13 @@ class Plugin(GlancesPlugin):
|
||||
msg = "{0:8}".format(_("CPU"))
|
||||
ret.append(self.curse_add_line(msg, "TITLE"))
|
||||
# Total CPU usage
|
||||
msg = "{0}".format(format((100 - self.stats['idle']) / 100, '>6.1%'))
|
||||
msg = "{0:>6.1%}".format((100 - self.stats['idle']) / 100)
|
||||
ret.append(self.curse_add_line(msg))
|
||||
# Nice CPU
|
||||
if 'nice' in self.stats:
|
||||
msg = " {0:8}".format(_("nice:"))
|
||||
ret.append(self.curse_add_line(msg))
|
||||
msg = "{0}".format(format(self.stats['nice'] / 100, '>6.1%'))
|
||||
msg = "{0:>6.1%}".format(self.stats['nice'] / 100)
|
||||
ret.append(self.curse_add_line(msg, optional=True))
|
||||
# New line
|
||||
ret.append(self.curse_new_line())
|
||||
@@ -111,13 +111,13 @@ class Plugin(GlancesPlugin):
|
||||
if 'user' in self.stats:
|
||||
msg = "{0:8}".format(_("user:"))
|
||||
ret.append(self.curse_add_line(msg))
|
||||
msg = "{0}".format(format(self.stats['user'] / 100, '>6.1%'))
|
||||
msg = "{0:>6.1%}".format(self.stats['user'] / 100)
|
||||
ret.append(self.curse_add_line(msg, self.get_alert_log(self.stats['user'], header="user")))
|
||||
# IRQ CPU
|
||||
if 'irq' in self.stats:
|
||||
msg = " {0:8}".format(_("irq:"))
|
||||
ret.append(self.curse_add_line(msg, optional=True))
|
||||
msg = "{0}".format(format(self.stats['irq'] / 100, '>6.1%'))
|
||||
msg = "{0:>6.1%}".format(self.stats['irq'] / 100)
|
||||
ret.append(self.curse_add_line(msg, optional=True))
|
||||
# New line
|
||||
ret.append(self.curse_new_line())
|
||||
@@ -125,13 +125,13 @@ class Plugin(GlancesPlugin):
|
||||
if 'system' in self.stats:
|
||||
msg = "{0:8}".format(_("system:"))
|
||||
ret.append(self.curse_add_line(msg))
|
||||
msg = "{0}".format(format(self.stats['system'] / 100, '>6.1%'))
|
||||
msg = "{0:>6.1%}".format(self.stats['system'] / 100)
|
||||
ret.append(self.curse_add_line(msg, self.get_alert_log(self.stats['system'], header="system")))
|
||||
# IOWait CPU
|
||||
if 'iowait' in self.stats:
|
||||
msg = " {0:8}".format(_("iowait:"))
|
||||
ret.append(self.curse_add_line(msg, optional=True))
|
||||
msg = "{0}".format(format(self.stats['iowait'] / 100, '>6.1%'))
|
||||
msg = "{0:>6.1%}".format(self.stats['iowait'] / 100)
|
||||
ret.append(self.curse_add_line(msg, self.get_alert_log(self.stats['iowait'], header="iowait"), optional=True))
|
||||
# New line
|
||||
ret.append(self.curse_new_line())
|
||||
@@ -139,13 +139,13 @@ class Plugin(GlancesPlugin):
|
||||
if 'idle' in self.stats:
|
||||
msg = "{0:8}".format(_("idle:"))
|
||||
ret.append(self.curse_add_line(msg, optional=True))
|
||||
msg = "{0}".format(format(self.stats['idle'] / 100, '>6.1%'))
|
||||
msg = "{0:>6.1%}".format(self.stats['idle'] / 100)
|
||||
ret.append(self.curse_add_line(msg))
|
||||
# Steal CPU usage
|
||||
if 'steal' in self.stats:
|
||||
msg = " {0:8}".format(_("steal:"))
|
||||
ret.append(self.curse_add_line(msg, optional=True))
|
||||
msg = "{0}".format(format(self.stats['steal'] / 100, '>6.1%'))
|
||||
msg = "{0:>6.1%}".format(self.stats['steal'] / 100)
|
||||
ret.append(self.curse_add_line(msg, self.get_alert(self.stats['steal'], header="steal"), optional=True))
|
||||
|
||||
# Return the message with decoration
|
||||
|
||||
@@ -87,24 +87,24 @@ class Plugin(GlancesPlugin):
|
||||
|
||||
# Build the string message
|
||||
# Header
|
||||
msg = "{0:8}".format(_("LOAD"))
|
||||
msg = "{0:4}".format(_("LOAD"))
|
||||
ret.append(self.curse_add_line(msg, "TITLE"))
|
||||
# Core number
|
||||
msg = "{0:>6}".format(str(self.core_plugin.update()["log"]) + _("-core"))
|
||||
msg = _("{0:>5}-core").format(str(self.core_plugin.update()["log"]))
|
||||
ret.append(self.curse_add_line(msg))
|
||||
# New line
|
||||
ret.append(self.curse_new_line())
|
||||
# 1min load
|
||||
msg = "{0:8}".format(_("1 min:"))
|
||||
ret.append(self.curse_add_line(msg))
|
||||
msg = "{0:>6}".format(format(self.stats['min1'], '.2f'))
|
||||
msg = "{0:>6.2f}".format(self.stats['min1'])
|
||||
ret.append(self.curse_add_line(msg))
|
||||
# New line
|
||||
ret.append(self.curse_new_line())
|
||||
# 5min load
|
||||
msg = "{0:8}".format(_("5 min:"))
|
||||
ret.append(self.curse_add_line(msg))
|
||||
msg = "{0:>6}".format(format(self.stats['min5'], '.2f'))
|
||||
msg = "{0:>6.2f}".format(self.stats['min5'])
|
||||
ret.append(self.curse_add_line(
|
||||
msg, self.get_alert(self.stats['min5'], max=100 * self.core_plugin.update()["log"])))
|
||||
# New line
|
||||
@@ -112,7 +112,7 @@ class Plugin(GlancesPlugin):
|
||||
# 15min load
|
||||
msg = "{0:8}".format(_("15 min:"))
|
||||
ret.append(self.curse_add_line(msg))
|
||||
msg = "{0:>6}".format(format(self.stats['min15'], '.2f'))
|
||||
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.core_plugin.update()["log"])))
|
||||
|
||||
|
||||
@@ -135,7 +135,7 @@ class Plugin(GlancesPlugin):
|
||||
|
||||
# Total CPU usage
|
||||
for cpu in self.stats:
|
||||
msg = " {0}".format(format((100 - cpu['idle']) / 100, '>6.1%'))
|
||||
msg = " {0:>6.1%}".format((100 - cpu['idle']) / 100)
|
||||
ret.append(self.curse_add_line(msg))
|
||||
|
||||
# User CPU
|
||||
@@ -145,7 +145,7 @@ class Plugin(GlancesPlugin):
|
||||
msg = "{0:8}".format(_("user:"))
|
||||
ret.append(self.curse_add_line(msg))
|
||||
for cpu in self.stats:
|
||||
msg = " {0}".format(format(cpu['user'] / 100, '>6.1%'))
|
||||
msg = " {0:>6.1%}".format(cpu['user'] / 100)
|
||||
ret.append(self.curse_add_line(msg, self.get_alert(cpu['user'], header="user")))
|
||||
|
||||
# System CPU
|
||||
@@ -155,7 +155,7 @@ class Plugin(GlancesPlugin):
|
||||
msg = "{0:8}".format(_("system:"))
|
||||
ret.append(self.curse_add_line(msg))
|
||||
for cpu in self.stats:
|
||||
msg = " {0}".format(format(cpu['system'] / 100, '>6.1%'))
|
||||
msg = " {0:>6.1%}".format(cpu['system'] / 100)
|
||||
ret.append(self.curse_add_line(msg, self.get_alert(cpu['system'], header="system")))
|
||||
|
||||
# IoWait CPU
|
||||
@@ -165,7 +165,7 @@ class Plugin(GlancesPlugin):
|
||||
msg = "{0:8}".format(_("iowait:"))
|
||||
ret.append(self.curse_add_line(msg))
|
||||
for cpu in self.stats:
|
||||
msg = " {0}".format(format(cpu['iowait'] / 100, '>6.1%'))
|
||||
msg = " {0:>6.1%}".format(cpu['iowait'] / 100)
|
||||
ret.append(self.curse_add_line(msg, self.get_alert(cpu['iowait'], header="iowait")))
|
||||
|
||||
# Return the message with decoration
|
||||
|
||||
@@ -95,9 +95,9 @@ class Plugin(GlancesPlugin):
|
||||
ret.append(self.curse_add_line(msg, optional=True))
|
||||
msg = " {0:10}".format(_("USER"))
|
||||
ret.append(self.curse_add_line(msg, optional=True))
|
||||
msg = "{0:>3}".format(_("NI"))
|
||||
msg = "{0:>4}".format(_("NI"))
|
||||
ret.append(self.curse_add_line(msg, optional=True))
|
||||
msg = " {0:1}".format(_("S"))
|
||||
msg = "{0:>2}".format(_("S"))
|
||||
ret.append(self.curse_add_line(msg, optional=True))
|
||||
msg = "{0:>9}".format(_("TIME+"))
|
||||
ret.append(self.curse_add_line(msg, optional=True))
|
||||
@@ -115,11 +115,11 @@ class Plugin(GlancesPlugin):
|
||||
for p in self.sortlist(process_sort_key):
|
||||
ret.append(self.curse_new_line())
|
||||
# CPU
|
||||
msg = "{0:>6}".format(format(p['cpu_percent'], '>5.1f'))
|
||||
msg = "{0:>6.1f}".format(p['cpu_percent'])
|
||||
ret.append(self.curse_add_line(msg,
|
||||
self.get_alert(p['cpu_percent'], header="cpu")))
|
||||
# MEM
|
||||
msg = "{0:>6}".format(format(p['memory_percent'], '>5.1f'))
|
||||
msg = "{0:>6.1f}".format(p['memory_percent'])
|
||||
ret.append(self.curse_add_line(msg,
|
||||
self.get_alert(p['memory_percent'], header="mem")))
|
||||
# VMS
|
||||
@@ -136,14 +136,14 @@ class Plugin(GlancesPlugin):
|
||||
ret.append(self.curse_add_line(msg, optional=True))
|
||||
# NICE
|
||||
nice = p['nice']
|
||||
msg = " {0:>3}".format(nice)
|
||||
msg = "{0:>5}".format(nice)
|
||||
if nice != 0:
|
||||
ret.append(self.curse_add_line(msg, decoration='NICE', optional=True))
|
||||
else:
|
||||
ret.append(self.curse_add_line(msg, optional=True))
|
||||
# STATUS
|
||||
status = p['status']
|
||||
msg = " {0:>1}".format(status)
|
||||
msg = "{0:>2}".format(status)
|
||||
if status == 'R':
|
||||
ret.append(self.curse_add_line(msg, decoration='STATUS', optional=True))
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user