2023-09-06 13:44:00 +01:00
|
|
|
from pathlib import Path
|
|
|
|
|
|
|
|
from msgspec import yaml
|
|
|
|
|
2023-10-25 01:03:35 +01:00
|
|
|
from webapp.display.layouts.models import GeneralConfig, MenuItem
|
2023-09-06 13:44:00 +01:00
|
|
|
|
2023-10-25 03:02:26 +01:00
|
|
|
|
2023-09-06 13:44:00 +01:00
|
|
|
def load_menu(path: Path) -> list[MenuItem]:
|
|
|
|
loaded = yaml.decode(path.read_bytes(), type=dict[str, list[MenuItem]])
|
|
|
|
return loaded["root"]
|
|
|
|
|
|
|
|
|
|
|
|
def load_config(path: Path) -> GeneralConfig:
|
|
|
|
loaded = yaml.decode(path.read_bytes(), type=GeneralConfig)
|
|
|
|
return loaded
|