From 70d982b0eda47ea6f795bf294e57ca7b23903f20 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ignacio=20Mu=C3=B1oz=20Fernandez?= Date: Fri, 20 Nov 2020 15:10:08 +0100 Subject: [PATCH] fix: Pass Turn and Take Off Buttons when no game is loaded --- qt_ui/widgets/QTopPanel.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/qt_ui/widgets/QTopPanel.py b/qt_ui/widgets/QTopPanel.py index 79f4e77e..57565208 100644 --- a/qt_ui/widgets/QTopPanel.py +++ b/qt_ui/widgets/QTopPanel.py @@ -48,12 +48,14 @@ class QTopPanel(QFrame): self.passTurnButton.setIcon(CONST.ICONS["PassTurn"]) self.passTurnButton.setProperty("style", "btn-primary") self.passTurnButton.clicked.connect(self.passTurn) + if not self.game or self.game.turn == 0: + self.passTurnButton.setEnabled(False) self.proceedButton = QPushButton("Take off") self.proceedButton.setIcon(CONST.ICONS["Proceed"]) self.proceedButton.setProperty("style", "start-button") self.proceedButton.clicked.connect(self.launch_mission) - if self.game and self.game.turn == 0: + if not self.game or self.game.turn == 0: self.proceedButton.setEnabled(False) self.factionsInfos = QFactionsInfos(self.game) @@ -101,6 +103,8 @@ class QTopPanel(QFrame): self.budgetBox.setGame(game) self.factionsInfos.setGame(game) + self.passTurnButton.setEnabled(True) + if game and game.turn == 0: self.proceedButton.setEnabled(False) else: