From a6d76538737ad1fdf8745d07b3e1ec13f62038f5 Mon Sep 17 00:00:00 2001 From: Arjun Nair Date: Sun, 10 Sep 2017 00:23:41 +0530 Subject: [PATCH 1/2] Added parameter showname to hide network interface Becomes a needless info for personal laptop usages where only one interface is used. --- bumblebee/modules/traffic.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/bumblebee/modules/traffic.py b/bumblebee/modules/traffic.py index ee21794..fa84321 100644 --- a/bumblebee/modules/traffic.py +++ b/bumblebee/modules/traffic.py @@ -5,6 +5,7 @@ Parameters: * traffic.exclude: Comma-separated list of interface prefixes to exclude (defaults to "lo,virbr,docker,vboxnet,veth") * traffic.states: Comma-separated list of states to show (prefix with "^" to invert - i.e. ^down -> show all devices that are not in state down) + * traffic.showname: set as False to hide network interface name """ import re @@ -23,6 +24,7 @@ class Module(bumblebee.engine.Module): self._exclude = tuple(filter(len, self.parameter("exclude", "lo,virbr,docker,vboxnet,veth").split(","))) self._status = "" + self._showname = self.parameter("showname", "True") self._prev = {} self._states = {} self._states["include"] = [] @@ -85,8 +87,9 @@ class Module(bumblebee.engine.Module): } name = "traffic-{}".format(interface) - - self.create_widget(widgets, name, interface) + + if self._showname != "False": + self.create_widget(widgets, name, interface) for direction in ["rx", "tx"]: name = "traffic.{}-{}".format(direction, interface) From 5551eb1d74bb34a59de36bd51ed9e742bfcceeac Mon Sep 17 00:00:00 2001 From: Tobias Witek Date: Sun, 10 Sep 2017 09:16:21 +0200 Subject: [PATCH 2/2] [modules/traffic] Use boolean util methods see #171 --- bumblebee/modules/traffic.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/bumblebee/modules/traffic.py b/bumblebee/modules/traffic.py index fa84321..60d5dd7 100644 --- a/bumblebee/modules/traffic.py +++ b/bumblebee/modules/traffic.py @@ -5,7 +5,7 @@ Parameters: * traffic.exclude: Comma-separated list of interface prefixes to exclude (defaults to "lo,virbr,docker,vboxnet,veth") * traffic.states: Comma-separated list of states to show (prefix with "^" to invert - i.e. ^down -> show all devices that are not in state down) - * traffic.showname: set as False to hide network interface name + * traffic.showname: If set to False, hide network interface name (defaults to True) """ import re @@ -24,7 +24,7 @@ class Module(bumblebee.engine.Module): self._exclude = tuple(filter(len, self.parameter("exclude", "lo,virbr,docker,vboxnet,veth").split(","))) self._status = "" - self._showname = self.parameter("showname", "True") + self._showname = bumblebee.util.asbool(self.parameter("showname", True)) self._prev = {} self._states = {} self._states["include"] = [] @@ -88,7 +88,7 @@ class Module(bumblebee.engine.Module): name = "traffic-{}".format(interface) - if self._showname != "False": + if self._showname: self.create_widget(widgets, name, interface) for direction in ["rx", "tx"]: