From 5ebb5112efe22b669e9187dd16dce7c5fac02848 Mon Sep 17 00:00:00 2001 From: GoldenAnpu Date: Mon, 29 Jul 2024 16:48:46 +0200 Subject: [PATCH] Add custom relation settings for output file --- src/workflow.py | 17 +++++++++++++++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/src/workflow.py b/src/workflow.py index e22851e..f06227c 100644 --- a/src/workflow.py +++ b/src/workflow.py @@ -46,5 +46,18 @@ def add_input(self, project_id: int): @check_compatibility def add_output(self, file_info: sly.api.file_api.FileInfo): - self.api.app.workflow.add_output_file(file_info) - sly.logger.debug(f"Workflow: Output file - {file_info.id if file_info else None}") + try: + meta = { + "customRelationSettings": { + "icon": { + "icon": "zmdi-archive", + "color": "#33c94c", + "backgroundColor": "#d9f7e4", + }, + "mainLink": {"url": f"{file_info.full_storage_url}", "title": "Download"}, + } + } + self.api.app.workflow.add_output_file(file_info, meta) + sly.logger.debug(f"Workflow: Output file - {file_info.id if file_info else None}") + except Exception as e: + sly.logger.debug(f"Workflow: Can not add output file. Error: {repr(e)}")