mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
26 lines
580 B
Python
26 lines
580 B
Python
from __future__ import annotations
|
|
|
|
from typing import TYPE_CHECKING
|
|
|
|
if TYPE_CHECKING:
|
|
from game import Game
|
|
from qt_ui.models import GameModel
|
|
|
|
|
|
class GameContext:
|
|
_game_model: GameModel
|
|
|
|
@classmethod
|
|
def set_model(cls, game_model: GameModel) -> None:
|
|
cls._game_model = game_model
|
|
|
|
@classmethod
|
|
def get(cls) -> Game:
|
|
if cls._game_model.game is None:
|
|
raise RuntimeError("GameContext has no Game set")
|
|
return cls._game_model.game
|
|
|
|
@classmethod
|
|
def get_model(cls) -> GameModel:
|
|
return cls._game_model
|