コード例 #1
0
ファイル: remove.py プロジェクト: bsmr/pyfa-org-Pyfa
 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
コード例 #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
コード例 #3
0
ファイル: effectHandlerHelpers.py プロジェクト: pyfa-org/Pyfa
 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
コード例 #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
コード例 #5
0
ファイル: changeMeta.py プロジェクト: TheMule71/Pyfa
 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