mirror of
https://git.srhtnin.garden/sarah/SaraSuite.git
synced 2026-10-14 02:28:11 +02:00
Self-updates and program list from the repo
This commit is contained in:
1 parent
d9da8438c2
commit
e4272bd606
9 files changed
+416
-15
No files matched your search
+15
-7
@@ -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:
|
||||
|
||||
Reference in new issue
Block a user