From fbe6a0a6793b736aedb44182008586d17b5b4f94 Mon Sep 17 00:00:00 2001 From: Papoteur Date: Sun, 31 May 2020 12:13:05 +0200 Subject: Improve formatting to avoid resizing of the windows Format ESSID in unicode --- src/monitor.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) (limited to 'src/monitor.py') 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 -- cgit v1.2.1