Skip to content

Commit

Permalink
Merge pull request #1476 from pypeclub/feature/sorted_custom_attribut…
Browse files Browse the repository at this point in the history
…e_apps_tools
  • Loading branch information
mkolar committed May 6, 2021
2 parents cde61ef + 9cacf4e commit 0b25b3d
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
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

0 comments on commit 0b25b3d

Please sign in to comment.