From 943245b698557f1bd8fa36aab30d6c2fc8547e3f Mon Sep 17 00:00:00 2001 From: Jakub Trllo <43494761+iLLiCiTiT@users.noreply.github.com> Date: Tue, 30 Jul 2024 15:05:20 +0200 Subject: [PATCH] start tray if is not running --- client/ayon_core/addon/utils.py | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/client/ayon_core/addon/utils.py b/client/ayon_core/addon/utils.py index d96809de49..b6f665b677 100644 --- a/client/ayon_core/addon/utils.py +++ b/client/ayon_core/addon/utils.py @@ -62,6 +62,12 @@ def _handle_error( os.remove(tmp_path) +def _start_tray(process_context): + from ayon_core.tools.tray import make_sure_tray_is_running + + make_sure_tray_is_running() + + def ensure_addons_are_process_context_ready( process_context: ProcessContext, addons_manager: Optional[AddonsManager] = None, @@ -131,18 +137,22 @@ def ensure_addons_are_process_context_ready( output_str = output.getvalue() # Print stdout/stderr to console as it was redirected print(output_str) - if failed: - detail = None - if use_detail: - # In case stdout was not captured, use the tracebacks as detail - if not output_str: - output_str = "\n".join(tracebacks) - detail = output_str + if not failed: + if not process_context.headless: + _start_tray(process_context) + return None - _handle_error(process_context, message, detail) - if not exit_on_failure: - return exception - sys.exit(1) + detail = None + if use_detail: + # In case stdout was not captured, use the tracebacks as detail + if not output_str: + output_str = "\n".join(tracebacks) + detail = output_str + + _handle_error(process_context, message, detail) + if not exit_on_failure: + return exception + sys.exit(1) def ensure_addons_are_process_ready(