[modules/ping] Re-enable ping module

Show RTT measured by ICMP echo request/replies for a given host.

For that to work correctly, change the "full_text" callback for a widget
so that the widget itself is also passed as argument in the callback
method. That actually makes a lot of sense, since the widget can now be
used as a repository of state information.

see #23
This commit is contained in:
Tobi-wan Kenobi 2016-12-11 11:37:24 +01:00
parent 4f6ec89d3c
commit 71582cbcd7
15 changed files with 98 additions and 21 deletions

View file

@ -19,6 +19,7 @@ class Module(bumblebee.engine.Module):
super(Module, self).__init__(engine, config,
bumblebee.output.Widget(full_text=self.load)
)
self._load = [0, 0, 0]
try:
self._cpus = multiprocessing.cpu_count()
except multiprocessing.NotImplementedError as e:
@ -26,7 +27,7 @@ class Module(bumblebee.engine.Module):
engine.input.register_callback(self, button=bumblebee.input.LEFT_MOUSE,
cmd="gnome-system-monitor")
def load(self):
def load(self, widget):
return "{:.02f}/{:.02f}/{:.02f}".format(
self._load[0], self._load[1], self._load[2]
)