mirror of
https://github.com/dcs-liberation/dcs_liberation.git
synced 2025-11-10 14:22:26 +00:00
Enable / Disable game specific functions if no game is loaded
- Disable Save, Settings, Stats and Notes if game is none cherry-pick from f9ed61d1
This commit is contained in:
parent
64d273b433
commit
5fd6ccb81d
@ -12,6 +12,7 @@ Saves from 5.0.0 are not compatible with 5.1.0
|
||||
* **[Mission Generator]** Fixed incorrect radio specification for the AN/ARC-222.
|
||||
* **[Mission Generator]** Fixed mission scripting error when using a dedicated server.
|
||||
* **[Mission Generator]** Fixed an issue where empty convoys lead to an index error when a point capture made a pending transfer of units not completable anymore.
|
||||
* **[UI]** Enable / Disable the settings, save and stats actions if no game is loaded to prevent an error as these functions can only be used on a valid game.
|
||||
|
||||
# 5.0.0
|
||||
|
||||
|
||||
@ -170,6 +170,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)
|
||||
@ -328,6 +341,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 = (
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user