22 lines
526 B
Python
22 lines
526 B
Python
from __future__ import annotations
|
|
|
|
from dataclasses import dataclass
|
|
from typing import Any
|
|
|
|
|
|
@dataclass(frozen=True)
|
|
class SettingsSection:
|
|
key: str
|
|
title: str
|
|
builder: Any
|
|
|
|
|
|
class SettingsRegistry:
|
|
def __init__(self) -> None:
|
|
self._sections: list[SettingsSection] = []
|
|
|
|
def register(self, key: str, title: str, builder: Any) -> None:
|
|
self._sections.append(SettingsSection(key, title, builder))
|
|
|
|
def sections(self) -> tuple[SettingsSection, ...]:
|
|
return tuple(self._sections)
|