[X2Go-Commits] [pyhoca-gui] 01/01: Revert "pyhoca/wxgui/notify.py: Drop support for GTK2'ish pynotify. Dead upstream."

git-admin at x2go.org git-admin at x2go.org
Wed Nov 20 07:59:14 CET 2019


This is an automated email from the git hooks/post-receive script.

x2go pushed a commit to branch master
in repository pyhoca-gui.

commit c8aa892ac21d0ec2d9f354cef190c972e0d0a533
Author: Mike Gabriel <mike.gabriel at das-netzwerkteam.de>
Date:   Wed Nov 20 07:58:46 2019 +0100

    Revert "pyhoca/wxgui/notify.py: Drop support for GTK2'ish pynotify. Dead upstream."
    
     This reverts commit 250b594087905031737f47060a383a3271777a17.
    
     As long as we support RHEL 6 and SUSE 11.x, we need this.
---
 pyhoca/wxgui/notify.py | 17 ++++++++++++++---
 1 file changed, 14 insertions(+), 3 deletions(-)

diff --git a/pyhoca/wxgui/notify.py b/pyhoca/wxgui/notify.py
index 843597c..7431915 100644
--- a/pyhoca/wxgui/notify.py
+++ b/pyhoca/wxgui/notify.py
@@ -23,7 +23,13 @@ import wx
 from x2go import X2GOCLIENT_OS
 from x2go import log
 if X2GOCLIENT_OS in ('Linux', 'Mac'):
-    from gi.repository import Notify as _Notify
+    try:
+        # try the GTK3 way for notification support first...
+        from gi.repository import Notify as _Notify
+    except ImportError:
+        # GTK3 notifications are unavailable,
+        # hopefully pynotify / GTK2-based notifications are available then...
+        import pynotify as _Notify
 import exceptions
 import basepath
 
@@ -243,8 +249,13 @@ class libnotify_NotifierPopup(object):
 
         try:
             if not self._PyHocaGUI.disable_notifications and title and text:
-                n = _Notify.Notification.new(title, text, icon)
-                n.set_urgency(_Notify.Urgency.NORMAL)
+                try:
+                    n = _Notify.Notification.new(title, text, icon)
+                    n.set_urgency(_Notify.Urgency.NORMAL)
+                except AttributeError:
+                    # handle pynotify / GTK2-based notifications
+                    n = _Notify.Notification(title, text, icon)
+                    n.set_urgency(_Notify.URGENCY_NORMAL)
                 n.set_timeout(timeout)
                 n.show()
         except:

--
Alioth's /home/x2go-admin/maintenancescripts/git/hooks/post-receive-email on /srv/git/code.x2go.org/pyhoca-gui.git


More information about the x2go-commits mailing list