Exemple #1
0
        def do_show():
            notification = KNotification("Updates")

            # Keep a reference or the callback of the actions added
            # below will never work.
            # See: https://bugzilla.redhat.com/show_bug.cgi?id=241531
            self.__last_notification = notification

            notification.setFlags(KNotification.CloseOnTimeout)
            notification.setText("<b>%s</b><br/>%s" % (
                title,
                text,
            ))
            if buttons:
                notification.setActions([x[1] for x in buttons])
                notification.connect(notification,
                                     SIGNAL("activated(unsigned int)"),
                                     _action_activate_cb)

            icon_name = "okay"
            status = KStatusNotifierItem.Passive
            if urgency == "critical":
                icon_name = "critical"
                status = KStatusNotifierItem.Active

            name = self.icons.get(icon_name)
            icon = KIcon(name)
            self._window.setStatus(status)

            notification.setPixmap(icon.pixmap(48, 48))
            notification.sendEvent()
            self.last_alert = (title, text)
Exemple #2
0
 def showPopup(self):
     if self._ready_to_popup():
         if self.notification:
             del self.notification
         self.notification = KNotification("Updates")
         self.notification.setText(
             i18n("There are <b>%1</b> updates available!", self.unread))
         self.notification.setActions(
             QStringList((i18n("Show Updates"), i18n("Ignore"))))
         self.notification.setFlags(KNotification.Persistent)
         self.notification.setComponentData(
             KComponentData("package-manager", "package-manager"))
         self.connect(self.notification, SIGNAL("action1Activated()"),
                      lambda: self.emit(SIGNAL("showUpdatesSelected()")))
         self.notification.sendEvent()