Skip to content

Commit

Permalink
Merge pull request #456 from ralphbean/feature/remove-pynotify
Browse files Browse the repository at this point in the history
Remove pynotify notifications.
  • Loading branch information
ralphbean authored Mar 15, 2017
2 parents d634d2e + 3ad97f4 commit ec3fbf6
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 22 deletions.
2 changes: 0 additions & 2 deletions bugwarrior/docs/common_configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,6 @@ Backend options:
+------------------+------------------+-------------------------+
| ``gobject`` | Linux | ``gobject`` |
+------------------+------------------+-------------------------+
| ``pynotify`` | Linux | ``pynotify`` |
+------------------+------------------+-------------------------+

.. note::

Expand Down
7 changes: 3 additions & 4 deletions bugwarrior/docs/configuration.rst
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,10 @@ Example Configuration
#
# - growlnotify (v2) Mac OS X "gntp" must be installed
# - gobject Linux python gobject must be installed
# - pynotify Linux "pynotify" must be installed
#
# To configure, adjust the settings below. Note that neither of the
# "sticky" options have any effect on Linux with pynotify. They only work
# for growlnotify.
# To configure, adjust the settings below. Note that neither of the #
# "sticky" options have any effect on Linux. They only work for
# growlnotify.
#[notifications]
# notifications = True
# backend = growlnotify
Expand Down
22 changes: 6 additions & 16 deletions bugwarrior/notifications.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import datetime
import os
import urllib.request, urllib.parse, urllib.error
import warnings

from bugwarrior.config import asbool

Expand Down Expand Up @@ -52,6 +53,11 @@ def _get_metadata(issue):
def send_notification(issue, op, conf):
notify_backend = conf.get('notifications', 'backend')

if notify_backend == 'pynotify':
warnings.warn("pynotify is deprecated. Use backend=gobject. "
"See https://github.com/ralphbean/bugwarrior/issues/336")
notify_backend = 'gobject'

# Notifications for growlnotify on Mac OS X
if notify_backend == 'growlnotify':
import gntp.notifier
Expand Down Expand Up @@ -89,22 +95,6 @@ def send_notification(issue, op, conf):
priority=1,
)
return
elif notify_backend == 'pynotify':
_cache_logo()

import pynotify
pynotify.init("bugwarrior")

if op == 'bw finished':
message = "Finished querying for new issues.\n%s" %\
issue['description']
else:
message = "%s task: %s" % (op, issue['description'])
metadata = _get_metadata(issue)
if metadata is not None:
message += metadata

pynotify.Notification("Bugwarrior", message, logo_path).show()
elif notify_backend == 'gobject':
_cache_logo()

Expand Down

0 comments on commit ec3fbf6

Please sign in to comment.