The Following User Says Thank You to slarti For This Useful Post: | ||
|
2013-01-13
, 02:04
|
|
Community Council |
Posts: 664 |
Thanked: 1,648 times |
Joined on Apr 2012
@ Hamburg
|
#502
|
You wrote the command in shell, not in the python interpreter. If you add import sys to where import dbus is and run the modified script with:
it will tell you where the problem is.Code:python myscript.py
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. At least this works as long as you don't have any other multi-line fields (for scripts, you can modify them to output the color prefix on every line).
The Following User Says Thank You to Win7Mac For This Useful Post: | ||
|
2013-01-13
, 09:37
|
Posts: 277 |
Thanked: 319 times |
Joined on Jan 2010
|
#503
|
|
2013-01-14
, 13:59
|
Posts: 277 |
Thanked: 319 times |
Joined on Jan 2010
|
#504
|
#!/usr/bin/python # Print various attributes of alarm(s) by modifying the last line # Author: Slarti import dbus from datetime import datetime, timedelta, date bus = dbus.SystemBus() time_obj = bus.get_object('com.nokia.time', '/com/nokia/time') time_intf = dbus.Interface(time_obj, 'com.nokia.time') alarm_obj = bus.get_object('com.nokia.time', '/org/maemo/contextkit/Alarm/Trigger') alarms = alarm_obj.Get(dbus_interface='org.maemo.contextkit.Property')[0] cookies = alarms[0].keys() alarms_list = [] for cookie in cookies: timestamp = alarms[0][cookie] attributes = time_intf.query_attributes(cookie) alarms_list.append(((timestamp,cookie,attributes))) alarms_list.sort() # Change these to your own language in the order # they are in if you want to print the weekday: abb_weekdays = ['Mon','Tue','Wed','Thu','Fri','Sat','Sun'] # Choose the limit for the number of alarms (lines) to print: limit = 5 # Don't touch this: if len(alarms_list) < limit: limit = len(alarms_list) # This generates what to print on every line: for i in range(limit): # Don't touch this: alarm_timestamp = datetime.fromtimestamp((alarms_list[i][0])/1000000000) # You can choose from these: weekday = abb_weekdays[date.weekday(alarm_timestamp)] title = alarms_list[i][2]['TITLE'] alarmtime = datetime.strftime(alarm_timestamp,"%H:%M") time_to_alarm = ':'.join(str(alarm_timestamp - datetime.now()).split(':')[:2]) snooze = alarms_list[i][2]['snooze']+'min' # This is the special character. Look for the Python source code # string at e.g. http://www.fileformat.info/info/unicode/block/index.htm sc = u"\u2691" # Here you can decide what to print in which order: print (weekday+' '+title+' '+alarmtime+' '+time_to_alarm+' '+snooze+' '+sc).encode('utf-8')
|
2013-01-14
, 15:37
|
|
Community Council |
Posts: 664 |
Thanked: 1,648 times |
Joined on Apr 2012
@ Hamburg
|
#505
|
|
2013-01-14
, 15:41
|
|
Posts: 6,436 |
Thanked: 12,701 times |
Joined on Nov 2011
@ Ängelholm, Sweden
|
#506
|
|
2013-01-14
, 16:03
|
Posts: 277 |
Thanked: 319 times |
Joined on Jan 2010
|
#507
|
Whow... now we're talking...
Great job, very cool!
I wish we could have this for events.
Only thing left: where to put the {{color}} tag in the script for all alarms?
print ('{{green}}'+weekday+' '+title+' '+alarmtime+' '+time_to_alarm+' '+snooze+' '+sc).encode('utf-8')
The Following User Says Thank You to slarti For This Useful Post: | ||
|
2013-01-14
, 16:32
|
|
Community Council |
Posts: 664 |
Thanked: 1,648 times |
Joined on Apr 2012
@ Hamburg
|
#508
|
text=$(gconftool -g /apps/billboard/text) gconftool -s -t string /apps/billboard/text "{{white}}Updating..." gconftool -s -t string /apps/billboard/text "${text}"
It's possible to get the cookies for the queued events, too. Might be doable with some changes. What attributes would have to be included?
Anywhere on the last line. You just have to surround it with quotes. If you want the whole line(s) to be green, put it in the front.
|
2013-01-14
, 18:14
|
Posts: 277 |
Thanked: 319 times |
Joined on Jan 2010
|
#509
|
The text in BB is still there, but it's not showing anymore.
I also tried without the middle line, but it remains telling me "Updating..."
Could you please provide a fix and the correct code for terminal too?
gconftool -s -t string /apps/billboard/text "PASTE YOUR TEXT HERE"
The Following User Says Thank You to slarti For This Useful Post: | ||
|
2013-01-14
, 18:58
|
|
Community Council |
Posts: 664 |
Thanked: 1,648 times |
Joined on Apr 2012
@ Hamburg
|
#510
|
I'll have to think about the second alarm. I'm only learning python and scripting myself and this script was meant for just the next one. It sorts the alarms chronologically and prints the next one (from now) in the list. It could print the next two but then this next part would be more difficult: