Self-updates and program list from the repo

This commit is contained in:
sarah committed 2026-10-09 10:38:21 +02:00
1 parent d9da8438c2
commit e4272bd606
9 files changed
+416 -15

No files matched your search

+15 -7
View File
@@ -11,7 +11,7 @@ from typing import Optional
import tomlkit
from Core import (
CacheHome, ConfigHome, CurrentDesktop, DataHome, Home, LoadConfig, ManifestsDir, ProgramsDir,
CacheHome, ConfigHome, CurrentDesktop, DataHome, Home, LoadConfig, ProgramsDir,
SharedConfigDir,
)
@@ -230,14 +230,22 @@ def LoadProgram(Folder: Path) -> Program:
)
def _LoadFrom(Folder: Path) -> list[Program]:
return [LoadProgram(Child) for Child in sorted(Folder.iterdir()) if (Child / "Manifest.toml").exists()]
def LoadPrograms() -> list[Program]:
"""Alphabetical, with each program's children (Parent = its Name) right
after it. A child whose parent isn't there keeps its own place."""
Loaded = [
LoadProgram(Folder)
for Folder in sorted(ManifestsDir.iterdir())
if (Folder / "Manifest.toml").exists()
]
after it. A child whose parent isn't there keeps its own place.
Read from the catalog fetched from the SaraSuite repo (Catalog.py) when
there is one, falling back to the bundled copy if that can't be loaded
(e.g. it uses a manifest feature this SaraSuite doesn't know yet)."""
from Catalog import BundledManifestsDir, ManifestsDir
try:
Loaded = _LoadFrom(ManifestsDir())
except Exception:
Loaded = _LoadFrom(BundledManifestsDir)
Names = {Current.Name for Current in Loaded}
Ordered = []
for Current in Loaded: