MCPcopy Index your code
hub / github.com/pyfa-org/Pyfa / HandledImplantList

Class HandledImplantList

eos/effectHandlerHelpers.py:237–275  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

235
236
237class HandledImplantList(HandledList):
238
239 def append(self, implant):
240 if implant.isInvalid:
241 HandledList.append(self, implant)
242 self.remove(implant)
243 return
244 if self.__slotCheck(implant):
245 HandledList.append(self, implant)
246 self.remove(implant)
247 return
248 HandledList.append(self, implant)
249
250 def insert(self, idx, implant):
251 if implant.isInvalid:
252 HandledList.insert(self, idx, implant)
253 self.remove(implant)
254 return
255 if self.__slotCheck(implant):
256 HandledList.insert(self, idx, implant)
257 self.remove(implant)
258 return
259 HandledList.insert(self, idx, implant)
260
261 def makeRoom(self, implant):
262 # if needed, remove booster that was occupying slot
263 oldObj = next((i for i in self if i.slot == implant.slot), None)
264 if oldObj is not None:
265 pyfalog.info("Slot {0} occupied with {1}, replacing with {2}", implant.slot, oldObj.item.name, implant.item.name)
266 position = self.index(oldObj)
267 from gui.fitCommands.helpers import ImplantInfo
268 implantInfo = ImplantInfo.fromImplant(oldObj)
269 oldObj.itemID = 0 # hack to remove from DB. See GH issue #324
270 self.remove(oldObj)
271 return position, implantInfo
272 return None, None
273
274 def __slotCheck(self, implant):
275 return any(i.slot == implant.slot for i in self)
276
277
278class HandledBoosterList(HandledList):

Callers 3

__init__Method · 0.90
__init__Method · 0.90
__init__Method · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected