dcs-retribution/game/settings/booleanoption.py
Dan Albert a618f00662 Port the campaign management page to auto.
Also fixes the oversight in the previous commit where float options were
not saved when changed.
2021-10-21 19:16:47 -07:00

28 lines
596 B
Python

from dataclasses import dataclass, field
from typing import Any, Optional
from .optiondescription import OptionDescription, SETTING_DESCRIPTION_KEY
@dataclass(frozen=True)
class BooleanOption(OptionDescription):
invert: bool
def boolean_option(
text: str,
page: str,
section: str,
default: bool,
invert: bool = False,
detail: Optional[str] = None,
**kwargs: Any,
) -> bool:
return field(
metadata={
SETTING_DESCRIPTION_KEY: BooleanOption(page, section, text, detail, invert)
},
default=default,
**kwargs,
)