Esempio n. 1
0
 def Do(self):
     results = []
     for pModPosition in sorted(self.pModPositions, reverse=True):
         cmd = CalcRemoveProjectedModuleCommand(fitID=self.fitID,
                                                position=pModPosition)
         results.append(self.internalHistory.submit(cmd))
     for pDroneItemID in self.pDroneItemIDs:
         cmd = CalcRemoveProjectedDroneCommand(fitID=self.fitID,
                                               itemID=pDroneItemID,
                                               amount=self.amount)
         results.append(self.internalHistory.submit(cmd))
     for pFighterPosition in sorted(self.pFighterPositions, reverse=True):
         cmd = CalcRemoveProjectedFighterCommand(fitID=self.fitID,
                                                 position=pFighterPosition)
         results.append(self.internalHistory.submit(cmd))
     for pFitID in self.pFitIDs:
         cmd = CalcRemoveProjectedFitCommand(fitID=self.fitID,
                                             projectedFitID=pFitID,
                                             amount=self.amount)
         results.append(self.internalHistory.submit(cmd))
     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(fitID=self.fitID))
     return success
Esempio n. 2
0
 def Do(self):
     sFit = Fit.getInstance()
     fit = sFit.getFit(self.fitID)
     results = []
     for itemID in self.itemIDs:
         drone = next(
             (pd for pd in fit.projectedDrones if pd.itemID == itemID),
             None)
         if drone is None:
             continue
         if drone.itemID == self.newItemID:
             continue
         info = DroneInfo.fromDrone(drone)
         info.itemID = self.newItemID
         cmdRemove = CalcRemoveProjectedDroneCommand(fitID=self.fitID,
                                                     itemID=itemID,
                                                     amount=math.inf,
                                                     commit=False)
         cmdAdd = CalcAddProjectedDroneCommand(fitID=self.fitID,
                                               droneInfo=info,
                                               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
Esempio n. 3
0
 def Do(self):
     cmd = CalcRemoveProjectedDroneCommand(fitID=self.fitID,
                                           itemID=self.itemID,
                                           amount=self.amount)
     success = self.internalHistory.submit(cmd)
     Fit.getInstance().recalc(self.fitID)
     wx.PostEvent(gui.mainFrame.MainFrame.getInstance(),
                  GE.FitChanged(fitID=self.fitID))
     return success
Esempio n. 4
0
 def Do(self):
     if self.amount > 0:
         cmd = CalcChangeProjectedDroneAmountCommand(fitID=self.fitID, itemID=self.itemID, amount=self.amount)
     else:
         cmd = CalcRemoveProjectedDroneCommand(fitID=self.fitID, itemID=self.itemID, amount=math.inf)
     success = self.internalHistory.submit(cmd)
     sFit = Fit.getInstance()
     sFit.recalc(self.fitID)
     sFit.fill(self.fitID)
     wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID))
     return success
Esempio n. 5
0
 def Do(self):
     sFit = Fit.getInstance()
     fit = sFit.getFit(self.fitID)
     drone = next(
         (pd for pd in fit.projectedDrones if pd.itemID == self.itemID),
         None)
     if drone is None:
         return False
     if drone.itemID == self.newItemID:
         return False
     info = DroneInfo.fromDrone(drone)
     info.itemID = self.newItemID
     cmdRemove = CalcRemoveProjectedDroneCommand(fitID=self.fitID,
                                                 itemID=self.itemID,
                                                 amount=math.inf)
     cmdAdd = CalcAddProjectedDroneCommand(fitID=self.fitID, droneInfo=info)
     success = self.internalHistory.submitBatch(cmdRemove, cmdAdd)
     sFit.recalc(fit)
     wx.PostEvent(gui.mainFrame.MainFrame.getInstance(),
                  GE.FitChanged(fitID=self.fitID))
     return success