From 207dbbcdb84ca8bb2cbd35e8728f589d75766452 Mon Sep 17 00:00:00 2001 From: Rinaldus Date: Fri, 22 Jul 2016 15:02:13 +0300 Subject: [PATCH] Popup notification behaviour was changed Now popup notification appears only if the number of unread emails has changed since last mail check --- mail-notifier.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/mail-notifier.py b/mail-notifier.py index 3ddcaa8..5f95bc0 100755 --- a/mail-notifier.py +++ b/mail-notifier.py @@ -88,6 +88,8 @@ class Window(QDialog): self.timer = QTimer(self) self.timer.timeout.connect(mail_check) + self.lastCheckCount = 0 # variable for prevent annoying popup notification when mail count didn't change since last check + # Menu actions def createActions(self): self.aboutShow = QAction(QIcon(':icons/mailbox_empty.png'),"&About", self, triggered=self.aboutShow) @@ -333,7 +335,11 @@ def mail_check(): painter.end() # End drawing text on icon window.trayIcon.setIcon(QtGui.QIcon(pixmap)) - notify ("You have "+ str(mail_count) +" unread letters") + # Popup notification appears only if mail count changed since last check + if (mail_count != window.lastCheckCount): + notify ("You have "+ str(mail_count) +" unread letters") + # check was successfull, lastCheckCount is updating + window.lastCheckCount = mail_count def notify(message): if settings.value("Notify"): subprocess.Popen(['notify-send', programTitle, message])