Merge pull request #417 from izn/fix/network-traffic-directions

[module: network_traffic] Fix traffic icon directions
This commit is contained in:
tobi-wan-kenobi 2019-08-08 19:06:47 +02:00 committed by GitHub
commit af2e45a7b3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -24,8 +24,8 @@ class Module(bumblebee.engine.Module):
try:
self._bandwidth = BandwidthInfo()
self._download_tx = self._bandwidth.bytes_recv()
self._upload_tx = self._bandwidth.bytes_sent()
self._bytes_recv = self._bandwidth.bytes_recv()
self._bytes_sent = self._bandwidth.bytes_sent()
except Exception:
""" We do not want do explode anything """
pass
@ -43,15 +43,15 @@ class Module(bumblebee.engine.Module):
def update(self, widgets):
try:
download_tx = self._bandwidth.bytes_recv()
upload_tx = self._bandwidth.bytes_sent()
bytes_recv = self._bandwidth.bytes_recv()
bytes_sent = self._bandwidth.bytes_sent()
download_rate = (download_tx - self._download_tx)
upload_rate = (upload_tx - self._upload_tx)
download_rate = (bytes_recv - self._bytes_recv)
upload_rate = (bytes_sent - self._bytes_sent)
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:
""" We do not want do explode anything """
pass
@ -62,8 +62,8 @@ class Module(bumblebee.engine.Module):
del widgets[:]
widgets.extend((
TrafficWidget(text=download_rate, direction='tx'),
TrafficWidget(text=upload_rate, direction='rx')
TrafficWidget(text=download_rate, direction='rx'),
TrafficWidget(text=upload_rate, direction='tx')
))