From 75d7cd16adfc9ad69a2303bed405c8d6aef9499c Mon Sep 17 00:00:00 2001 From: iLLiCiTiT Date: Thu, 6 May 2021 09:54:49 +0200 Subject: [PATCH] sort tools values for custom attribute by label --- openpype/modules/ftrack/lib/custom_attributes.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/openpype/modules/ftrack/lib/custom_attributes.py b/openpype/modules/ftrack/lib/custom_attributes.py index abff1e6194..f6b82c90b1 100644 --- a/openpype/modules/ftrack/lib/custom_attributes.py +++ b/openpype/modules/ftrack/lib/custom_attributes.py @@ -33,11 +33,16 @@ def app_definitions_from_app_manager(app_manager): def tool_definitions_from_app_manager(app_manager): - tools_data = [] + _tools_data = [] for tool_name, tool in app_manager.tools.items(): - tools_data.append({ - tool_name: tool.label - }) + _tools_data.append( + (tool_name, tool.label) + ) + + # Sort items by label + tools_data = [] + for key, label in sorted(_tools_data, key=lambda item: item[1]): + tools_data.append({key: label}) # Make sure there is at least one item if not tools_data: