Merge pull request #314 from alexmohr/master
Fixed status for unknown charge state, added option to weather to hide city
This commit is contained in:
commit
453f7f2b54
3 changed files with 9 additions and 1 deletions
|
@ -112,6 +112,8 @@ class Module(bumblebee.engine.Module):
|
|||
pass
|
||||
if charge == "Discharging":
|
||||
state.append("discharging-{}".format(min([10, 25, 50, 80, 100], key=lambda i: abs(i-capacity))))
|
||||
elif charge == "Unknown":
|
||||
state.append("unknown")
|
||||
else:
|
||||
if capacity > 95:
|
||||
state.append("charged")
|
||||
|
|
|
@ -30,6 +30,8 @@ class Module(bumblebee.engine.Module):
|
|||
def __init__(self, engine, config):
|
||||
super(Module, self).__init__(engine, config,
|
||||
bumblebee.output.Widget(full_text=self.get_time))
|
||||
engine.input.register_callback(self, button=bumblebee.input.LEFT_MOUSE,
|
||||
cmd=self._app)
|
||||
self._fmt = self.parameter("format", default_format(self.name))
|
||||
l = locale.getdefaultlocale()
|
||||
if not l or l == (None, None):
|
||||
|
|
|
@ -32,6 +32,7 @@ class Module(bumblebee.engine.Module):
|
|||
self._apikey = self.parameter("apikey", "af7bfe22287c652d032a3064ffa44088")
|
||||
self._location = self.parameter("location", "auto")
|
||||
self._city = self.parameter("location", "")
|
||||
self._showcity = bumblebee.util.asbool(self.parameter("showcity", True))
|
||||
self._unit = self.parameter("unit", "metric")
|
||||
self._valid = False
|
||||
self.interval(15)
|
||||
|
@ -55,7 +56,10 @@ class Module(bumblebee.engine.Module):
|
|||
def output(self, widget):
|
||||
if not self._valid:
|
||||
return u"?"
|
||||
if self._showcity:
|
||||
return self.city() + self.temperature()
|
||||
else:
|
||||
return self.temperature()
|
||||
|
||||
def state(self, widget):
|
||||
if self._valid:
|
||||
|
|
Loading…
Reference in a new issue