dcs_liberation/qt_ui/windows/GameUpdateSignal.py
Dan Albert 0534f66b30 Allow NGW to be called from anywhere.
Any real end game dialog needs a "new game" button. If only the main
window can usefully call the NGW we'd have to plumb that object through
and call into it from that dialog, which is gross. Just make it easier
to call the wizard.

https://github.com/dcs-liberation/dcs_liberation/issues/978
2023-06-12 22:39:17 -07:00

42 lines
1.1 KiB
Python

from __future__ import annotations
from typing import Optional
from PySide6.QtCore import QObject, Signal
from game import Game
from game.debriefing import Debriefing
class GameUpdateSignal(QObject):
instance = None
gameupdated = Signal(Game)
budgetupdated = Signal(Game)
debriefingReceived = Signal(Debriefing)
game_loaded = Signal(Game)
game_generated = Signal(Game)
def __init__(self):
super(GameUpdateSignal, self).__init__()
GameUpdateSignal.instance = self
self.game_loaded.connect(self.updateGame)
def updateGame(self, game: Optional[Game]):
# noinspection PyUnresolvedReferences
self.gameupdated.emit(game)
def updateBudget(self, game: Game):
# noinspection PyUnresolvedReferences
self.budgetupdated.emit(game)
def sendDebriefing(self, debriefing: Debriefing) -> None:
# noinspection PyUnresolvedReferences
self.debriefingReceived.emit(debriefing)
@staticmethod
def get_instance() -> GameUpdateSignal:
return GameUpdateSignal.instance