blob: 04006f89e372b054690ec6eeee53c8131b03f601 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
from plyer.platforms.win.libs.batterystatus import battery_status
from plyer.facades import Battery
class WinBattery(Battery):
def _get_state(self):
status = {"isCharging": None, "percentage": None}
query = battery_status()
if (not query):
return status
status["isCharging"] = query["BatteryFlag"] == 8
status["percentage"] = query["BatteryLifePercent"]
return status
def instance():
return WinBattery()
|