fixed the bug that application sometimes didn't detect system tray when autostarted with DE

This commit is contained in:
Rinaldus 2015-11-15 02:03:53 +03:00
parent da66d607e1
commit 42cf334b37
1 changed files with 10 additions and 5 deletions

View File

@ -15,6 +15,7 @@ from PyQt5 import QtCore, QtGui, QtWidgets
import os import os
import socket import socket
import hashlib, uuid import hashlib, uuid
import time
#variables #variables
timers = [] timers = []
@ -195,11 +196,15 @@ class Thread(QThread):
if __name__ == '__main__': if __name__ == '__main__':
import sys import sys
app = QApplication(sys.argv) app = QApplication(sys.argv)
# Some DE are not response adequately on it, trying to ignore tray check systemtray_timeout = 0
# if not QSystemTrayIcon.isSystemTrayAvailable(): # Check if DE supports system tray
# QMessageBox.critical(None, "Mail notifier", while not QSystemTrayIcon.isSystemTrayAvailable():
# "I couldn't detect any system tray on this system.") systemtray_timeout += 1
# sys.exit(1) time.sleep (20)
if systemtray_timeout == 5:
QMessageBox.critical(None, "Mail notifier",
"I couldn't detect any system tray on this system.")
sys.exit(1)
QApplication.setQuitOnLastWindowClosed(False) QApplication.setQuitOnLastWindowClosed(False)
window = Window() window = Window()
if SettingsExist(): if SettingsExist():