Merge remote-tracking branch 'origin/blender-v4.2-release'

This commit is contained in:
Dalai Felinto
2024-06-25 16:05:44 +02:00

View File

@@ -255,8 +255,13 @@ def addon_draw_item_expanded(
if item_doc_url:
col_a.label(text="Website")
col_b.split(factor=0.5).operator(
"wm.url_open", text=domain_extract_from_url(item_doc_url), icon='HELP',
col_b.split(
factor=0.5).operator(
"wm.url_open",
text=domain_extract_from_url(item_doc_url),
icon='HELP' if addon_type in {
ADDON_TYPE_LEGACY_CORE,
ADDON_TYPE_LEGACY_USER} else 'URL',
).url = item_doc_url
# Only add "Report a Bug" button if tracker_url is set
# or the add-on is bundled (use official tracker then).
@@ -905,9 +910,8 @@ def extensions_panel_draw_impl(
# Needed so the warnings aren't mixed in with other content.
layout_topmost = layout.column()
SECTION_ENABLED, SECTION_INSTALLED, SECTION_AVAILABLE = 0, 1, 2
SECTION_INSTALLED, SECTION_AVAILABLE = 0, 1
layout_sections = (
ExtensionPanelPropData(layout.column(), iface_("Enabled"), "extension_show_panel_enabled"),
ExtensionPanelPropData(layout.column(), iface_("Installed"), "extension_show_panel_installed"),
ExtensionPanelPropData(layout.column(), iface_("Available"), "extension_show_panel_available"),
)
@@ -1055,9 +1059,41 @@ def extensions_panel_draw_impl(
)
continue
def sort_extensions(item):
"""
Sort the list for installed extensions
The expected order is:
* Update
* Enable
* Alphabetical
"""
pkg_id, (item_local, item_remote) = item
item = item_local or item_remote
is_installed = item_local is not None
if not is_installed:
return (False, False, "")
item_version = item.version
if item_local is None or item_remote is None:
item_remote_version = None
is_outdated = False
else:
item_remote_version = item_remote.version
is_outdated = item_remote_version != item_version
addon_module_name = repo_module_prefix + pkg_id
is_enabled = addon_module_name in addons_enabled
return (not is_outdated, not is_enabled, item.name)
repo_module_prefix = pkg_repo_module_prefix(repos_all[repo_index])
for pkg_id, (item_local, item_remote) in pkg_manifest_zip_all_items(pkg_manifest_local, pkg_manifest_remote):
sorted_items = list(pkg_manifest_zip_all_items(pkg_manifest_local, pkg_manifest_remote))
sorted_items.sort(key=sort_extensions)
for pkg_id, (item_local, item_remote) in sorted_items:
item = item_local or item_remote
if filter_by_type and (filter_by_type != item.type):
continue
@@ -1110,7 +1146,7 @@ def extensions_panel_draw_impl(
continue
if is_enabled:
section_type = SECTION_ENABLED
section_type = SECTION_INSTALLED
elif is_installed:
section_type = SECTION_INSTALLED
else:
@@ -1226,7 +1262,7 @@ def extensions_panel_draw_impl(
if value := ((item_remote or item_local).website):
col_a.label(text="Website")
col_b.split(factor=0.5).operator(
"wm.url_open", text=domain_extract_from_url(value), icon='HELP',
"wm.url_open", text=domain_extract_from_url(value), icon='URL',
).url = value
del value