mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Update the map from the main window.
This guarantees that we update the map *after* updating the model that the map uses to draw flight plans. Without this, after creating a new game we'd redraw the previous game's flight plans because the model hadn't been updated by the time the map was. Fixes https://github.com/Khopa/dcs_liberation/issues/212
This commit is contained in:
@@ -56,7 +56,6 @@ class QLiberationMap(QGraphicsView):
|
||||
self.factor = 1
|
||||
self.factorized = 1
|
||||
self.init_scene()
|
||||
self.connectSignals()
|
||||
self.setGame(game_model.game)
|
||||
|
||||
GameUpdateSignal.get_instance().flight_paths_changed.connect(
|
||||
@@ -109,9 +108,6 @@ class QLiberationMap(QGraphicsView):
|
||||
self.setFrameShape(QFrame.NoFrame)
|
||||
self.setDragMode(QGraphicsView.ScrollHandDrag)
|
||||
|
||||
def connectSignals(self):
|
||||
GameUpdateSignal.get_instance().gameupdated.connect(self.setGame)
|
||||
|
||||
def setGame(self, game: Optional[Game]):
|
||||
self.game = game
|
||||
logging.debug("Reloading Map Canvas")
|
||||
@@ -263,7 +259,7 @@ class QLiberationMap(QGraphicsView):
|
||||
text.setDefaultTextColor(Qt.white)
|
||||
text.setPos(pos[0] + CONST.CP_SIZE + 1, pos[1] - CONST.CP_SIZE / 2 + 1)
|
||||
|
||||
def draw_flight_plans(self, scene) -> None:
|
||||
def clear_flight_paths(self, scene: QGraphicsScene) -> None:
|
||||
for item in self.flight_path_items:
|
||||
try:
|
||||
scene.removeItem(item)
|
||||
@@ -271,6 +267,9 @@ class QLiberationMap(QGraphicsView):
|
||||
# Something may have caused those items to already be removed.
|
||||
pass
|
||||
self.flight_path_items.clear()
|
||||
|
||||
def draw_flight_plans(self, scene: QGraphicsScene) -> None:
|
||||
self.clear_flight_paths(scene)
|
||||
if DisplayOptions.flight_paths.hide:
|
||||
return
|
||||
packages = list(self.game_model.ato_model.packages)
|
||||
|
||||
Reference in New Issue
Block a user