feat(series-studio): support type_doc (corrige, resume), 4 light themes, chemistry reactions and serie 05 (perso-2026-11-013)
This commit is contained in:
1 parent
b0836f73a0
commit
8f43363848
15 files changed
+2067
-128
No files matched your search
@@ -11,19 +11,33 @@ import os
|
||||
THEMES_DIR = os.path.join(os.path.dirname(__file__), "themes")
|
||||
|
||||
def list_themes():
|
||||
"""Renvoie la liste des thèmes disponibles avec métadonnées."""
|
||||
"""Renvoie la liste des thèmes disponibles avec métadonnées et fiches."""
|
||||
themes = []
|
||||
if not os.path.exists(THEMES_DIR):
|
||||
return themes
|
||||
fiches = {}
|
||||
fiches_path = os.path.join(THEMES_DIR, "fiches.json")
|
||||
if os.path.exists(fiches_path):
|
||||
try:
|
||||
with open(fiches_path, "r", encoding="utf-8") as f:
|
||||
fiches = json.load(f)
|
||||
except Exception:
|
||||
pass
|
||||
for fname in sorted(os.listdir(THEMES_DIR)):
|
||||
if fname.endswith(".json"):
|
||||
if fname.endswith(".json") and fname != "fiches.json":
|
||||
path = os.path.join(THEMES_DIR, fname)
|
||||
try:
|
||||
with open(path, "r", encoding="utf-8") as f:
|
||||
data = json.load(f)
|
||||
th_name = data.get("name", fname[:-5])
|
||||
th_label = data.get("label", th_name)
|
||||
fiche = fiches.get(th_name, {})
|
||||
themes.append({
|
||||
"name": data.get("name", fname[:-5]),
|
||||
"label": data.get("label", data.get("name", fname[:-5]))
|
||||
"name": th_name,
|
||||
"label": th_label,
|
||||
"description": data.get("description") or fiche.get("description", ""),
|
||||
"usage": data.get("usage") or fiche.get("usage", ""),
|
||||
"impression_nb": data.get("impression_nb") or fiche.get("impression_nb", "")
|
||||
})
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
Reference in new issue
Block a user