Exemple #1
0
 def Do(self):
     sFit = Fit.getInstance()
     fit = sFit.getFit(self.fitID)
     results = []
     for position in sorted(self.positions, reverse=True):
         fighter = fit.fighters[position]
         if fighter.itemID == self.newItemID:
             continue
         info = FighterInfo.fromFighter(fighter)
         info.itemID = self.newItemID
         cmdRemove = CalcRemoveLocalFighterCommand(
             fitID=self.fitID,
             position=position)
         cmdAdd = CalcAddLocalFighterCommand(
             fitID=self.fitID,
             fighterInfo=info,
             ignoreRestrictions=True)
         results.append(self.internalHistory.submitBatch(cmdRemove, cmdAdd))
     success = any(results)
     eos.db.flush()
     sFit.recalc(self.fitID)
     sFit.fill(self.fitID)
     eos.db.commit()
     wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
     return success
Exemple #2
0
 def Do(self):
     sFit = Fit.getInstance()
     fit = sFit.getFit(self.fitID)
     results = []
     for position in sorted(self.positions, reverse=True):
         fighter = fit.fighters[position]
         if fighter.itemID == self.newItemID:
             continue
         info = FighterInfo.fromFighter(fighter)
         info.itemID = self.newItemID
         cmdRemove = CalcRemoveLocalFighterCommand(fitID=self.fitID,
                                                   position=position,
                                                   commit=False)
         cmdAdd = CalcAddLocalFighterCommand(fitID=self.fitID,
                                             fighterInfo=info,
                                             ignoreRestrictions=True,
                                             commit=False)
         results.append(self.internalHistory.submitBatch(cmdRemove, cmdAdd))
     success = any(results)
     eos.db.commit()
     sFit.recalc(self.fitID)
     sFit.fill(self.fitID)
     wx.PostEvent(gui.mainFrame.MainFrame.getInstance(),
                  GE.FitChanged(fitID=self.fitID))
     return success
Exemple #3
0
 def Do(self):
     pyfalog.debug('Doing removal of fighter at position {} from fit {}'.format(self.position, self.fitID))
     fit = Fit.getInstance().getFit(self.fitID)
     fighter = fit.fighters[self.position]
     self.savedFighterInfo = FighterInfo.fromFighter(fighter)
     fit.fighters.remove(fighter)
     return True
Exemple #4
0
 def Do(self):
     pyfalog.debug(
         'Doing removal of projected fighter at position {} from fit {}'.
         format(self.position, self.fitID))
     fit = Fit.getInstance().getFit(self.fitID)
     fighter = fit.projectedFighters[self.position]
     self.savedFighterInfo = FighterInfo.fromFighter(fighter)
     fit.projectedFighters.remove(fighter)
     return True
Exemple #5
0
 def Do(self):
     sFit = Fit.getInstance()
     fit = sFit.getFit(self.fitID)
     fighter = fit.fighters[self.position]
     if fighter.itemID == self.newItemID:
         return False
     info = FighterInfo.fromFighter(fighter)
     info.itemID = self.newItemID
     cmdRemove = CalcRemoveLocalFighterCommand(fitID=self.fitID, position=self.position)
     cmdAdd = CalcAddLocalFighterCommand(fitID=self.fitID, fighterInfo=info)
     success = self.internalHistory.submitBatch(cmdRemove, cmdAdd)
     sFit.recalc(fit)
     wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
     return success