def Do(self): sFit = Fit.getInstance() fit = sFit.getFit(self.fitID) results = [] for position in sorted(self.positions, reverse=True): drone = fit.drones[position] if drone.itemID == self.newItemID: continue info = DroneInfo.fromDrone(drone) info.itemID = self.newItemID cmdRemove = CalcRemoveLocalDroneCommand( fitID=self.fitID, position=position, amount=math.inf, commit=False) cmdAdd = CalcAddLocalDroneCommand( fitID=self.fitID, droneInfo=info, forceNewStack=True, 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
def Do(self): sFit = Fit.getInstance() fit = sFit.getFit(self.fitID) drone = fit.drones[self.position] if self.amount >= drone.amount: return False info = DroneInfo.fromDrone(drone) info.amount = self.amount info.amountActive = min(self.amount, info.amountActive) commands = [] commands.append( CalcRemoveLocalDroneCommand(fitID=self.fitID, position=self.position, amount=self.amount, commit=False)) commands.append( CalcAddLocalDroneCommand(fitID=self.fitID, droneInfo=info, forceNewStack=True, commit=False)) success = self.internalHistory.submitBatch(*commands) eos.db.commit() sFit.recalc(fit) wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID)) return success
def Do(self): sFit = Fit.getInstance() fit = sFit.getFit(self.fitID) try: drone = fit.drones[self.position] except IndexError: return False if drone.isMutated: return False info = DroneInfo( amount=drone.amount, amountActive=drone.amountActive, itemID=self.itemID, baseItemID=drone.item.ID, mutaplasmidID=self.mutaplasmidID, mutations={}) cmdRemove = CalcRemoveLocalDroneCommand( fitID=self.fitID, position=self.position, amount=math.inf) cmdAdd = CalcAddLocalDroneCommand( fitID=self.fitID, droneInfo=info, forceNewStack=True, ignoreRestrictions=True) success = self.internalHistory.submitBatch(cmdRemove, cmdAdd) eos.db.flush() sFit.recalc(self.fitID) sFit.fill(self.fitID) eos.db.commit() wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitIDs=(self.fitID,))) return success
def Do(self): if self.srcPosition == self.dstPosition: return False sFit = Fit.getInstance() fit = sFit.getFit(self.fitID) srcDrone = fit.drones[self.srcPosition] dstDrone = fit.drones[self.dstPosition] if srcDrone.itemID != dstDrone.itemID: return False srcAmount = srcDrone.amount commands = [] commands.append( CalcChangeLocalDroneAmountCommand(fitID=self.fitID, position=self.dstPosition, amount=dstDrone.amount + srcAmount, commit=False)) commands.append( CalcRemoveLocalDroneCommand(fitID=self.fitID, position=self.srcPosition, amount=srcAmount, commit=False)) success = self.internalHistory.submitBatch(*commands) eos.db.commit() sFit.recalc(fit) wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID)) return success
def Do(self): cmd = CalcRemoveLocalDroneCommand(fitID=self.fitID, position=self.position, 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
def Do(self): if self.amount > 0: cmd = CalcChangeLocalDroneAmountCommand(fitID=self.fitID, position=self.position, amount=self.amount) else: cmd = CalcRemoveLocalDroneCommand(fitID=self.fitID, position=self.position, amount=math.inf) success = self.internalHistory.submit(cmd) 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
def Do(self): results = [] for position in sorted(self.positions, reverse=True): cmd = CalcRemoveLocalDroneCommand(fitID=self.fitID, position=position, amount=self.amount, 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
def Do(self): sMkt = Market.getInstance() results = [] for position in sorted(self.positions, reverse=True): cmd = CalcRemoveLocalDroneCommand(fitID=self.fitID, position=position, amount=self.amount) results.append(self.internalHistory.submit(cmd)) sMkt.storeRecentlyUsed(cmd.savedDroneInfo.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
def Do(self): sFit = Fit.getInstance() fit = sFit.getFit(self.fitID) drone = fit.drones[self.position] if drone.itemID == self.newItemID: return False info = DroneInfo.fromDrone(drone) info.itemID = self.newItemID cmdRemove = CalcRemoveLocalDroneCommand(fitID=self.fitID, position=self.position, amount=math.inf) cmdAdd = CalcAddLocalDroneCommand(fitID=self.fitID, droneInfo=info, forceNewStack=True) success = self.internalHistory.submitBatch(cmdRemove, cmdAdd) sFit.recalc(fit) wx.PostEvent(gui.mainFrame.MainFrame.getInstance(), GE.FitChanged(fitID=self.fitID)) return success