[modules/battery] Fix syntax error

see #221
This commit is contained in:
Tobias Witek 2018-01-11 20:22:21 +01:00
parent bbfb6fc095
commit f236c24b92
3 changed files with 13 additions and 3 deletions

View file

@ -40,6 +40,7 @@ class Module(object):
self.id = self.name
self._next = int(time.time())
self._default_interval = 0
self.success = True
self._configFile = None
for cfg in [os.path.expanduser("~/.bumblebee-status.conf"), os.path.expanduser("~/.config/bumblebee-status.conf")]:
@ -80,7 +81,12 @@ class Module(object):
def update_wrapper(self, widgets):
if self._next > int(time.time()):
return
try:
self.update(self._widgets)
self.success = True
except Exception as e:
log.error("failed to update module {}: {}".format(self.name, str(e)))
self.success = False
self._next += int(self.parameter("interval", self._default_interval))*60
def interval(self, intvl):

View file

@ -105,6 +105,7 @@ class Module(bumblebee.engine.Module):
state.append("AC")
else:
charge = ""
try:
with open("{}/status".format(widget.name)) as f:
charge = f.read().strip()
except IOError:

View file

@ -17,6 +17,9 @@ class Module(bumblebee.engine.Module):
)
self._text = self.parameter("text", "")
def update(self, widgets):
raise Exception("test")
def text(self, widget):
return self._text