Merge pull request #523 from hoamer/display_power_consumption
added option for displaying the power consumption
This commit is contained in:
commit
91ca082627
1 changed files with 9 additions and 2 deletions
|
@ -79,11 +79,18 @@ class Module(bumblebee.engine.Module):
|
||||||
capacity = int(f.read())
|
capacity = int(f.read())
|
||||||
except IOError:
|
except IOError:
|
||||||
return "n/a"
|
return "n/a"
|
||||||
|
|
||||||
capacity = capacity if capacity < 100 else 100
|
capacity = capacity if capacity < 100 else 100
|
||||||
widget.set("capacity", capacity)
|
widget.set("capacity", capacity)
|
||||||
output = "{}%".format(capacity)
|
|
||||||
widget.set("theme.minwidth", "100%")
|
|
||||||
|
|
||||||
|
# Read power conumption
|
||||||
|
if bumblebee.util.asbool(self.parameter("showpowerconsumption", False)):
|
||||||
|
r=open(widget.name + '/power_now', "r")
|
||||||
|
output = "{}% ({})".format(capacity,str(int(r.read())/1000000) + "W")
|
||||||
|
else:
|
||||||
|
output = "{}%".format(capacity)
|
||||||
|
|
||||||
|
widget.set("theme.minwidth", "100%")
|
||||||
if bumblebee.util.asbool(self.parameter("showremaining", True))\
|
if bumblebee.util.asbool(self.parameter("showremaining", True))\
|
||||||
and self.getCharge(widget) == "Discharging":
|
and self.getCharge(widget) == "Discharging":
|
||||||
output = "{} {}".format(output, self.remaining())
|
output = "{} {}".format(output, self.remaining())
|
||||||
|
|
Loading…
Reference in a new issue