Should fix #7 (v3.3)

This commit is contained in:
enkore 2013-03-06 23:03:40 +01:00
parent 7a0bb1cbaa
commit a76779fe7b
2 changed files with 8 additions and 2 deletions

View File

@ -12,6 +12,10 @@ class Battery:
return string[len(prefix):]
return string
@staticmethod
def map_key(key):
return Battery.lchop(key).replace("CHARGE", "ENERGY")
@staticmethod
def convert(value):
return float(value) if value.isdecimal() else value.strip()
@ -27,7 +31,7 @@ class Battery:
def parse_line(self, line):
key, value = line.split("=", 2)
setattr(self, self.lchop(key), self.convert(value))
setattr(self, self.map_key(key), self.convert(value))
class RemainingCalculator:
def __init__(self, energy, power):
@ -85,6 +89,8 @@ class BatteryChecker(IntervalModule):
status = battery.STATUS
energy_now = battery.ENERGY_NOW
energy_full = battery.ENERGY_FULL
if not hasattr(battery, "POWER_NOW"):
battery.POWER_NOW = battery.VOLTAGE_NOW * battery.CURRENT_NOW
power_now = battery.POWER_NOW
fdict = {

View File

@ -3,7 +3,7 @@
from setuptools import setup
setup(name="i3pystatus",
version="3.2",
version="3.3",
description="Like i3status, this generates status line for i3bar / i3wm",
url="http://github.com/enkore/i3pystatus",
license="MIT",