From d6f1cbbd466372dc90b7eb86bb0db851815885b0 Mon Sep 17 00:00:00 2001 From: enkore Date: Sat, 2 Mar 2013 17:35:19 +0100 Subject: [PATCH] Fixed a bug where battery would generate no output in occasions where it should. --- i3pystatus/battery.py | 16 +--------------- 1 file changed, 1 insertion(+), 15 deletions(-) diff --git a/i3pystatus/battery.py b/i3pystatus/battery.py index 005cbb0..d1cfe6b 100644 --- a/i3pystatus/battery.py +++ b/i3pystatus/battery.py @@ -5,15 +5,6 @@ from . import IntervalModule from .core.util import PrefixedKeyDict class Battery: - """ - Simple interface to /sys/class/power_supply/BATx/uevent - - The data from uevent is transformed into attributes of this class, stripping - their prefix. (i.e. POWER_SUPPLY_NAME becomes the NAME attribute). - - Numbers are automatically converted to floats. Strings are stripped. - """ - @staticmethod def lchop(string, prefix="POWER_SUPPLY_"): if string.startswith(prefix): @@ -81,16 +72,12 @@ class BatteryChecker(IntervalModule): fdict["percentage_design"] = (energy_now / battery.ENERGY_FULL_DESIGN) * 100 fdict["consumption"] = power_now / 1000000 - if not power_now: - return - if status == "Full": fdict["status"] = "FULL" - else: + elif power_now: if status == "Discharging": fdict["status"] = "DIS" remaining = RemainingCalculator(energy_now, power_now) - if remaining.remaining_time < 15: urgent = True color = "#ff0000" @@ -105,4 +92,3 @@ class BatteryChecker(IntervalModule): "urgent": urgent, "color": color } -