Move waypoints and commit boundaries to FastAPI.

This commit is contained in:
Dan Albert
2022-02-19 18:25:45 -08:00
parent b533633494
commit c16ca40894
25 changed files with 360 additions and 328 deletions

View File

@@ -1,15 +1,20 @@
from game import Game
from qt_ui.models import GameModel
class GameContext:
_game: Game | None
_game_model: GameModel
@classmethod
def set(cls, game: Game | None) -> None:
cls._game = game
def set_model(cls, game_model: GameModel) -> None:
cls._game_model = game_model
@classmethod
def get(cls) -> Game:
if cls._game is None:
if cls._game_model.game is None:
raise RuntimeError("GameContext has no Game set")
return cls._game
return cls._game_model.game
@classmethod
def get_model(cls) -> GameModel:
return cls._game_model