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

Method appendItem

graphs/gui/lists.py:332–350  ·  view source on GitHub ↗
(self, item)

Source from the content-addressed store, hash-verified

330 self.updateView()
331
332 def appendItem(self, item):
333 # Find out least used lightness
334 lightnessUseMap = {(l, s): 0 for l in LIGHTNESSES for s in STYLES}
335 for wrapper in self._wrappers:
336 key = (wrapper.lightnessID, wrapper.lineStyleID)
337 if key not in lightnessUseMap:
338 continue
339 lightnessUseMap[key] += 1
340
341 def getDefaultParams():
342 leastUses = min(lightnessUseMap.values(), default=0)
343 for lineStyleID in STYLES:
344 for lightnessID in LIGHTNESSES:
345 if leastUses == lightnessUseMap.get((lightnessID, lineStyleID), 0):
346 return lightnessID, lineStyleID
347 return None, None
348
349 lightnessID, lineStyleID = getDefaultParams()
350 self._wrappers.append(TargetWrapper(item=item, lightnessID=lightnessID, lineStyleID=lineStyleID))
351
352 def spawnMenu(self, event):
353 clickedPos = self.getRowByAbs(event.Position)

Callers 2

__init__Method · 0.95
addProfileMethod · 0.95

Calls 2

TargetWrapperClass · 0.90
appendMethod · 0.45

Tested by

no test coverage detected