From bd5ee32227a8b7bb5f36851e997ca58f8b0231e2 Mon Sep 17 00:00:00 2001 From: burnsypet Date: Tue, 2 Apr 2019 19:29:03 +0100 Subject: [PATCH] change logic --- gui/mainMenuBar.py | 20 +++++++------------- 1 file changed, 7 insertions(+), 13 deletions(-) diff --git a/gui/mainMenuBar.py b/gui/mainMenuBar.py index b062cd060..de860385e 100644 --- a/gui/mainMenuBar.py +++ b/gui/mainMenuBar.py @@ -179,20 +179,14 @@ class MainMenuBar(wx.MenuBar): self.Enable(wx.ID_COPY, enable) self.Enable(self.exportSkillsNeededId, enable) - command_history = self.mainFrame.command.GetCommands() - current_command = self.mainFrame.command.GetCurrentCommand() + command = self.mainFrame.command + self.Enable(wx.ID_UNDO, False) + self.Enable(wx.ID_REDO, False) - self.Enable(wx.ID_UNDO, True) - self.Enable(wx.ID_REDO, True) - - if len(command_history) == 0: - self.Enable(wx.ID_UNDO, False) - self.Enable(wx.ID_REDO, False) - else: - if current_command not in command_history: - self.Enable(wx.ID_UNDO, False) - if current_command == command_history[len(command_history) - 1]: - self.Enable(wx.ID_REDO, False) + if command.CanUndo(): + self.Enable(wx.ID_UNDO, True) + if command.CanRedo(): + self.Enable(wx.ID_REDO, True) sChar = Character.getInstance() charID = self.mainFrame.charSelection.getActiveCharacter()