mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
34 lines
724 B
Python
34 lines
724 B
Python
from dataclasses import dataclass, field
|
|
from datetime import timedelta
|
|
from typing import Any, Optional
|
|
|
|
from .optiondescription import OptionDescription, SETTING_DESCRIPTION_KEY
|
|
|
|
|
|
@dataclass(frozen=True)
|
|
class MinutesOption(OptionDescription):
|
|
min: int
|
|
max: int
|
|
|
|
|
|
def minutes_option(
|
|
text: str,
|
|
page: str,
|
|
section: str,
|
|
default: timedelta,
|
|
min: int,
|
|
max: int,
|
|
detail: Optional[str] = None,
|
|
tooltip: Optional[str] = None,
|
|
**kwargs: Any,
|
|
) -> timedelta:
|
|
return field(
|
|
metadata={
|
|
SETTING_DESCRIPTION_KEY: MinutesOption(
|
|
page, section, text, detail, tooltip, min, max
|
|
)
|
|
},
|
|
default=default,
|
|
**kwargs,
|
|
)
|