Yeah, using Snarl is a bit of a trade-off. It eliminates the burden of writing code that gives the end user the ability to customize the look and behavior of the notifications, but it also adds that additional dependency. To be fair, though, unless you intend on packaging this application with py2exe or cxFreeze, you're already assuming that the user has a valid Python interpreter installed. (And I'm guessing that your code doesn't account for compatibility with Python 3, so you're also assuming that the installed version is the same version as your own)
Anyways, if you're looking to maintain compatibility across platforms, (for instance, having it work with Growl on Mac OSX) you'll probably want to use the GNTP protocol instead of SNP. (There's a python module for it
here) GNTP is the protocol used by Growl and Growl for Windows, but SnagIt also accepts it. (Growl, meanwhile, does not accept SNP)
Anyways, if it was me writing this, I'd try to keep the logic that handles parsing server output and pushing notifications separate from rest of the code. I'd then write two classes, one that takes the notifications and pushes them out to Snarl/Growl/Whatever (Let's call it
GNTPCaster), and another that takes the notifications, and displays them with the GUI you were originally writing into this. (We'll call this one
GUICaster)
By doing all that, I could then do the following in the startup code:
from broadcasters import GNTPCaster, GUICaster
from gntp.notifier import GrowlNotifier
def main():
broadcaster = None
try:
# Attempt to connect to the user's notification software. (Snarl/Growl/etc)
client = GrowlNotifier(
applicationName = 'Desktop Broadcaster',
notifications = ['Some notification','Some other notification'],
defaultNotifications = ['Some notification'],
)
client.register()
broadcaster = GNTPCaster(client)
except:
# If no notification software is currently running, an exception will be
# thrown. At this point, we'll fall back to using the application's own
# GUI system to display notifications.
broadcaster = GUICaster()
...
# Blah blah. Fast forward to when you've finished parsing the server output/whatever
# and you're ready to show a notification
broadcaster.show(title, message, whatever_else)
In the end, it'd allow you to support both options, but you'd end up writing even more code, which sort of defeats the purpose of my original suggestion. Anyways, all that's your call, and since you're doing this to have fun and learn, I wouldn't worry about it too much.
Personally, I'm probably never going to use this, (don't really care what's going on in the servers and even if I did, notification programs start annoying the fuck out of me after the 5th popup) so my advice is strictly from a programming standpoint. Nonetheless, if have any questions or want to bounce ideas, I'm usually in the IRC channel Leel mentioned.