diff --git a/pype/modules/base.py b/pype/modules/base.py index b295746b9b..03a5965841 100644 --- a/pype/modules/base.py +++ b/pype/modules/base.py @@ -108,6 +108,7 @@ class ITrayModule: would do nothing. """ tray_initialized = False + _tray_manager = None @abstractmethod def tray_init(self): @@ -138,6 +139,20 @@ class ITrayModule: """ 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): """Implementation of Tray action. @@ -660,6 +675,7 @@ class TrayModulesManager(ModulesManager): prev_start_time = time_start for module in self.get_enabled_tray_modules(): try: + module._tray_manager = self.tray_manager module.tray_init() module.tray_initialized = True except Exception: