mirror of
https://github.com/ynput/ayon-core.git
synced 2026-01-01 08:24:53 +01:00
tray modules can show tray message
This commit is contained in:
parent
6695a452f6
commit
e49749d307
1 changed files with 16 additions and 0 deletions
|
|
@ -108,6 +108,7 @@ class ITrayModule:
|
||||||
would do nothing.
|
would do nothing.
|
||||||
"""
|
"""
|
||||||
tray_initialized = False
|
tray_initialized = False
|
||||||
|
_tray_manager = None
|
||||||
|
|
||||||
@abstractmethod
|
@abstractmethod
|
||||||
def tray_init(self):
|
def tray_init(self):
|
||||||
|
|
@ -138,6 +139,20 @@ class ITrayModule:
|
||||||
"""
|
"""
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
def show_tray_message(self, title, message, icon=None, msecs=None):
|
||||||
|
"""Show tray message.
|
||||||
|
|
||||||
|
Args:
|
||||||
|
title (str): Title of message.
|
||||||
|
message (str): Content of message.
|
||||||
|
icon (QSystemTrayIcon.MessageIcon): Message's icon. Default is
|
||||||
|
Information icon, may differ by Qt version.
|
||||||
|
msecs (int): Duration of message visibility in miliseconds.
|
||||||
|
Default is 10000 msecs, may differ by Qt version.
|
||||||
|
"""
|
||||||
|
if self._tray_manager:
|
||||||
|
self._tray_manager.show_tray_message(title, message, icon, msecs)
|
||||||
|
|
||||||
|
|
||||||
class ITrayAction(ITrayModule):
|
class ITrayAction(ITrayModule):
|
||||||
"""Implementation of Tray action.
|
"""Implementation of Tray action.
|
||||||
|
|
@ -660,6 +675,7 @@ class TrayModulesManager(ModulesManager):
|
||||||
prev_start_time = time_start
|
prev_start_time = time_start
|
||||||
for module in self.get_enabled_tray_modules():
|
for module in self.get_enabled_tray_modules():
|
||||||
try:
|
try:
|
||||||
|
module._tray_manager = self.tray_manager
|
||||||
module.tray_init()
|
module.tray_init()
|
||||||
module.tray_initialized = True
|
module.tray_initialized = True
|
||||||
except Exception:
|
except Exception:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue