![]() |
2013-01-11
, 07:02
|
Posts: 44 |
Thanked: 20 times |
Joined on May 2012
|
#492
|
![]() |
2013-01-11
, 07:47
|
|
Posts: 6,436 |
Thanked: 12,701 times |
Joined on Nov 2011
@ Ängelholm, Sweden
|
#493
|
![]() |
2013-01-11
, 07:50
|
Moderator |
Posts: 6,215 |
Thanked: 6,400 times |
Joined on Nov 2011
|
#494
|
The Following 3 Users Say Thank You to thedead1440 For This Useful Post: | ||
![]() |
2013-01-11
, 09:08
|
Posts: 277 |
Thanked: 319 times |
Joined on Jan 2010
|
#495
|
Here's what I can't get to work:
{{blue}}{events}{events? ☚} only works as desired if there's 1 event.
If there's 2 or more, only the first is shown blue (the rest is white) and only the last has the ☚ (which is obvious)
{script: /home/user/alarm.py} is not showing at all with the last line of script edited toinstead ofCode:sys.stdout.write('\n'.join(sorted(get_queued_alarms())))This modification is supposed to enable special characters in the BB text, but I get nothing at all.Code:print '\n'.join(sorted(get_queued_alarms())) or 'No alarms'
Any help on this would be great.
Would it be possible to get events and alarms via shell script too?
u"☚".encode('utf-8')
'\xe2\x98\x9a'
# -*- coding: utf-8 -*-
The Following User Says Thank You to slarti For This Useful Post: | ||
![]() |
2013-01-11
, 11:10
|
|
Posts: 1,391 |
Thanked: 4,272 times |
Joined on Sep 2007
@ Vienna, Austria
|
#496
|
I can confirm that wazapp-status in 1.0.7 does not do it's job. My wazapp crashed a few minutes ago, and I did not start it again because I'm waiting on the standby screen to see if billboard will understand that wazapp is crashed but no - it still says "online".
Right now I'm on a WiFi router with broken internet connection. Nothing works, but wazapp thinks he is online, but it's not. Billboard thinks we are online too. Useless plugin? NHF.
![]() |
2013-01-11
, 11:51
|
|
Community Council |
Posts: 664 |
Thanked: 1,648 times |
Joined on Apr 2012
@ Hamburg
|
#497
|
What does it say in termimal when you run it? The python interpreter usually tells you where the problem is.
sys.stdout.write('\n'.join(sorted(get_queued_alarms())))
print '\n'.join(sorted(get_queued_alarms())) or 'No alarms'
You can get special characters with the print function, too. Just encode them to utf-8.
Yes, {{color}} only goes to the end of the current line for now. What you could do is set the global color to blue, and then prefix every line that you don't want to have in blue with the desired color.
![]() |
2013-01-11
, 19:31
|
Posts: 277 |
Thanked: 319 times |
Joined on Jan 2010
|
#498
|
What's that exactly? - I only installed python an python-dbus.
Could you paste your code in the script, so it's placed correct and post here?
#!/usr/bin/python # List upcoming alarms on MeeGo 1.2 Harmattan # Thanks to slarti on TMO for figuring out the D-Bus methods # Thomas Perl <thp.io/about>; 2012-06-13 # Horribly mangled by slarti to find only the next alarm # (set from clock application); 2012-06-19 # from http://talk.maemo.org/showpost.php?p=1224180&postcount=107 import dbus from datetime import datetime, timedelta import time bus = dbus.SystemBus() time_obj = bus.get_object('com.nokia.time', '/com/nokia/time') time_intf = dbus.Interface(time_obj, 'com.nokia.time') cookies = time_intf.get_cookies_by_attributes({'enabled': '1'}) today = datetime.now() tomorrow = today + timedelta(days=1) def list_queued_alarms(): for cookie in cookies: attributes = time_intf.query_attributes(cookie) alarmtime = attributes['alarmtime'] if attributes['STATE'] == 'QUEUED': if 'recurrence' in attributes: days = tuple(attributes['recurrence']) else: if datetime.time(datetime.strptime(alarmtime, ("%H:%M"))) > datetime.time(datetime.now()): days = time.strftime("%w") else: days = tomorrow.strftime("%w") weekdays = dict([(day, time.strptime((day + " " + alarmtime),'%w %H:%M' )) for day in days]) for day in days: yield ' '.join((day,time.strftime('%a %H:%M',weekdays[day]),attributes['TITLE'])) findme_list = [' '.join((time.strftime('%w %a %H:%M'),'findme'))] L = list(list_queued_alarms()) + findme_list L.sort() findme_string = ' '.join((time.strftime('%w %a %H:%M'),'findme')) findme_int = L.index(findme_string) if len(L) == 1: next_alarm = 'xxNo alarms' else: if findme_int == (len(L) - 1): next_alarm = L[0] else: next_alarm = L[findme_int + 1] print next_alarm[2:].encode('utf-8') + '\xe2\x98\x9a'
The Following User Says Thank You to slarti For This Useful Post: | ||
![]() |
2013-01-12
, 00:53
|
|
Community Council |
Posts: 664 |
Thanked: 1,648 times |
Joined on Apr 2012
@ Hamburg
|
#499
|
If you want to use the sys module then you have to import it just like you import other modules. Simply write import sys at the top.
I'm having trouble making thp's script behave nicely because of the generator object from which he prints the alarms.
If you can settle for just the next alarm, here is my script added with a special character at the end of the line.
![]() |
2013-01-12
, 04:06
|
|
Posts: 6,436 |
Thanked: 12,701 times |
Joined on Nov 2011
@ Ängelholm, Sweden
|
#500
|
The Following User Says Thank You to coderus For This Useful Post: | ||
Syntax highlighting included. And it's open source...
Just make shure you set encoding to UTF-8 without BOM and in settings>options> choose UNIX. There you can also choose the default encoding format.
Nokia 5110 > 3310 > 6230 > N70 > N9 BLACK 64GB
Hildon Foundation Board member
Maemo Community e.V. co-creator, founder and director since Q4/2016
Current Maemo Community Council member
Last edited by Win7Mac; 2013-01-11 at 11:58.