def createNotify(self, content):
     """function to create notification for label"""
     notification = KNotification(content[0])
     notification.setComponentData(KComponentData("plasma_applet_pytextmonitor"))
     notification.setTitle("PyTextMonitor info ::: " + content[0]);
     notification.setText(content[1]);
     notification.sendEvent();
Exemple #2
0
    class Tray(KSystemTrayIcon, PTray):
        def __init__(self, parent, iface):
            KSystemTrayIcon.__init__(self, parent)
            self.appWindow = parent
            PTray.__init__(self, iface)

        def initializePopup(self):
            self.setIcon(self.defaultIcon)
            self.actionMenu = KActionMenu(i18n("Update"), self)
            self.populateRepositoryMenu()
            self.contextMenu().addAction(self.actionMenu)
            self.contextMenu().addSeparator()

        def populateRepositoryMenu(self):
            self.actionMenu.menu().clear()
            for name, address in self.iface.getRepositories():
                self._addAction(name, self.actionMenu)
            self._addAction(i18n("All"), self.actionMenu)

        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()
Exemple #3
0
 def createNotify(self, content):
     """function to create notification for label"""
     if self.debug: qDebug("[PTM] [ptmnotify.py] [createNotify]")
     if self.debug: qDebug("[PTM] [ptmnotify.py] [createNotify] : Run function with content '%s'" %(content))
     notification = KNotification(content[0])
     notification.setComponentData(KComponentData("plasma_applet_pytextmonitor"))
     notification.setTitle("PyTextMonitor info ::: " + content[0]);
     notification.setText(content[1]);
     notification.sendEvent();
Exemple #4
0
class Tray(KStatusNotifierItem, PTray):
    def __init__(self, parent, iface):
        KSystemTrayIcon.__init__(self, parent)
        self.appWindow = parent
        self.setAssociatedWidget(parent)
        PTray.__init__(self, iface)

    def initializePopup(self):
        self.setIconByPixmap(self.defaultIcon)
        self.actionMenu = KActionMenu(i18n("Update"), self)
        self.populateRepositoryMenu()
        self.contextMenu().addAction(self.actionMenu)
        self.contextMenu().addSeparator()

    def populateRepositoryMenu(self):
        self.actionMenu.menu().clear()
        has_repo = False
        for name, address in self.iface.getRepositories(only_active=True):
            self._addAction(name, self.actionMenu)
            has_repo = True
        if has_repo:
            self._addAction(i18n("All"), self.actionMenu)

    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()