mirror of
https://github.com/dcs-retribution/dcs-retribution.git
synced 2025-11-10 15:41:24 +00:00
Enable / Disable game specific functions if no game is loaded
- Disable Save, Settings, Stats and Notes if game is none fixes #1854
This commit is contained in:
@@ -172,6 +172,19 @@ class QLiberationWindow(QMainWindow):
|
||||
self.openNotesAction.setIcon(CONST.ICONS["Notes"])
|
||||
self.openNotesAction.triggered.connect(self.showNotesDialog)
|
||||
|
||||
self.enable_game_actions(False)
|
||||
|
||||
def enable_game_actions(self, enabled: bool):
|
||||
self.openSettingsAction.setVisible(enabled)
|
||||
self.openStatsAction.setVisible(enabled)
|
||||
self.openNotesAction.setVisible(enabled)
|
||||
|
||||
# Also Disable SaveAction to prevent Keyboard Shortcut
|
||||
self.saveGameAction.setEnabled(enabled)
|
||||
self.saveGameAction.setVisible(enabled)
|
||||
self.saveAsAction.setEnabled(enabled)
|
||||
self.saveAsAction.setVisible(enabled)
|
||||
|
||||
def initToolbar(self):
|
||||
self.tool_bar = self.addToolBar("File")
|
||||
self.tool_bar.addAction(self.newGameAction)
|
||||
@@ -331,6 +344,8 @@ class QLiberationWindow(QMainWindow):
|
||||
QMessageBox.Ok,
|
||||
)
|
||||
GameUpdateSignal.get_instance().updateGame(None)
|
||||
finally:
|
||||
self.enable_game_actions(self.game is not None)
|
||||
|
||||
def showAboutDialog(self):
|
||||
text = (
|
||||
|
||||
Reference in New Issue
Block a user