aboutsummaryrefslogtreecommitdiffstats
path: root/src/monitor.py
diff options
context:
space:
mode:
authorPapoteur <papoteur@mageia.org>2020-05-31 12:13:05 +0200
committerPapoteur <papoteur@mageia.org>2020-05-31 12:13:05 +0200
commitfbe6a0a6793b736aedb44182008586d17b5b4f94 (patch)
tree4b98f426e604fcf8e4718df34ad6ea849186a4ca /src/monitor.py
parent4bdc9a3dea4411ac8512df66667c42707d0fbd4a (diff)
downloadnet_monitor-fbe6a0a6793b736aedb44182008586d17b5b4f94.tar
net_monitor-fbe6a0a6793b736aedb44182008586d17b5b4f94.tar.gz
net_monitor-fbe6a0a6793b736aedb44182008586d17b5b4f94.tar.bz2
net_monitor-fbe6a0a6793b736aedb44182008586d17b5b4f94.tar.xz
net_monitor-fbe6a0a6793b736aedb44182008586d17b5b4f94.zip
Improve formatting to avoid resizing of the windows
Format ESSID in unicode
Diffstat (limited to 'src/monitor.py')
-rw-r--r--src/monitor.py10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/monitor.py b/src/monitor.py
index 7923103..e7a3c12 100644
--- a/src/monitor.py
+++ b/src/monitor.py
@@ -146,7 +146,7 @@ class Monitor:
addr, length = buffer.buffer_info()
arg = struct.pack('Pi', addr, length)
self.wifi_ioctl(iface, self.SIOCGIWESSID, arg)
- return buffer.tobytes().strip(b'\0')
+ return buffer.tobytes().strip(b'\0').decode('utf-8')
def wifi_get_mode(self, iface):
"""Get current mode from an interface"""
@@ -274,13 +274,13 @@ class Monitor:
# convert to float
size_f = size * 1.0
pretty_size = None
- pretty_bytes = "%d Bytes%s" % (size, opt)
+ pretty_bytes = _("%d Bytes%s") % (size, opt)
if size > self.SIZE_GB:
- pretty_size = "%0.2f GB%s" % (size_f / self.SIZE_GB, opt)
+ pretty_size = "%3.3f GB%s" % (size_f / self.SIZE_GB, opt)
elif size > self.SIZE_MB:
- pretty_size = "%0.2f MB%s" % (size_f / self.SIZE_MB, opt)
+ pretty_size = "%3.3f MB%s" % (size_f / self.SIZE_MB, opt)
elif size > self.SIZE_KB:
- pretty_size = "%0.2f KB%s" % (size_f / self.SIZE_KB, opt)
+ pretty_size = "%3.3f KB%s" % (size_f / self.SIZE_KB, opt)
else:
pretty_size = pretty_bytes
return pretty_size, pretty_bytes