diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/monitor.py | 10 | ||||
-rwxr-xr-x | src/net_monitor | 14 |
2 files changed, 12 insertions, 12 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 diff --git a/src/net_monitor b/src/net_monitor index 5651a4d..cdd5c6d 100755 --- a/src/net_monitor +++ b/src/net_monitor @@ -498,15 +498,15 @@ class MonitorGui: if value.__class__ == tuple: pretty_size, pretty_bytes = value if pretty_size == pretty_bytes: - value = pretty_size + value = pretty_size + "\n" else: - value = "%s (%s)" % (pretty_size, pretty_bytes) + value =( f"{pretty_size:<15}\n({pretty_bytes})") self.ifaces[iface][widget].set_text(str(value)) GLib.timeout_add_seconds(interval, self.update) def show_statistics_dialog(self, widget, iface): """Shows statistics dialog""" - dialog = Gtk.Dialog("Network statistics for %s" % iface, + dialog = Gtk.Dialog(_("Network statistics for %s") % iface, self.window, 0, (Gtk.STOCK_OK, Gtk.ResponseType.OK) ) @@ -657,15 +657,15 @@ class MonitorGui: frame.add(table) cur_row = 0 - total_in_h, total_in = self.build_value_pair(sizegroup1, _("Downloaded:"), value_sizegroup=sizegroup2) + total_in_h, total_in = self.build_value_pair(sizegroup1, _("Downloaded:") + "\n", value_sizegroup=sizegroup2) self.ifaces[iface]["widget_in"] = total_in - total_out_h, total_out = self.build_value_pair(sizegroup3, _("Uploaded:"), value_sizegroup=sizegroup4) + total_out_h, total_out = self.build_value_pair(sizegroup3, _("Uploaded:") + "\n", value_sizegroup=sizegroup4) self.ifaces[iface]["widget_out"] = total_out # speed - speed_in_h, speed_in = self.build_value_pair(sizegroup1, _("Download speed:"), value_sizegroup=sizegroup2) + speed_in_h, speed_in = self.build_value_pair(sizegroup1, _("Download speed:") + "\n", value_sizegroup=sizegroup2) self.ifaces[iface]["widget_speed_in"] = speed_in - speed_out_h, speed_out = self.build_value_pair(sizegroup3, _("Upload speed:"), value_sizegroup=sizegroup4) + speed_out_h, speed_out = self.build_value_pair(sizegroup3, _("Upload speed:") + "\n", value_sizegroup=sizegroup4) self.ifaces[iface]["widget_speed_out"] = speed_out # pack items into table |