aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rwxr-xr-xsrc/net_monitor36
1 files changed, 19 insertions, 17 deletions
diff --git a/src/net_monitor b/src/net_monitor
index fb3c834..5651ae8 100755
--- a/src/net_monitor
+++ b/src/net_monitor
@@ -4,6 +4,7 @@ import gi
gi.require_version('Gdk', '3.0')
gi.require_version('Gtk', '3.0')
from gi.repository import GObject
+from gi.repository import GLib
from gi.repository import Gdk
from gi.repository import GdkPixbuf
from gi.repository import Gtk
@@ -352,7 +353,7 @@ class MonitorGui:
# configure timer
self.signals = queue.Queue()
- GObject.timeout_add_seconds(1, self.update)
+ GLib.timeout_add_seconds(1, self.update)
self.window.show_all()
@@ -501,11 +502,11 @@ class MonitorGui:
else:
value = "%s (%s)" % (pretty_size, pretty_bytes)
self.ifaces[iface][widget].set_text(str(value))
- GObject.timeout_add_seconds(interval, self.update)
+ 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(title=_("Network statistics for %s") % iface,
self.window, 0,
(Gtk.STOCK_OK, Gtk.ResponseType.OK)
)
@@ -586,8 +587,9 @@ class MonitorGui:
GObject.TYPE_INT,
GObject.TYPE_STRING
)
- treeview = Gtk.TreeView(lstore)
- treeview.set_rules_hint(True)
+ treeview = Gtk.TreeView(model=lstore)
+ # deprecated
+ # treeview.set_rules_hint(True)
treeview.set_search_column(self.COLUMN_LOC_ADDR)
# treeview.connect('row-activated', self.expand_domain, lstore)
@@ -618,12 +620,12 @@ class MonitorGui:
widget.pack_start(icon, True, True, 0)
except:
traceback.print_exc()
- widget.pack_start(Gtk.Label(_("connections")), True, True, 0)
+ widget.pack_start(Gtk.Label(label=_("connections")), True, True, 0)
widget.show_all()
vbox.pack_start(sw, True, True, 0)
- button = Gtk.Button(_("Refresh"))
+ button = Gtk.Button(label=_("Refresh"))
button.connect('clicked', self.refresh_connections)
vbox.pack_start(button, False, False, 0)
@@ -642,16 +644,16 @@ class MonitorGui:
self.ifaces[iface]['histogram'] = histogram
# configuring callbacks
- sizegroup1 = Gtk.SizeGroup(Gtk.SizeGroupMode.HORIZONTAL)
- sizegroup2 = Gtk.SizeGroup(Gtk.SizeGroupMode.HORIZONTAL)
- sizegroup3 = Gtk.SizeGroup(Gtk.SizeGroupMode.HORIZONTAL)
- sizegroup4 = Gtk.SizeGroup(Gtk.SizeGroupMode.HORIZONTAL)
+ sizegroup1 = Gtk.SizeGroup(mode=Gtk.SizeGroupMode.HORIZONTAL)
+ sizegroup2 = Gtk.SizeGroup(mode=Gtk.SizeGroupMode.HORIZONTAL)
+ sizegroup3 = Gtk.SizeGroup(mode=Gtk.SizeGroupMode.HORIZONTAL)
+ sizegroup4 = Gtk.SizeGroup(mode=Gtk.SizeGroupMode.HORIZONTAL)
# traffic
frame = Gtk.Frame.new(_("Traffic statistics"))
traf_vbox.pack_start(frame, False, False, 0)
- table = Gtk.Table(2, 2, False)
+ table = Gtk.Table(n_rows=2, n_columns=2, homogeneous=False)
frame.add(table)
cur_row = 0
@@ -677,7 +679,7 @@ class MonitorGui:
frame_global = Gtk.Frame.new(_("Interface settings"))
traf_vbox.pack_start(frame_global, False, False, 0)
- table = Gtk.Table(2, 2, False)
+ table = Gtk.Table(n_rows=2, n_columns=2, homogeneous=False)
frame_global.add(table)
cur_row = 0
@@ -746,16 +748,16 @@ class MonitorGui:
iface_u, iface_uptime = self.build_value_pair(sizegroup1, _("Connection time:"))
self.ifaces[iface]["widget_uptime"] = iface_uptime
vbox.pack_start(iface_u, False, False, 0)
- button = Gtk.Button(_("Show detailed network statistics"))
+ button = Gtk.Button(label=_("Show detailed network statistics"))
button.connect('clicked', self.show_statistics_dialog, iface)
vbox.pack_start(button, False, False, 0)
else:
- label = Gtk.Label("\n".join(textwrap.wrap(_("Network accounting is not enabled for this interface. Please enable it in Network center (press Configure button next to the interface item, then check \"Enable traffic accounting\" item) in order to view detailed traffic statistics"))))
+ label = Gtk.Label(label="\n".join(textwrap.wrap(_("Network accounting is not enabled for this interface. Please enable it in Network center (press Configure button next to the interface item, then check \"Enable traffic accounting\" item) in order to view detailed traffic statistics"))))
vbox.pack_start(label, False, False, 0)
traf_vbox.pack_start(frame_accounting, False, False, 0)
# building notebook label icons
- traf_label = Gtk.HBox(False, 2)
+ traf_label = Gtk.HBox(homogeneous=False, spacing=2)
if iface in self.wireless_ifaces:
# wifi
self.__load_interface_icon(traf_label, 'wireless')
@@ -769,7 +771,7 @@ class MonitorGui:
# ethernet
self.__load_interface_icon(traf_label, 'bluetooth')
- traf_label.pack_start(Gtk.Label(iface), True, True, 0)
+ traf_label.pack_start(Gtk.Label(label=iface), True, True, 0)
traf_label.show_all()
return traf_vbox, traf_label