From a76779fe7bd6b4ed00bc4fa7984952deeb2e6011 Mon Sep 17 00:00:00 2001 From: enkore Date: Wed, 6 Mar 2013 23:03:40 +0100 Subject: [PATCH] Should fix #7 (v3.3) --- i3pystatus/battery.py | 8 +++++++- setup.py | 2 +- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/i3pystatus/battery.py b/i3pystatus/battery.py index 50461bc..e257a45 100644 --- a/i3pystatus/battery.py +++ b/i3pystatus/battery.py @@ -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 = { diff --git a/setup.py b/setup.py index c58598b..c57844b 100755 --- a/setup.py +++ b/setup.py @@ -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",