Skip to content

Commit

Permalink
Add custom relation settings for output file
Browse files Browse the repository at this point in the history
  • Loading branch information
GoldenAnpu committed Jul 29, 2024
1 parent 366faf9 commit 5ebb511
Showing 1 changed file with 15 additions and 2 deletions.
17 changes: 15 additions & 2 deletions src/workflow.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)}")

0 comments on commit 5ebb511

Please sign in to comment.