View Single Post
MK99's Avatar
Posts: 644 | Thanked: 480 times | Joined on Jul 2012 @ Finland
#614
There is also RemainingActiveTime.

And RemainingChargingTime:
Code:
#!/usr/bin/python

import QmSystem

batt = QmSystem.QmBattery()
time = batt.getRemainingChargingTime()
hours,mod = divmod(time,3600)
mins,secs = divmod(mod,60)
result = ''
if hours>0:
        result+=str(hours)+'h '
if mins>0:
        result+=str(mins)+'min'
if batt.getChargingState()==1:
    print result
else:
    print ""
But there is one problem: when not connected to a charger, it show all the time 59min.
Can someone fix that, because I do not know how to do it. Or is it even possible to get this to work correctly?

E: corrected and put in for testing.

Last edited by MK99; 2013-02-14 at 11:40.