mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Using a singleton QObject to propagate game model update across whole app
This commit is contained in:
19
qt_ui/windows/GameUpdateSignal.py
Normal file
19
qt_ui/windows/GameUpdateSignal.py
Normal file
@@ -0,0 +1,19 @@
|
||||
from PySide2.QtCore import QObject, Signal
|
||||
from game import Game
|
||||
|
||||
|
||||
class GameUpdateSignal(QObject):
|
||||
|
||||
instance = None
|
||||
gameupdated = Signal(Game)
|
||||
|
||||
def __init__(self):
|
||||
super(GameUpdateSignal, self).__init__()
|
||||
GameUpdateSignal.instance = self
|
||||
|
||||
def updateGame(self, game: Game):
|
||||
self.gameupdated.emit(game)
|
||||
|
||||
@staticmethod
|
||||
def get_instance():
|
||||
return GameUpdateSignal.instance
|
||||
Reference in New Issue
Block a user