MCPcopy Create free account
hub / github.com/pyfa-org/Pyfa / HandledProjectedModList

Class HandledProjectedModList

eos/effectHandlerHelpers.py:330–375  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

328
329
330class HandledProjectedModList(HandledList):
331
332 def append(self, proj):
333 if proj.isInvalid:
334 # we must include it before we remove it. doing it this way ensures
335 # rows and relationships in database are removed as well
336 HandledList.append(self, proj)
337 self.remove(proj)
338 return
339 proj.projected = True
340 HandledList.append(self, proj)
341 # Remove non-projectable modules
342 if not proj.item.isType("projected") and not proj.isExclusiveSystemEffect:
343 self.remove(proj)
344
345 def insert(self, idx, proj):
346 if proj.isInvalid:
347 # we must include it before we remove it. doing it this way ensures
348 # rows and relationships in database are removed as well
349 HandledList.insert(self, idx, proj)
350 self.remove(proj)
351 return
352 proj.projected = True
353 HandledList.insert(self, idx, proj)
354 # Remove non-projectable modules
355 if not proj.item.isType("projected") and not proj.isExclusiveSystemEffect:
356 self.remove(proj)
357
358 @property
359 def currentSystemEffect(self):
360 return next((m for m in self if m.isExclusiveSystemEffect), None)
361
362 def makeRoom(self, proj):
363 if proj.isExclusiveSystemEffect:
364 # remove other system effects - only 1 per fit plz
365 mod = self.currentSystemEffect
366
367 if mod:
368 pyfalog.info("System effect occupied with {0}, removing it to make space for {1}".format(mod.item.name, proj.item.name))
369 position = self.index(mod)
370 # We need to pack up this info, so whatever...
371 from gui.fitCommands.helpers import ModuleInfo
372 modInfo = ModuleInfo.fromModule(mod)
373 self.remove(mod)
374 return position, modInfo
375 return None, None
376
377
378class HandledProjectedDroneList(HandledDroneCargoList):

Callers 1

__init__Method · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected