Adding Growl Support
Growl is a notification daemon for Mac OS/X. Applications supporting Growl can send it information, upon which Growl can issue a pop-up to notify the user. It is a popular program and supporting it is fairly easy. This text will focus on the Python support, and will assume you have Growl installed already.
In Tribler, basic Growl support was integrated in changesets [2528] and [2529].
Obtaining Python bindings
First, grab a Subversion checkout:
svn co http://src.growl.info/growl/trunk growl
Then, install the Python bindings:
cd growl/Bindings/python sudo python setup.py install
First Test
Make sure you have access to tribler.icns (found in the mac/ directory of Tribler). Consider the following program:
import Growl
# The name of the application
appname = "Tribler"
# Location of the icon to use
appicon = Growl.Image.imageFromPath('tribler.icns')
# Classes of notifications
notification_names = ["Download started","Download finished"]
# Register application
x = Growl.GrowlNotifier( appname, notification_names, applicationIcon=appicon )
x.register()
# Send notification
x.notify("Download started","Downloading","Foo.torrent")
The above program will register itself with Growl, specifying its application name, icon and the classes of notifications it will send. The latter allows the user to configure which classes he will actually allow to pop-up. After registering, a notification is sent, specifying the class name, the title and the content of the pop-up. For example, the popup could look like this:
Notice that if Growl is not installed, the above code will do nothing.
Attachments
- Example growl popup.png (8.9 kB) - added by jdmol on 01/28/07 11:46:30.
- Growl in Tribler.png (229.0 kB) - added by jdmol on 01/28/07 14:50:20.


