Merge pull request #417 from izn/fix/network-traffic-directions
[module: network_traffic] Fix traffic icon directions
This commit is contained in:
commit
af2e45a7b3
1 changed files with 9 additions and 9 deletions
|
@ -24,8 +24,8 @@ class Module(bumblebee.engine.Module):
|
||||||
try:
|
try:
|
||||||
self._bandwidth = BandwidthInfo()
|
self._bandwidth = BandwidthInfo()
|
||||||
|
|
||||||
self._download_tx = self._bandwidth.bytes_recv()
|
self._bytes_recv = self._bandwidth.bytes_recv()
|
||||||
self._upload_tx = self._bandwidth.bytes_sent()
|
self._bytes_sent = self._bandwidth.bytes_sent()
|
||||||
except Exception:
|
except Exception:
|
||||||
""" We do not want do explode anything """
|
""" We do not want do explode anything """
|
||||||
pass
|
pass
|
||||||
|
@ -43,15 +43,15 @@ class Module(bumblebee.engine.Module):
|
||||||
|
|
||||||
def update(self, widgets):
|
def update(self, widgets):
|
||||||
try:
|
try:
|
||||||
download_tx = self._bandwidth.bytes_recv()
|
bytes_recv = self._bandwidth.bytes_recv()
|
||||||
upload_tx = self._bandwidth.bytes_sent()
|
bytes_sent = self._bandwidth.bytes_sent()
|
||||||
|
|
||||||
download_rate = (download_tx - self._download_tx)
|
download_rate = (bytes_recv - self._bytes_recv)
|
||||||
upload_rate = (upload_tx - self._upload_tx)
|
upload_rate = (bytes_sent - self._bytes_sent)
|
||||||
|
|
||||||
self.update_widgets(widgets, download_rate, upload_rate)
|
self.update_widgets(widgets, download_rate, upload_rate)
|
||||||
|
|
||||||
self._download_tx, self._upload_tx = download_tx, upload_tx
|
self._bytes_recv, self._bytes_sent = bytes_recv, bytes_sent
|
||||||
except Exception:
|
except Exception:
|
||||||
""" We do not want do explode anything """
|
""" We do not want do explode anything """
|
||||||
pass
|
pass
|
||||||
|
@ -62,8 +62,8 @@ class Module(bumblebee.engine.Module):
|
||||||
del widgets[:]
|
del widgets[:]
|
||||||
|
|
||||||
widgets.extend((
|
widgets.extend((
|
||||||
TrafficWidget(text=download_rate, direction='tx'),
|
TrafficWidget(text=download_rate, direction='rx'),
|
||||||
TrafficWidget(text=upload_rate, direction='rx')
|
TrafficWidget(text=upload_rate, direction='tx')
|
||||||
))
|
))
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue