Should fix #7 (v3.3)
This commit is contained in:
parent
7a0bb1cbaa
commit
a76779fe7b
@ -12,6 +12,10 @@ class Battery:
|
|||||||
return string[len(prefix):]
|
return string[len(prefix):]
|
||||||
return string
|
return string
|
||||||
|
|
||||||
|
@staticmethod
|
||||||
|
def map_key(key):
|
||||||
|
return Battery.lchop(key).replace("CHARGE", "ENERGY")
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def convert(value):
|
def convert(value):
|
||||||
return float(value) if value.isdecimal() else value.strip()
|
return float(value) if value.isdecimal() else value.strip()
|
||||||
@ -27,7 +31,7 @@ class Battery:
|
|||||||
def parse_line(self, line):
|
def parse_line(self, line):
|
||||||
key, value = line.split("=", 2)
|
key, value = line.split("=", 2)
|
||||||
|
|
||||||
setattr(self, self.lchop(key), self.convert(value))
|
setattr(self, self.map_key(key), self.convert(value))
|
||||||
|
|
||||||
class RemainingCalculator:
|
class RemainingCalculator:
|
||||||
def __init__(self, energy, power):
|
def __init__(self, energy, power):
|
||||||
@ -85,6 +89,8 @@ class BatteryChecker(IntervalModule):
|
|||||||
status = battery.STATUS
|
status = battery.STATUS
|
||||||
energy_now = battery.ENERGY_NOW
|
energy_now = battery.ENERGY_NOW
|
||||||
energy_full = battery.ENERGY_FULL
|
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
|
power_now = battery.POWER_NOW
|
||||||
|
|
||||||
fdict = {
|
fdict = {
|
||||||
|
2
setup.py
2
setup.py
@ -3,7 +3,7 @@
|
|||||||
from setuptools import setup
|
from setuptools import setup
|
||||||
|
|
||||||
setup(name="i3pystatus",
|
setup(name="i3pystatus",
|
||||||
version="3.2",
|
version="3.3",
|
||||||
description="Like i3status, this generates status line for i3bar / i3wm",
|
description="Like i3status, this generates status line for i3bar / i3wm",
|
||||||
url="http://github.com/enkore/i3pystatus",
|
url="http://github.com/enkore/i3pystatus",
|
||||||
license="MIT",
|
license="MIT",
|
||||||
|
Loading…
Reference in New Issue
Block a user