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

Method populateSkillTree

gui/esiFittings.py:525–553  ·  view source on GitHub ↗
(self, data)

Source from the content-addressed store, hash-verified

523 self.Layout()
524
525 def populateSkillTree(self, data):
526 if data is None:
527 return
528 root = self.root
529 tree = self.fittingsTreeCtrl
530 tree.DeleteChildren(root)
531
532 sEsi = Esi.getInstance()
533
534 dict = {}
535 fits = data
536 for fit in fits:
537 if fit['fitting_id'] in sEsi.fittings_deleted:
538 continue
539 ship = getItem(fit['ship_type_id'])
540 if ship is None:
541 pyfalog.debug('Cannot find ship type id: {}'.format(fit['ship_type_id']))
542 continue
543 if ship.name not in dict:
544 dict[ship.name] = []
545 dict[ship.name].append(fit)
546
547 for name, fits in dict.items():
548 shipID = tree.AppendItem(root, name)
549 for fit in fits:
550 fitId = tree.AppendItem(shipID, fit['name'])
551 tree.SetItemData(fitId, json.dumps(fit))
552
553 tree.SortChildren(root)
554
555 def displayFit(self, event):
556 selection = self.fittingsTreeCtrl.GetSelection()

Callers 4

__init__Method · 0.95
fetchFittingsMethod · 0.45
deleteFittingMethod · 0.45
deleteAllFittingsMethod · 0.45

Calls 4

getItemFunction · 0.90
itemsMethod · 0.80
getInstanceMethod · 0.45
appendMethod · 0.45

Tested by

no test coverage detected