diff options
Diffstat (limited to 'scripts/theme-studio/app_inventory.py')
| -rw-r--r-- | scripts/theme-studio/app_inventory.py | 33 |
1 files changed, 27 insertions, 6 deletions
diff --git a/scripts/theme-studio/app_inventory.py b/scripts/theme-studio/app_inventory.py index 0f1def0d..b5b33a56 100644 --- a/scripts/theme-studio/app_inventory.py +++ b/scripts/theme-studio/app_inventory.py @@ -7,7 +7,7 @@ import os from collections.abc import Sequence from typing import Any -from face_data import BESPOKE_APP_SPECS +from face_data import BESPOKE_APP_SPECS, PINNED_PACKAGE_FACES # Keys of the bespoke apps (single-sourced in face_data), excluded from the @@ -41,11 +41,19 @@ def face_rows(names: Sequence[str], prefix: str, seed: dict[str, dict[str, Any]] def add_inventory_apps(apps: dict[str, Any], inventory_path: str) -> dict[str, Any]: - """Add generic editable apps for installed packages not covered by bespoke previews.""" - if not os.path.exists(inventory_path): - return apps - with open(inventory_path) as src: - inventory = json.load(src) + """Add generic editable apps for installed packages not covered by bespoke previews. + + PINNED_PACKAGE_FACES (the ecosystem coverage policy) is the curated record + of packages retired from this config: a pinned package is always marked + not loaded, and it survives inventory regeneration -- an uninstall must + never drop an app from the studio. Its face list stays fresh from the live + inventory when present (a still-installed dependency can grow faces); the + pin is the fallback when the inventory no longer carries it. + """ + inventory: dict[str, Any] = {} + if os.path.exists(inventory_path): + with open(inventory_path) as src: + inventory = json.load(src) for pkg in sorted(inventory): if pkg in BESPOKE_APPS or pkg in apps: continue @@ -54,6 +62,19 @@ def add_inventory_apps(apps: dict[str, Any], inventory_path: str) -> dict[str, A "preview": PREVIEW_KEYS.get(pkg, "generic"), "faces": [[face, face_label(face, pkg + "-"), {}] for face in inventory[pkg]], } + for pkg in sorted(PINNED_PACKAGE_FACES): + if pkg in BESPOKE_APPS: + continue + faces = inventory.get(pkg, PINNED_PACKAGE_FACES[pkg]) + apps[pkg] = { + "label": PACKAGE_LABEL_OVERRIDES.get(pkg, pkg) + " ยท not loaded", + "preview": PREVIEW_KEYS.get(pkg, "generic"), + "unloaded": True, + "hover": ("Retired from this config; its faces are pinned so ecosystem " + "themes still cover it. The live preview is the only place its " + "theming can be seen."), + "faces": [[face, face_label(face, pkg + "-"), {}] for face in faces], + } return apps |
