aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPapoteur <papoteur@mageialinux-online.org>2015-09-02 20:40:51 +0200
committerPapoteur <papoteur@mageialinux-online.org>2015-09-02 20:40:51 +0200
commit2857e3c4740c5bb6bbf0556fd60858c8637f7079 (patch)
treea4e6ef28b6f3283c401e35d5597c1af735bddbcb
parent65d601995e975ac6c075f7dcb5da0a5de1fbee40 (diff)
downloadnet_monitor-2857e3c4740c5bb6bbf0556fd60858c8637f7079.tar
net_monitor-2857e3c4740c5bb6bbf0556fd60858c8637f7079.tar.gz
net_monitor-2857e3c4740c5bb6bbf0556fd60858c8637f7079.tar.bz2
net_monitor-2857e3c4740c5bb6bbf0556fd60858c8637f7079.tar.xz
net_monitor-2857e3c4740c5bb6bbf0556fd60858c8637f7079.zip
Applying 2to3-3.4 to net_monitor
-rwxr-xr-xsrc/net_monitor23
1 files changed, 12 insertions, 11 deletions
diff --git a/src/net_monitor b/src/net_monitor
index a9d9eb4..911b032 100755
--- a/src/net_monitor
+++ b/src/net_monitor
@@ -21,14 +21,15 @@ import struct
import time
import signal
-import Queue
+import queue
import textwrap
# localization
import gettext
+from functools import reduce
try:
- gettext.install("net_monitor", unicode=1)
+ gettext.install("net_monitor", str=1)
except IOError:
_ = str
@@ -272,14 +273,14 @@ class LoadGraph:
def set_color(self, *args, **kwargs):
""" Sets the colors of the graph """
- for key, value in kwargs.items():
+ for key, value in list(kwargs.items()):
self.__colors[key] = value
class MonitorGui:
# icon pattern - icons are pulled from drakx-net
ICON_PATTERN="/usr/share/libDrakX/pixmaps/%s-16.png"
ICON_CONNECTED="/usr/share/libDrakX/pixmaps/connected.png"
- (COLUMN_PROTO, COLUMN_LOC_ADDR, COLUMN_LOC_PORT, COLUMN_REM_ADDR, COLUMN_REM_PORT, COLUMN_STATUS) = range(6)
+ (COLUMN_PROTO, COLUMN_LOC_ADDR, COLUMN_LOC_PORT, COLUMN_REM_ADDR, COLUMN_REM_PORT, COLUMN_STATUS) = list(range(6))
def __init__(self, default_iface=None):
self.window = Gtk.Window()
self.window.set_title(_("Network monitor"))
@@ -299,12 +300,12 @@ class MonitorGui:
self.ifaces = self.monitor.readnet()
self.enabled_ifaces = []
- self.wireless_ifaces = filter(self.monitor.has_wireless, self.ifaces.keys())
+ self.wireless_ifaces = list(filter(self.monitor.has_wireless, list(self.ifaces.keys())))
# load uptime log
self.monitor.load_uptime_log()
- sorted_ifaces = self.ifaces.keys()
+ sorted_ifaces = list(self.ifaces.keys())
sorted_ifaces.sort()
net=self.monitor.readnet()
@@ -346,7 +347,7 @@ class MonitorGui:
self.statusbar.push(self.context_id, _("Please wait.."))
# configure timer
- self.signals = Queue.Queue()
+ self.signals = queue.Queue()
GObject.timeout_add_seconds(1, self.update)
self.window.show_all()
@@ -495,7 +496,7 @@ class MonitorGui:
value = pretty_size
else:
value = "%s (%s)" % (pretty_size, pretty_bytes)
- self.ifaces[iface][widget].set_text(unicode(value))
+ self.ifaces[iface][widget].set_text(str(value))
GObject.timeout_add_seconds(interval, self.update)
def show_statistics_dialog(self, widget, iface):
@@ -828,7 +829,7 @@ class MonitorGui:
param="-s"
else:
# show summary if parameter is unknown
- print "Unknown parameter %s, showing summary.." % type
+ print("Unknown parameter %s, showing summary.." % type)
param="-s"
data = os.popen("vnstati %s -o - -i %s" % (param, iface)).read()
loader = GdkPixbuf.PixbufLoader()
@@ -852,12 +853,12 @@ class MonitorGui:
# {{{ usage
def usage():
"""Prints help message"""
- print """net_monitor: Mandriva network monitoring tool.
+ print("""net_monitor: Mandriva network monitoring tool.
Arguments to net_monitor:
-h, --help displays this helpful message.
-i, --defaultintf <iface> start monitoring the specified interface
-"""
+""")
# }}}
if __name__ == "__main__":