[modules/nic] Fix status display

First, cache lookups were bugged... Second, the output needs to call
data() first, everything else later.

This is a bit nasty, and I'll consider re-visiting this, but right now,
I don't see any other way, given that modules can now be iterated.
This commit is contained in:
Tobias Witek 2016-10-31 13:09:52 +01:00
parent 0f6b418385
commit f29ddae47a
2 changed files with 5 additions and 3 deletions

View file

@ -44,12 +44,13 @@ class Module(bumblebee.module.Module):
try: try:
iw.get_interface_by_ifindex(idx) iw.get_interface_by_ifindex(idx)
self._cache["wlan{}".format(intf)] = True self._cache["wlan{}".format(intf)] = True
except exception as e: except Exception as e:
self._cache["wlan{}".format(intf)] = False self._cache["wlan{}".format(intf)] = False
return self._cache return self._cache["wlan{}".format(intf)]
def state(self): def state(self):
t = "wireless" if self._iswlan(self._intf) else "wired" t = "wireless" if self._iswlan(self._intf) else "wired"
return "{}-{}".format(t, self._state) return "{}-{}".format(t, self._state)
def warning(self): def warning(self):

View file

@ -16,8 +16,9 @@ class i3bar(bumblebee.output.Output):
theme = self.theme() theme = self.theme()
while True: while True:
d = obj.data()
data = { data = {
u"full_text": "{}{}{}".format(theme.prefix(obj), obj.data(), theme.suffix(obj)), u"full_text": "{}{}{}".format(theme.prefix(obj), d, theme.suffix(obj)),
"color": theme.color(obj), "color": theme.color(obj),
"background": theme.background(obj), "background": theme.background(obj),
} }