Double click detection for SystemTray. Returned as an event
This commit is contained in:
parent
bca3fd18ee
commit
2f29ada293
|
@ -200,10 +200,13 @@ ThisRow = 555666777 # magic number
|
||||||
MESSAGE_BOX_LINE_WIDTH = 60
|
MESSAGE_BOX_LINE_WIDTH = 60
|
||||||
|
|
||||||
# "Special" Key Values.. reserved
|
# "Special" Key Values.. reserved
|
||||||
|
# Events that are pre-defined
|
||||||
# Key representing a Read timeout
|
# Key representing a Read timeout
|
||||||
TIMEOUT_KEY = '__TIMEOUT__'
|
TIMEOUT_KEY = '__TIMEOUT__'
|
||||||
# Key indicating should not create any return values for element
|
# Key indicating should not create any return values for element
|
||||||
WRITE_ONLY_KEY = '__WRITE ONLY__'
|
WRITE_ONLY_KEY = '__WRITE ONLY__'
|
||||||
|
EVENT_SYSTEM_TRAY_ICON_DOUBLE_CLICKED = '__DOUBLE_CLICKED__'
|
||||||
|
EVENT_SYSTEM_TRAY_MESSAGE_CLICKED = '__MESSAGE_CLICKED__'
|
||||||
|
|
||||||
# Meny key indicator character / string
|
# Meny key indicator character / string
|
||||||
MENU_KEY_SEPARATOR = '::'
|
MENU_KEY_SEPARATOR = '::'
|
||||||
|
@ -2705,7 +2708,7 @@ class SystemTray:
|
||||||
self.TrayIcon.setToolTip(str(self.Tooltip))
|
self.TrayIcon.setToolTip(str(self.Tooltip))
|
||||||
|
|
||||||
self.TrayIcon.messageClicked.connect(self.messageClicked)
|
self.TrayIcon.messageClicked.connect(self.messageClicked)
|
||||||
|
self.TrayIcon.activated.connect(self.doubleClicked)
|
||||||
self.TrayIcon.setContextMenu(qmenu)
|
self.TrayIcon.setContextMenu(qmenu)
|
||||||
|
|
||||||
|
|
||||||
|
@ -2715,10 +2718,15 @@ class SystemTray:
|
||||||
|
|
||||||
# callback function when message is clicked
|
# callback function when message is clicked
|
||||||
def messageClicked(self):
|
def messageClicked(self):
|
||||||
self.MenuItemChosen = '_MESSAGE_CLICKED_'
|
self.MenuItemChosen = EVENT_SYSTEM_TRAY_MESSAGE_CLICKED
|
||||||
self.App.exit()
|
self.App.exit()
|
||||||
|
|
||||||
|
|
||||||
|
def doubleClicked(self, reason):
|
||||||
|
if reason in (QSystemTrayIcon.Trigger, QSystemTrayIcon.DoubleClick):
|
||||||
|
self.MenuItemChosen = EVENT_SYSTEM_TRAY_ICON_DOUBLE_CLICKED
|
||||||
|
self.App.exit()
|
||||||
|
|
||||||
def Read(self, timeout=None):
|
def Read(self, timeout=None):
|
||||||
'''
|
'''
|
||||||
Reads the context menu
|
Reads the context menu
|
||||||
|
|
Loading…
Reference in New Issue