Core: move `OptionGroup` definition to `Options.py` (#3325)

This commit is contained in:
Doug Hoskisson 2024-05-18 19:40:41 -07:00 committed by GitHub
parent 1b6fb7b090
commit 230a9e620b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 14 additions and 14 deletions

View File

@ -1453,14 +1453,6 @@ class Tutorial(NamedTuple):
authors: List[str] authors: List[str]
class OptionGroup(NamedTuple):
"""Define a grouping of options"""
name: str
"""Name of the group to categorize this option in for display on the WebHost and in generated YAMLS."""
options: List[Type[Options.Option]]
"""Options to be in the defined group. """
class PlandoOptions(IntFlag): class PlandoOptions(IntFlag):
none = 0b0000 none = 0b0000
items = 0b0001 items = 0b0001

View File

@ -1123,6 +1123,14 @@ class DeathLinkMixin:
death_link: DeathLink death_link: DeathLink
class OptionGroup(typing.NamedTuple):
"""Define a grouping of options."""
name: str
"""Name of the group to categorize these options in for display on the WebHost and in generated YAMLS."""
options: typing.List[typing.Type[Option[typing.Any]]]
"""Options to be in the defined group."""
def generate_yaml_templates(target_folder: typing.Union[str, "pathlib.Path"], generate_hidden: bool = True): def generate_yaml_templates(target_folder: typing.Union[str, "pathlib.Path"], generate_hidden: bool = True):
import os import os

View File

@ -92,7 +92,7 @@ group.
```python ```python
from worlds.AutoWorld import WebWorld from worlds.AutoWorld import WebWorld
from BaseClasses import OptionGroup from Options import OptionGroup
class MyWorldWeb(WebWorld): class MyWorldWeb(WebWorld):
option_groups = [ option_groups = [

View File

@ -11,11 +11,11 @@ from dataclasses import make_dataclass
from typing import (Any, Callable, ClassVar, Dict, FrozenSet, List, Mapping, from typing import (Any, Callable, ClassVar, Dict, FrozenSet, List, Mapping,
Optional, Set, TextIO, Tuple, TYPE_CHECKING, Type, Union) Optional, Set, TextIO, Tuple, TYPE_CHECKING, Type, Union)
from Options import ExcludeLocations, ItemLinks, LocalItems, NonLocalItems, PerGameCommonOptions, \ from Options import (
PriorityLocations, \ ExcludeLocations, ItemLinks, LocalItems, NonLocalItems, OptionGroup, PerGameCommonOptions,
StartHints, \ PriorityLocations, StartHints, StartInventory, StartInventoryPool, StartLocationHints
StartInventory, StartInventoryPool, StartLocationHints )
from BaseClasses import CollectionState, OptionGroup from BaseClasses import CollectionState
if TYPE_CHECKING: if TYPE_CHECKING:
from BaseClasses import MultiWorld, Item, Location, Tutorial, Region, Entrance from BaseClasses import MultiWorld, Item, Location, Tutorial, Region, Entrance