UI: sort add-ons by name

Previously add-ons were sorted by category & name, remove the category
only sorting by name since the category is no longer displayed and
isn't part of extension meta-data. Now the add-ons are sorted by name
(case insensitive).

Details:

- Store add-ons modules sorted to avoid having to sort on every redraw.
- addon_utils.modules() now returns an iterator.
This commit is contained in:
Campbell Barton
2024-07-02 14:57:35 +10:00
parent 262c68512f
commit c29d8326e0
4 changed files with 34 additions and 30 deletions

View File

@@ -37,9 +37,8 @@ def _init_addon_exclusions():
def addon_modules_sorted():
# Pass in an empty module cache to prevent `addon_utils` local module cache being manipulated.
modules = addon_utils.modules(module_cache={})
modules[:] = [
mod for mod in modules
modules = [
mod for mod in addon_utils.modules(module_cache={})
if not (mod.__file__.startswith(EXCLUDE_DIRECTORIES))
if not (mod.__name__ in EXCLUDE_ADDONS)
]