aboutsummaryrefslogtreecommitdiffstats
path: root/examples/plugin-test
diff options
context:
space:
mode:
Diffstat (limited to 'examples/plugin-test')
-rw-r--r--examples/plugin-test19
1 files changed, 16 insertions, 3 deletions
diff --git a/examples/plugin-test b/examples/plugin-test
index 9cf449c..711ef11 100644
--- a/examples/plugin-test
+++ b/examples/plugin-test
@@ -17,9 +17,10 @@ from plugins.xdisplay import XDisplay
from plugins.moc import MOC
from plugins.cpu import CPU
from plugins.clock import Clock
+from plugins.network import Network
-OUTPUT, HEIGHT, YPOS, TOP = 0, 24, 24, True
+OUTPUT, HEIGHT, YPOS, TOP = 0, 3 * 12, 24, True
clock = Clock(format = '%Y-(%m)%b-%d %T, %a w%V, %Z')
@@ -179,9 +180,21 @@ def redraw():
cpu = colourise(cpu_usage(now_cpu_idle, now_cpu_total, last_cpu_idle, last_cpu_total))
cpu = 'Cpu: %s : %s' % (cpus, cpu)
+ gb = lambda x : x / 1024 ** 3
+ net_ = Network('lo').devices
+ net_ = [(dev, gb(net_[dev]['rx_bytes']), gb(net_[dev]['tx_bytes'])) for dev in net_]
+ net_each = ['%s: %.2fGB|%.2fGB' % dev for dev in net_]
+ net_total = '%.2fGB|%.2fGB' % (sum([rx for _, rx, tx in net_]), sum([tx for _, rx, tx in net_]))
+ net = '%s : %s' % (' '.join(net_each), net_total)
- text = '%s │ %s │ %s │ %s │ %s │ %s %s │ %s │ %s │ %s │ %s\n%s │ %s │ %s'
- text %= (date, uptime, idle, loadavg, users, uname, xdisplay, mem, swp, shm, moc, discs, discstats, cpu)
+
+ text = ['%s │ %s │ %s │ %s │ %s │ %s %s │ %s │ %s │ %s │ %s'
+ ,'%s │ %s │ %s'
+ ,'%s']
+ text = '\n'.join(text)
+ text %= (date, uptime, idle, loadavg, users, uname, xdisplay, mem, swp, shm, moc,
+ discs, discstats, cpu,
+ net)
bar.clear()
bar.draw_coloured_text(0, 10, 0, 2, text)