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:
parent
aba8637900
commit
207dbbcdb8
|
@ -88,6 +88,8 @@ class Window(QDialog):
|
||||||
self.timer = QTimer(self)
|
self.timer = QTimer(self)
|
||||||
self.timer.timeout.connect(mail_check)
|
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
|
# Menu actions
|
||||||
def createActions(self):
|
def createActions(self):
|
||||||
self.aboutShow = QAction(QIcon(':icons/mailbox_empty.png'),"&About", self, triggered=self.aboutShow)
|
self.aboutShow = QAction(QIcon(':icons/mailbox_empty.png'),"&About", self, triggered=self.aboutShow)
|
||||||
|
@ -333,7 +335,11 @@ def mail_check():
|
||||||
painter.end()
|
painter.end()
|
||||||
# End drawing text on icon
|
# End drawing text on icon
|
||||||
window.trayIcon.setIcon(QtGui.QIcon(pixmap))
|
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")
|
notify ("You have "+ str(mail_count) +" unread letters")
|
||||||
|
# check was successfull, lastCheckCount is updating
|
||||||
|
window.lastCheckCount = mail_count
|
||||||
def notify(message):
|
def notify(message):
|
||||||
if settings.value("Notify"):
|
if settings.value("Notify"):
|
||||||
subprocess.Popen(['notify-send', programTitle, message])
|
subprocess.Popen(['notify-send', programTitle, message])
|
||||||
|
|
Loading…
Reference in New Issue