Read Me
# -*- coding: utf-8 -*-
# Example of using the pySnarl library from
# http://sourceforge.net/projects/pysnarl/
# This is a very simple example of using the library.
# If you will want to see a more complex example, look at Snarl plugin here:
# http://www.eventghost.net/forum/viewtopic.php?f=9&t=3587
# There you can even see how to use the Event handler
#==============================================================================
import pySnarl
from time import sleep
snarl = pySnarl.SnarlApp(
"pySnarl/DemoApp", # app signature
"pySnarl Demo", # app title
"", # icon
"", # config Tool
"""This is an example of using the pySnarl library
from http://sourceforge.net/projects/pysnarl/""", # hint
False, # IsDaemon
"", # event handler
[] # classes
)
snarl.register()
snarl.notify(
[], # actions
"", # callbackScript
"", # callbackScriptType
"", # class
"", # defaultCallback
8, # duration
r"C:\Windows\win98Logo.ico", # icon
"", # mergeUID
0, # priority
"", # replaceUID
'This is notification text - default (<Other>) CLASS',
"Notification title",
"myUid_000",# UID
r"C:\Windows\Media\notify.wav", # sound
33, # percent
0, # log
64, # sensitivity
)
sleep(5)
class_1 = (
"MyClass_1", # class Id
"ThisIsMyClass_1", # name
True, # Enabled
"This is def. title 1", # DefaultTitle
"This is def. text 1", # DefaultText
"", # DefaultIcon
"", # DefaultCallback
10, # DefaultDuration
"", # DefaultSound
)
snarl.addClass(*class_1)
print "There is %i class" % snarl.classesCount()
snarl.addClass(
"MyClass_2", # class Id
"ThisIsMyClass_2", # name
True, # Enabled
"This is def. title 2", # DefaultTitle
"This is def. text 2", # DefaultText
"", # DefaultIcon
"", # DefaultCallback
0, # DefaultDuration
"", # DefaultSound
)
print "There are %i classes" % snarl.classesCount()
snarl.notify(
[], # actions
"", # callbackScript
"", # callbackScriptType
"MyClass_1", # class
"", # defaultCallback
6, # duration
"", # icon
"", # mergeUID
0, # priority
"", # replaceUID
"This is notification text - CLASS 1",
"Title 1A",
"myUid_001a",# UID
"", # sound
-1, # percent
0, # log
0, # sensitivity
)
sleep(5)
snarl.notify(
[], # actions
"", # callbackScript
"", # callbackScriptType
"MyClass_1", # class
"", # defaultCallback
3, # duration
"", # icon
"myUid_001a",# mergeUID
0, # priority
"", # replaceUID
"This is an example of the merging",
"Title 1B",
"myUid_001b",# UID
"", # sound
-1, # percent
0, # log
0, # sensitivity
)
sleep(5)
snarl.remClass("MyClass_1")
print "There is %i class" % snarl.classesCount()
snarl.notify(
[], # actions
"", # callbackScript
"", # callbackScriptType
"MyClass_2",# class
"", # defaultCallback
-1, # duration
"", # icon
"", # mergeUID
1, # priority
"", # replaceUID
"This is notification text - CLASS 2/HIGH PRIORITY",
"Title 2",
"myUid_002",# UID
log = 1,
)
sleep(5)
snarl.hideNotification("myUid_002")
sleep(1)
snarl.tidyUp()