commit
9feb5be8b2
|
@ -2656,7 +2656,7 @@ class ErrorElement(Element):
|
||||||
# Tray CLASS #
|
# Tray CLASS #
|
||||||
# ------------------------------------------------------------------------- #
|
# ------------------------------------------------------------------------- #
|
||||||
class SystemTray:
|
class SystemTray:
|
||||||
def __init__(self, title, filename=None, menu=None, data=None, data_base64=None):
|
def __init__(self, title, filename=None, menu=None, data=None, data_base64=None, tooltip=None):
|
||||||
'''
|
'''
|
||||||
SystemTray - create an icon in the system tray
|
SystemTray - create an icon in the system tray
|
||||||
:param title:
|
:param title:
|
||||||
|
@ -2670,6 +2670,7 @@ class SystemTray:
|
||||||
self.TrayIcon = None
|
self.TrayIcon = None
|
||||||
self.Shown = False
|
self.Shown = False
|
||||||
self.MenuItemChosen = None
|
self.MenuItemChosen = None
|
||||||
|
self.Tooltip = tooltip
|
||||||
|
|
||||||
global _my_windows
|
global _my_windows
|
||||||
|
|
||||||
|
@ -2700,6 +2701,11 @@ class SystemTray:
|
||||||
qmenu.setTitle(self.Menu[0])
|
qmenu.setTitle(self.Menu[0])
|
||||||
AddTrayMenuItem(qmenu, self.Menu[1], self)
|
AddTrayMenuItem(qmenu, self.Menu[1], self)
|
||||||
|
|
||||||
|
if self.Tooltip is not None:
|
||||||
|
self.TrayIcon.setToolTip(str(self.Tooltip))
|
||||||
|
|
||||||
|
self.TrayIcon.messageClicked.connect(self.messageClicked)
|
||||||
|
|
||||||
self.TrayIcon.setContextMenu(qmenu)
|
self.TrayIcon.setContextMenu(qmenu)
|
||||||
|
|
||||||
|
|
||||||
|
@ -2707,6 +2713,11 @@ class SystemTray:
|
||||||
self.MenuItemChosen = item_chosen.replace('&','')
|
self.MenuItemChosen = item_chosen.replace('&','')
|
||||||
self.App.exit() # kick the users out of the mainloop
|
self.App.exit() # kick the users out of the mainloop
|
||||||
|
|
||||||
|
# callback function when message is clicked
|
||||||
|
def messageClicked(self):
|
||||||
|
self.MenuItemChosen = '_MESSAGE_CLICKED_'
|
||||||
|
self.App.exit()
|
||||||
|
|
||||||
|
|
||||||
def Read(self, timeout=None):
|
def Read(self, timeout=None):
|
||||||
'''
|
'''
|
||||||
|
@ -2728,12 +2739,15 @@ class SystemTray:
|
||||||
self.MenuItemChosen = None
|
self.MenuItemChosen = None
|
||||||
return item
|
return item
|
||||||
|
|
||||||
|
|
||||||
def Hide(self):
|
def Hide(self):
|
||||||
self.TrayIcon.hide()
|
self.TrayIcon.hide()
|
||||||
|
|
||||||
|
|
||||||
def UnHide(self):
|
def UnHide(self):
|
||||||
self.TrayIcon.show()
|
self.TrayIcon.show()
|
||||||
|
|
||||||
|
|
||||||
def ShowMessage(self, title, message, filename=None, data=None, data_base64=None, time=10000):
|
def ShowMessage(self, title, message, filename=None, data=None, data_base64=None, time=10000):
|
||||||
'''
|
'''
|
||||||
Shows a balloon above icon in system tray
|
Shows a balloon above icon in system tray
|
||||||
|
|
Loading…
Reference in New Issue