Esempio n. 1
0
 def Do(self):
     pyfalog.debug('Doing removal of booster from position {} on fit {}'.format(self.position, self.fitID))
     fit = Fit.getInstance().getFit(self.fitID)
     booster = fit.boosters[self.position]
     self.savedBoosterInfo = BoosterInfo.fromBooster(booster)
     fit.boosters.remove(booster)
     return True
Esempio n. 2
0
 def Do(self):
     cmd = CalcAddBoosterCommand(
         fitID=self.fitID, boosterInfo=BoosterInfo(itemID=self.itemID))
     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. 3
0
 def makeRoom(self, booster):
     # if needed, remove booster that was occupying slot
     oldObj = next((b for b in self if b.slot == booster.slot), None)
     if oldObj is not None:
         pyfalog.info("Slot {0} occupied with {1}, replacing with {2}", booster.slot, oldObj.item.name, booster.item.name)
         position = self.index(oldObj)
         from gui.fitCommands.helpers import BoosterInfo
         boosterInfo = BoosterInfo.fromBooster(oldObj)
         oldObj.itemID = 0  # hack to remove from DB. See GH issue #324
         self.remove(oldObj)
         return position, boosterInfo
     return None, None
Esempio n. 4
0
 def makeRoom(self, booster):
     # if needed, remove booster that was occupying slot
     oldObj = next((b for b in self if b.slot == booster.slot), None)
     if oldObj is not None:
         pyfalog.info("Slot {0} occupied with {1}, replacing with {2}", booster.slot, oldObj.item.name, booster.item.name)
         position = self.index(oldObj)
         from gui.fitCommands.helpers import BoosterInfo
         boosterInfo = BoosterInfo.fromBooster(oldObj)
         oldObj.itemID = 0  # hack to remove from DB. See GH issue #324
         self.remove(oldObj)
         return position, boosterInfo
     return None, None
Esempio n. 5
0
 def Do(self):
     cmd = CalcAddBoosterCommand(
         fitID=self.fitID, boosterInfo=BoosterInfo(itemID=self.itemID))
     success = self.internalHistory.submit(cmd)
     Market.getInstance().storeRecentlyUsed(self.itemID)
     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
Esempio n. 6
0
 def Do(self):
     results = []
     for itemID in self.boosters:
         cmd = CalcAddBoosterCommand(fitID=self.fitID, boosterInfo=BoosterInfo(itemID=itemID))
         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(fitIDs=(self.fitID,)))
     return success
Esempio n. 7
0
 def Do(self):
     sFit = Fit.getInstance()
     fit = sFit.getFit(self.fitID)
     booster = fit.boosters[self.position]
     if booster.itemID == self.newItemID:
         return False
     info = BoosterInfo.fromBooster(booster)
     info.itemID = self.newItemID
     cmd = CalcAddBoosterCommand(fitID=self.fitID, boosterInfo=info)
     success = self.internalHistory.submit(cmd)
     sFit.recalc(fit)
     wx.PostEvent(gui.mainFrame.MainFrame.getInstance(),
                  GE.FitChanged(fitID=self.fitID))
     return success
Esempio n. 8
0
 def Do(self):
     sFit = Fit.getInstance()
     fit = sFit.getFit(self.fitID)
     booster = fit.boosters[self.position]
     if booster.itemID == self.newItemID:
         return False
     info = BoosterInfo.fromBooster(booster)
     info.itemID = self.newItemID
     cmd = CalcAddBoosterCommand(fitID=self.fitID, boosterInfo=info)
     success = self.internalHistory.submit(cmd)
     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
Esempio n. 9
0
 def Do(self):
     sFit = Fit.getInstance()
     fit = sFit.getFit(self.fitID)
     booster = fit.boosters[self.position]
     if booster.itemID == self.newItemID:
         return False
     info = BoosterInfo.fromBooster(booster)
     info.itemID = self.newItemID
     cmd = CalcAddBoosterCommand(fitID=self.fitID, boosterInfo=info)
     success = self.internalHistory.submit(cmd)
     eos.db.flush()
     sFit.recalc(self.fitID)
     sFit.fill(self.fitID)
     eos.db.commit()
     self.newPosition = cmd.newPosition
     newBooster = fit.boosters[self.newPosition]
     mainFrame = gui.mainFrame.MainFrame.getInstance()
     wx.PostEvent(mainFrame, GE.FitChanged(fitIDs=(self.fitID, )))
     wx.PostEvent(mainFrame,
                  GE.ItemChangedInplace(old=booster, new=newBooster))
     return success