Example #1
0
 def Do(self):
     pyfalog.debug(
         'Doing removal of implant from position {} on fit {}'.format(
             self.position, self.fitID))
     fit = Fit.getInstance().getFit(self.fitID)
     implant = fit.implants[self.position]
     self.savedImplantInfo = ImplantInfo.fromImplant(implant)
     fit.implants.remove(implant)
     return True
Example #2
0
 def makeRoom(self, implant):
     # if needed, remove booster that was occupying slot
     oldObj = next((i for i in self if i.slot == implant.slot), None)
     if oldObj is not None:
         pyfalog.info("Slot {0} occupied with {1}, replacing with {2}", implant.slot, oldObj.item.name, implant.item.name)
         position = self.index(oldObj)
         from gui.fitCommands.helpers import ImplantInfo
         implantInfo = ImplantInfo.fromImplant(oldObj)
         oldObj.itemID = 0  # hack to remove from DB. See GH issue #324
         self.remove(oldObj)
         return position, implantInfo
     return None, None
Example #3
0
 def makeRoom(self, implant):
     # if needed, remove booster that was occupying slot
     oldObj = next((i for i in self if i.slot == implant.slot), None)
     if oldObj is not None:
         pyfalog.info("Slot {0} occupied with {1}, replacing with {2}", implant.slot, oldObj.item.name, implant.item.name)
         position = self.index(oldObj)
         from gui.fitCommands.helpers import ImplantInfo
         implantInfo = ImplantInfo.fromImplant(oldObj)
         oldObj.itemID = 0  # hack to remove from DB. See GH issue #324
         self.remove(oldObj)
         return position, implantInfo
     return None, None
Example #4
0
 def Do(self):
     sFit = Fit.getInstance()
     fit = sFit.getFit(self.fitID)
     implant = fit.implants[self.position]
     if implant.itemID == self.newItemID:
         return False
     info = ImplantInfo.fromImplant(implant)
     info.itemID = self.newItemID
     cmd = CalcAddImplantCommand(fitID=self.fitID, implantInfo=info)
     success = self.internalHistory.submit(cmd)
     sFit.recalc(fit)
     wx.PostEvent(gui.mainFrame.MainFrame.getInstance(),
                  GE.FitChanged(fitID=self.fitID))
     return success
Example #5
0
 def Do(self):
     sFit = Fit.getInstance()
     fit = sFit.getFit(self.fitID)
     implant = fit.implants[self.position]
     if implant.itemID == self.newItemID:
         return False
     info = ImplantInfo.fromImplant(implant)
     info.itemID = self.newItemID
     cmd = CalcAddImplantCommand(fitID=self.fitID, implantInfo=info)
     success = self.internalHistory.submit(cmd)
     eos.db.flush()
     sFit.recalc(self.fitID)
     sFit.fill(self.fitID)
     eos.db.commit()
     self.newPosition = cmd.newPosition
     newImplant = fit.implants[self.newPosition]
     mainFrame = gui.mainFrame.MainFrame.getInstance()
     wx.PostEvent(mainFrame, GE.FitChanged(fitIDs=(self.fitID, )))
     wx.PostEvent(mainFrame,
                  GE.ItemChangedInplace(old=implant, new=newImplant))
     return success