Popup notification behaviour was changed

Now popup notification appears only if the number of unread emails has
changed since last mail check
This commit is contained in:
Rinaldus 2016-07-22 15:02:13 +03:00
parent aba8637900
commit 207dbbcdb8
Signed by: Rinaldus
GPG Key ID: C34E249005178E87
1 changed files with 7 additions and 1 deletions

View File

@ -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))
# 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])