Don't do anything if we dun have to, LETS BE LAZY!

This commit is contained in:
cncfanatics
2010-09-11 20:26:30 +02:00
parent 174ee9c5c0
commit a336068d98
2 changed files with 6 additions and 2 deletions

View File

@@ -90,6 +90,9 @@ class Fit(object):
def removeModule(self, fitID, position):
fit = eos.db.getFit(fitID)
if fit.modules[position].isEmpty:
return False
fit.modules.toDummy(position)
eos.db.commit()
fit.clear()

View File

@@ -64,9 +64,10 @@ class FittingView(d.Display):
row, _ = self.HitTest(event.Position)
if row != -1:
cFit = controller.Fit.getInstance()
cFit.removeModule(self.activeFitID, self.mods[self.GetItemData(row)].position)
trigger = cFit.removeModule(self.activeFitID, self.mods[self.GetItemData(row)].position)
wx.PostEvent(self.mainFrame, FitChanged(fitID=self.activeFitID))
if trigger:
wx.PostEvent(self.mainFrame, FitChanged(fitID=self.activeFitID))
def fitChanged(self, event):
cFit = controller.Fit.getInstance()