Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove pynotify notifications. #456

Merged
merged 2 commits into from
Mar 15, 2017
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
23 changes: 6 additions & 17 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,10 @@ 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")

# Notifications for growlnotify on Mac OS X
if notify_backend == 'growlnotify':
import gntp.notifier
Expand Down Expand Up @@ -89,23 +94,7 @@ 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':
elif notify_backend == 'gobject' or notify_backend == 'pynotify':
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpick: Would it be better to set notify_backend = 'gobject' after the warning so this deprecated setting is handled in just one place? Seems simpler to cleanup if and when it's removed and less confusing if references to historical features are all in one place.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, good call.

_cache_logo()

import gi
Expand Down