def show_notify(self, dbus_id, tray, nid, app_name, replaces_nid, app_icon, summary, body, actions, hints, expire_timeout, icon): getHWND = getattr(tray, "getHWND", None) if GTK_NOTIFIER or tray is None or getHWND is None or actions: log( "show_notify(..) using gtk fallback, GTK_NOTIFIER=%s, tray=%s, getHWND=%s, actions=%s", GTK_NOTIFIER, tray, getHWND, actions) gtk_notifier = self.get_gtk_notifier() if gtk_notifier: gtk_notifier.show_notify(dbus_id, tray, nid, app_name, replaces_nid, app_icon, summary, body, actions, hints, expire_timeout, icon) self.gtk_notifications.add(nid) return if tray is None: log.warn("Warning: no system tray - cannot show notification!") return hwnd = getHWND() app_id = tray.app_id log("show_notify%s hwnd=%#x, app_id=%i", (dbus_id, tray, nid, app_name, replaces_nid, app_icon, summary, body, actions, hints, expire_timeout, icon), hwnd, app_id) #FIXME: remove handles when notification is closed self.notification_handles[nid] = (hwnd, app_id) do_notify(hwnd, app_id, summary, body, expire_timeout, icon)
def DBUS_Notifier_factory(*args): try: return DBUS_Notifier(*args) except Exception as e: log.warn("failed to instantiate the dbus notification handler:") if str(e).startswith("org.freedesktop.DBus.Error.ServiceUnknown:"): log.warn( " you may need to start a notification service for 'org.freedesktop.Notifications'" ) else: log.warn(" %s", e) log.warn(" disable notifications to avoid this warning") return None
def CloseNotificationError(dbus_error, *_args): log.warn("Error: error closing notification:") log.warn(" %s", dbus_error)