Changeset 940 for kde/dbus/knotify-client
- Timestamp:
- Dec 9, 2010, 8:25:47 PM (14 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kde/dbus/knotify-client
-
Property svn:keywords
set to
Id
r938 r940 2 2 # -*- coding: utf-8 -*- 3 3 4 """ 5 knotify-client sends messages to the KDE knotify daemon. 6 KDE applications can define different types of messages 7 and theses types define different actions 8 (display message, play sound, start program, ...) 9 10 tested on KDE 4.3.5 (openSUSE 11.2) 11 """ 12 13 # $Id$ 14 15 4 16 import sys 5 17 import dbus 18 from os import system 6 19 from pprint import pprint 7 20 from time import sleep … … 11 24 from optparse import OptionParser 12 25 13 parser = OptionParser() 26 27 parser = OptionParser(usage = "\n %prog [options] 'text message to send to knotify'\n %prog --appevents APPLICATION") 14 28 #parser.add_argument('message', type=string, nargs='+', 15 29 # help='message text to send') 16 30 parser.add_option('--event', dest='event', default="notification", 17 help='event ')18 parser.add_option('--app', dest='app ', default="kde",19 help=' fromApp')31 help='event (default: %default). Use --appevents to get list of events') 32 parser.add_option('--app', dest='application', default="kde", 33 help='event from application (default: %default)') 20 34 parser.add_option('--title', dest='title', default=sys.argv[0], 21 help=' event')35 help='text in title of knotify message') 22 36 parser.add_option('--timeout', dest='timeout', type=int, default=0, 23 37 help='timeout in seconds. Without timeout, message will stay until it is confirmed, but ' + sys.argv[0] + ' will return immedialy') 38 parser.add_option('--appevents', metavar='APPLICATION', dest='appevents', 39 help='print list of events for application') 24 40 (options, args) = parser.parse_args() 25 41 26 42 print "options:" 27 43 pprint(options) 44 45 if options.appevents: 46 ressource = options.appevents + "/" + options.appevents + ".notifyrc" 47 system("kread-ressource.py --type data " + ressource ) 48 exit(0) 28 49 29 50 message = " ".join( args ) … … 53 74 # specifiing timeout as parameter does not show a effect, 54 75 # therefore notification is closed manually after timeout 55 id = knotify.event( options.event, options.app , [], options.title, message, [], [], options.timeout, dbus_interface="org.kde.KNotify")76 id = knotify.event( options.event, options.application, [], options.title, message, [], [], options.timeout, dbus_interface="org.kde.KNotify") 56 77 57 78 if options.timeout > 0: -
Property svn:keywords
set to
Note:
See TracChangeset
for help on using the changeset viewer.