Make command-related commands and their invokations more reliable

This commit is contained in:
DarkPhoenix
2019-04-20 00:35:14 +03:00
parent fda83bcb49
commit 93cd3b97fa
5 changed files with 14 additions and 7 deletions

View File

@@ -30,7 +30,9 @@ class CalcAddCommandCommand(wx.Command):
if commandFit in fit.commandFits:
pyfalog.debug('Command fit had been applied already')
return False
if commandFit.ID in fit.commandFitDict:
pyfalog.debug('Commanding fit is in command dict already')
return False
fit.commandFitDict[commandFit.ID] = commandFit
# This bit is required, see issue #83
eos.db.saveddata_session.flush()

View File

@@ -30,8 +30,10 @@ class CalcRemoveCommandCommand(wx.Command):
if commandInfo is None:
pyfalog.warning('Fit command info is not available')
return False
self.savedState = commandInfo.active
if commandFit.ID not in fit.commandFitDict:
pyfalog.warning('Unable to find commanding fit in command dict')
return False
del fit.commandFitDict[commandFit.ID]
eos.db.commit()
return True