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

Method PopulateList

gui/builtinItemStatsViews/itemAttributes.py:226–289  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

224 self.paramList.Expand(item)
225
226 def PopulateList(self):
227 # self.paramList.setResizeColumn(0)
228 self.SetupImageList()
229
230 self.processed_attribs = set()
231 root = self.paramList.AddRoot("The Root Item")
232 misc_parent = root
233
234 # We must first deet4ermine if it's categorey already has defined groupings set for it. Otherwise, we default to just using the fitting group
235 order = CategoryGroups.get(self.item.category.name, [GuiAttrGroup.FITTING, GuiAttrGroup.SHIP_GROUP])
236 # start building out the tree
237 for data in [AttrGroupDict[o] for o in order]:
238 heading = data.get("label")
239
240 header_item = self.paramList.AppendItem(root, heading)
241 self.paramList.SetItemTextColour(header_item, wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOWTEXT))
242 for attr in data.get("attributes", []):
243 # Attribute is a "grouped" attr (eg: damage, sensor strengths, etc). Automatically group these into a child item
244 if attr in GroupedAttributes:
245 # find which group it's in
246 for grouping in AttrGroups:
247 if attr in grouping[0]:
248 break
249
250 # create a child item with the groups label
251 item = self.paramList.AppendItem(header_item, grouping[1])
252 self.paramList.SetItemTextColour(item, wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOWTEXT))
253 for attr2 in grouping[0]:
254 # add each attribute in the group
255 self.AddAttribute(item, attr2)
256
257 self.ExpandOrDelete(item)
258 continue
259
260 self.AddAttribute(header_item, attr)
261
262 self.ExpandOrDelete(header_item)
263
264 names = list(self.attrValues.keys())
265 names.sort()
266
267 # this will take care of any attributes that weren't collected withe the defined grouping (or all attributes if the item ddidn't have anything defined)
268 for name in names:
269 if name in GroupedAttributes:
270 # find which group it's in
271 for grouping in AttrGroups:
272 if name in grouping[0]:
273 break
274
275 # get all attributes in group
276 item = self.paramList.AppendItem(root, grouping[1])
277 self.paramList.SetItemTextColour(item, wx.SystemSettings.GetColour(wx.SYS_COLOUR_WINDOWTEXT))
278 for attr2 in grouping[0]:
279 self.AddAttribute(item, attr2)
280
281 self.ExpandOrDelete(item)
282 continue
283

Callers 2

__init__Method · 0.95
UpdateListMethod · 0.95

Calls 6

SetupImageListMethod · 0.95
AddAttributeMethod · 0.95
ExpandOrDeleteMethod · 0.95
getMethod · 0.45
keysMethod · 0.45
sortMethod · 0.45

Tested by

no test coverage detected