コード例 #1
0
ファイル: changeMetas.py プロジェクト: zwparchman/Pyfa
 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
コード例 #2
0
ファイル: remove.py プロジェクト: XaviarOnassis/Pyfa
 def Do(self):
     results = []
     for position in sorted(self.positions, reverse=True):
         cmd = CalcRemoveLocalFighterCommand(fitID=self.fitID,
                                             position=position,
                                             commit=False)
         results.append(self.internalHistory.submit(cmd))
     success = any(results)
     eos.db.commit()
     Fit.getInstance().recalc(self.fitID)
     wx.PostEvent(gui.mainFrame.MainFrame.getInstance(),
                  GE.FitChanged(fitID=self.fitID))
     return success
コード例 #3
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
コード例 #4
0
ファイル: changeAmount.py プロジェクト: XaviarOnassis/Pyfa
 def Do(self):
     if self.amount > 0:
         cmd = CalcChangeFighterAmountCommand(fitID=self.fitID,
                                              projected=False,
                                              position=self.position,
                                              amount=self.amount)
     else:
         cmd = CalcRemoveLocalFighterCommand(fitID=self.fitID,
                                             position=self.position)
     success = self.internalHistory.submit(cmd)
     Fit.getInstance().recalc(self.fitID)
     wx.PostEvent(gui.mainFrame.MainFrame.getInstance(),
                  GE.FitChanged(fitID=self.fitID))
     return success
コード例 #5
0
 def Do(self):
     sMkt = Market.getInstance()
     results = []
     for position in sorted(self.positions, reverse=True):
         cmd = CalcRemoveLocalFighterCommand(fitID=self.fitID,
                                             position=position)
         results.append(self.internalHistory.submit(cmd))
         sMkt.storeRecentlyUsed(cmd.savedFighterInfo.itemID)
     success = any(results)
     eos.db.flush()
     sFit = Fit.getInstance()
     sFit.recalc(self.fitID)
     sFit.fill(self.fitID)
     eos.db.commit()
     wx.PostEvent(gui.mainFrame.MainFrame.getInstance(),
                  GE.FitChanged(fitIDs=(self.fitID, )))
     return success
コード例 #6
0
ファイル: remove.py プロジェクト: Wilfried199754/Pyfa
 def Do(self):
     cmd = CalcRemoveLocalFighterCommand(fitID=self.fitID, position=self.position)
     success = self.internalHistory.submit(cmd)
     Fit.getInstance().recalc(self.fitID)
     wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
     return success