mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Redraw flight plans when they change.
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
from __future__ import annotations
|
||||
|
||||
from PySide2.QtCore import QObject, Signal
|
||||
|
||||
from game import Game
|
||||
@@ -19,21 +21,31 @@ class GameUpdateSignal(QObject):
|
||||
budgetupdated = Signal(Game)
|
||||
debriefingReceived = Signal(DebriefingSignal)
|
||||
|
||||
flight_paths_changed = Signal()
|
||||
|
||||
def __init__(self):
|
||||
super(GameUpdateSignal, self).__init__()
|
||||
GameUpdateSignal.instance = self
|
||||
|
||||
def redraw_flight_paths(self) -> None:
|
||||
# noinspection PyUnresolvedReferences
|
||||
self.flight_paths_changed.emit()
|
||||
|
||||
def updateGame(self, game: Game):
|
||||
# noinspection PyUnresolvedReferences
|
||||
self.gameupdated.emit(game)
|
||||
|
||||
def updateBudget(self, game: Game):
|
||||
# noinspection PyUnresolvedReferences
|
||||
self.budgetupdated.emit(game)
|
||||
|
||||
def sendDebriefing(self, game: Game, gameEvent: Event, debriefing: Debriefing):
|
||||
sig = DebriefingSignal(game, gameEvent, debriefing)
|
||||
# noinspection PyUnresolvedReferences
|
||||
self.gameupdated.emit(game)
|
||||
# noinspection PyUnresolvedReferences
|
||||
self.debriefingReceived.emit(sig)
|
||||
|
||||
@staticmethod
|
||||
def get_instance():
|
||||
def get_instance() -> GameUpdateSignal:
|
||||
return GameUpdateSignal.instance
|
||||
|
||||
@@ -7,6 +7,7 @@ from PySide2.QtWidgets import (
|
||||
from game import Game
|
||||
from gen.flights.flight import Flight
|
||||
from qt_ui.uiconstants import EVENT_ICONS
|
||||
from qt_ui.windows.GameUpdateSignal import GameUpdateSignal
|
||||
from qt_ui.windows.mission.flight.QFlightPlanner import QFlightPlanner
|
||||
|
||||
|
||||
@@ -27,3 +28,8 @@ class QEditFlightDialog(QDialog):
|
||||
layout.addWidget(self.flight_planner)
|
||||
|
||||
self.setLayout(layout)
|
||||
self.finished.connect(self.on_close)
|
||||
|
||||
@staticmethod
|
||||
def on_close(_result) -> None:
|
||||
GameUpdateSignal.get_instance().redraw_flight_paths()
|
||||
|
||||
@@ -17,6 +17,7 @@ from gen.flights.flight import Flight
|
||||
from qt_ui.models import AtoModel, PackageModel
|
||||
from qt_ui.uiconstants import EVENT_ICONS
|
||||
from qt_ui.widgets.ato import QFlightList
|
||||
from qt_ui.windows.GameUpdateSignal import GameUpdateSignal
|
||||
from qt_ui.windows.mission.flight.QFlightCreator import QFlightCreator
|
||||
from theater.missiontarget import MissionTarget
|
||||
|
||||
@@ -86,6 +87,12 @@ class QPackageDialog(QDialog):
|
||||
|
||||
self.setLayout(self.layout)
|
||||
|
||||
self.finished.connect(self.on_close)
|
||||
|
||||
@staticmethod
|
||||
def on_close(_result) -> None:
|
||||
GameUpdateSignal.get_instance().redraw_flight_paths()
|
||||
|
||||
def on_selection_changed(self, selected: QItemSelection,
|
||||
_deselected: QItemSelection) -> None:
|
||||
"""Updates the state of the delete button."""
|
||||
|
||||
Reference in New Issue
Block a user