Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sorted Applications and Tools in Custom attribute #1476

Merged
merged 3 commits into from
May 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 18 additions & 8 deletions openpype/modules/ftrack/lib/custom_attributes.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 +15,34 @@ def default_custom_attributes_definition():


def app_definitions_from_app_manager(app_manager):
app_definitions = []
_app_definitions = []
for app_name, app in app_manager.applications.items():
if app.enabled and app.is_host:
app_definitions.append({
app_name: app.full_label
})
_app_definitions.append(
(app_name, app.full_label)
)

# Sort items by label
app_definitions = []
for key, label in sorted(_app_definitions, key=lambda item: item[1]):
app_definitions.append({key: label})

if not app_definitions:
app_definitions.append({"empty": "< Empty >"})
return app_definitions


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:
Expand Down
2 changes: 1 addition & 1 deletion openpype/settings/defaults/system_settings/tools.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
},
"__dynamic_keys_labels__": {
"3-2": "3.2",
"3-1": "3.2"
"3-1": "3.1"
}
}
},
Expand Down