Active Topics

 



Notices


Reply
Thread Tools
coderus's Avatar
Posts: 6,436 | Thanked: 12,700 times | Joined on Nov 2011 @ Ängelholm, Sweden
#621
just nothing? even terminal and you cant provide extra innfo about "nothing works"? sadly
__________________
Telegram | Openrepos | GitHub | Revolut donations
 
Posts: 498 | Thanked: 836 times | Joined on Jun 2012 @ Finland
#622
Hello

I once again have problem that I can't solve with these scripts.

I am trying to get the "Estimated battery time" by Coderus here.

With apt-get install python

Code:
~ # apt-get install python-qmsystem
Reading package lists... Done
Building dependency tree
Reading state information... Done
python-qmsystem is already the newest version.
0 upgraded, 0 newly installed, 0 to remove and 5 not upgraded.
Sooooo, that should be ok then, right?


But then, when I try to do sh/path/to/script

Code:
~ # sh /home/user/scripts/kayttoaika.py
/home/user/scripts/kayttoaika.py: line 3: import: not found
/home/user/scripts/kayttoaika.py: line 5: syntax error: unexpected "("

And here is the script, straight copy-paste from post of Coderus from the previous page

Code:
#!/usr/bin/python

import QmSystem

batt = QmSystem.QmBattery()

if batt.getChargingState()==1:
        time = batt.getRemainingChargingTime()
else:
        mode = QmSystem.QmBattery.NormalMode if QmSystem.QmDeviceMode().getPSMState() == 0 else QmSystem.QmBattery.PowersaveMode
        time = batt.getRemainingIdleTime(mode)
        time += batt.getRemainingTalkTime(mode)
        time = time/2
hours,mod = divmod(time,3600)
mins,secs = divmod(mod,60)

result = []
if hours == 1:
    result.append('%d hour' % hours)
elif hours > 0:
    result.append('%d hours' % hours)
if mins == 1:
    result.append('%d minute' % mins)
elif mins > 0 or not result:
    result.append('%d minutes' % mins)
print ' '.join(result)

So, what genius have I now managed to screw up ?




BTW, how often does the billboard update its scripts? I have come to understand that this is somewhat script related? I have noticed that my Wazapp status does not update if I shut down my internet connection and then quickly turn on the stand by screen. I have to click the phone open once again, click it to stand-by and then it has updated the status. Is this correct? I am also using the profilematic forced billboard update, is this the reason for the "lag"?

Last edited by Boxeri; 2013-02-16 at 12:21. Reason: typos
 
Moderator | Posts: 6,215 | Thanked: 6,400 times | Joined on Nov 2011
#623
Boxeri,

Its to be run as "python /path/to/script" not "sh /path/to/script"
 

The Following User Says Thank You to thedead1440 For This Useful Post:
Posts: 498 | Thanked: 836 times | Joined on Jun 2012 @ Finland
#624
So, the genius that I managed to do to screw this up was that for ONCE I actually decided to check first what I was doing. If I had just put it to Billboard everything would have been fine.

Everything was correct and it is working now.

Could it be possible to add somekind of "Charging" or "Remaining" text depending on the situation?

echo something?
 
coderus's Avatar
Posts: 6,436 | Thanked: 12,700 times | Joined on Nov 2011 @ Ängelholm, Sweden
#625
Code:
#!/usr/bin/python

import QmSystem

batt = QmSystem.QmBattery()
result = []

if batt.getChargingState()==1:
        time = batt.getRemainingChargingTime()
        result.append('Charging')
else:
        mode = QmSystem.QmBattery.NormalMode if QmSystem.QmDeviceMode().getPSMState() == 0 else QmSystem.QmBattery.PowersaveMode
        time = batt.getRemainingIdleTime(mode)
        time += batt.getRemainingTalkTime(mode)
        time = time/2
        result.append('Remaining')
hours,mod = divmod(time,3600)
mins,secs = divmod(mod,60)

if hours == 1:
    result.append('%d hour' % hours)
elif hours > 0:
    result.append('%d hours' % hours)
if mins == 1:
    result.append('%d minute' % mins)
elif mins > 0 or not result:
    result.append('%d minutes' % mins)
print ' '.join(result)
something like that
__________________
Telegram | Openrepos | GitHub | Revolut donations
 

The Following User Says Thank You to coderus For This Useful Post:
Posts: 498 | Thanked: 836 times | Joined on Jun 2012 @ Finland
#626
Much appreciated!

How about my old question, anyone?

"how often does the billboard update its scripts? I have come to understand that this is somewhat script related? I have noticed that my Wazapp status does not update if I shut down my internet connection and then quickly turn on the stand by screen. I have to click the phone open once again, click it to stand-by and then it has updated the status. Is this correct? I am also using the profilematic forced billboard update, is this the reason for the "lag"?"
 
MK99's Avatar
Posts: 644 | Thanked: 480 times | Joined on Jul 2012 @ Finland
#627
Code:
#!/usr/bin/python

import QmSystem

batt = QmSystem.QmBattery()
if batt.getBatteryState()==3:
    print "FULL"

elif batt.getChargingState()==1:
        time = batt.getRemainingChargingTime()
        result = '+ '
else:
        #time = batt.getRemainingIdleTime(QmSystem.QmBattery.NormalMode)
        #time = QmSystem.QmBattery.getRemainingTalkTime(QmSystem.QmBattery.NormalMode)
        time = batt.getRemainingActiveTime(QmSystem.QmBattery.NormalMode)
        result = '~ '
hours,mod = divmod(time,3600)
mins,secs = divmod(mod,60)

if hours>0:
        result+=str(hours)+':'
elif hours == 0:
        result+=str(hours)+':'
if mins>10:
        result+=str(mins)
elif mins<10:
        result+='0'+str(mins)
elif mins == 0:
        result+='00'+str(mins)

print result
Attached Images
 
 

The Following User Says Thank You to MK99 For This Useful Post:
coderus's Avatar
Posts: 6,436 | Thanked: 12,700 times | Joined on Nov 2011 @ Ängelholm, Sweden
#628
my one
Attached Images
 
__________________
Telegram | Openrepos | GitHub | Revolut donations
 

The Following 4 Users Say Thank You to coderus For This Useful Post:
Posts: 277 | Thanked: 319 times | Joined on Jan 2010
#629
If we are comparing:

 

The Following 3 Users Say Thank You to slarti For This Useful Post:
coderus's Avatar
Posts: 6,436 | Thanked: 12,700 times | Joined on Nov 2011 @ Ängelholm, Sweden
#630
too many calendar and alarm events

btw, how you making standby screen screenshot?
__________________
Telegram | Openrepos | GitHub | Revolut donations
 
Reply


 
Forum Jump


All times are GMT. The time now is 16:53.