Fixed program crash if OS doesn't support baloon notification

This commit is contained in:
Rinaldus 2017-11-16 16:25:23 +03:00
parent 66020b44a5
commit b04cb9a6ff
Signed by: Rinaldus
GPG Key ID: C34E249005178E87
1 changed files with 7 additions and 4 deletions

View File

@ -22,7 +22,7 @@ from datetime import datetime, date, time
#variables #variables
programTitle = "Mail Notifier" programTitle = "Mail Notifier"
programVersion = "3.01" programVersion = "3.01-dev"
settings = QSettings(os.path.expanduser("~")+"/.config/mail-notifier/settings.conf", QSettings.NativeFormat) settings = QSettings(os.path.expanduser("~")+"/.config/mail-notifier/settings.conf", QSettings.NativeFormat)
def GlobalSettingsExist(): def GlobalSettingsExist():
if ((settings.contains("CheckInterval") and settings.value("CheckInterval") != "") and if ((settings.contains("CheckInterval") and settings.value("CheckInterval") != "") and
@ -438,9 +438,12 @@ def mail_check():
# check was successfull, lastCheckCount is updating # check was successfull, lastCheckCount is updating
window.lastCheckCount = mail_count window.lastCheckCount = mail_count
def notify(message): def notify(message):
if settings.value("Notify"): try:
subprocess.Popen(['notify-send', programTitle, message]) if settings.value("Notify"):
return subprocess.Popen(['notify-send', programTitle, message])
return
except:
print(message)