|
@@ -14,7 +14,7 @@ import colorsys
|
14
|
14
|
import serial, serial.tools, serial.tools.list_ports
|
15
|
15
|
from PyQt5 import QtWidgets, QtGui, QtCore
|
16
|
16
|
from PyQt5.QtWidgets import QSystemTrayIcon, QAction, QMenu
|
17
|
|
-from PyQt5.QtGui import QIcon, QPixmap
|
|
17
|
+from PyQt5.QtGui import QIcon, QPixmap, QCursor
|
18
|
18
|
from PyQt5.QtCore import QCoreApplication, QSettings
|
19
|
19
|
|
20
|
20
|
class CaseLights():
|
|
@@ -124,10 +124,15 @@ class CaseLights():
|
124
|
124
|
trayIcon = QSystemTrayIcon(icon)
|
125
|
125
|
trayIcon.setToolTip(self.name + " " + self.version)
|
126
|
126
|
trayIcon.setContextMenu(self.menu)
|
|
127
|
+ trayIcon.activated.connect(self.showHide)
|
127
|
128
|
trayIcon.setVisible(True)
|
128
|
129
|
|
129
|
130
|
sys.exit(app.exec_())
|
130
|
131
|
|
|
132
|
+ def showHide(self, activationReason):
|
|
133
|
+ if activationReason == QSystemTrayIcon.Trigger:
|
|
134
|
+ self.menu.popup(QCursor.pos())
|
|
135
|
+
|
131
|
136
|
def exit(self):
|
132
|
137
|
if self.serial is not None:
|
133
|
138
|
if self.serial.is_open:
|