Skip to content

Commit

Permalink
Handle Growl exceptions.
Browse files Browse the repository at this point in the history
  • Loading branch information
sorin-ionescu committed Oct 10, 2011
1 parent 4a015c9 commit 15b07bd
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions growl.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@

SCRIPT_NAME = 'growl'
SCRIPT_AUTHOR = 'Sorin Ionescu <sorin.ionescu@gmail.com>'
SCRIPT_VERSION = '1.0.2'
SCRIPT_VERSION = '1.0.3'
SCRIPT_LICENSE = 'MIT'
SCRIPT_DESC = 'Sends Growl notifications upon events.'


# Changelog
#
# 2011-10-10: v1.0.3 Handle Growl exceptions.
# 2011-10-04: v1.0.2 Growl 1.3 requires GNTP.
# 2011-09-25: v1.0.1 Always show highlighted messages if set on.
# 2011-03-27: v1.0.0 Initial release.
Expand Down Expand Up @@ -74,9 +74,7 @@
print('This script must be run under WeeChat.')
print('Get WeeChat at http://www.weechat.org.')
elif str(error) == 'No module named notifier':
weechat.prnt('', 'Growl GNTP Python bindings are not installed.')
else:
weechat.prnt('', "Growl could not be loaded, '%s'." % (error))
weechat.prnt('', 'growl: GNTP bindings are not installed')


# -----------------------------------------------------------------------------
Expand Down Expand Up @@ -417,7 +415,10 @@ def growl_notify(notification, title, description, priority=None):
is_sticky = True
if weechat.config_get_plugin('sticky_away') == 'on' and is_away:
is_sticky = True
growl.notify(notification, title, description, '', is_sticky, priority)
try:
growl.notify(notification, title, description, '', is_sticky, priority)
except Exception as error:
weechat.prnt('', 'growl: {0}'.format(str(error)))


# -----------------------------------------------------------------------------
Expand Down Expand Up @@ -459,7 +460,10 @@ def main():
password=password,
notifications=notifications,
applicationIcon=icon)
growl.register()
try:
growl.register()
except Exception as error:
weechat.prnt('', 'growl: {0}'.format(str(error)))
STATE['growl'] = growl
# Register hooks.
weechat.hook_signal(
Expand Down

0 comments on commit 15b07bd

Please sign in to comment.