We first build a usable dictionary of items. The key is either a fit if the afflictions stem from a projected fit, or self.stuff if they are local afflictions (everything else, even gang boosts at this time) The value of this is yet another dictionary in the foll
(self, root)
| 318 | self.affectedBy.SetItemData(treeItem, afflictor) |
| 319 | |
| 320 | def buildModuleView(self, root): |
| 321 | """ |
| 322 | We first build a usable dictionary of items. The key is either a fit |
| 323 | if the afflictions stem from a projected fit, or self.stuff if they |
| 324 | are local afflictions (everything else, even gang boosts at this time) |
| 325 | The value of this is yet another dictionary in the following format: |
| 326 | |
| 327 | "Module Name": [ |
| 328 | class of affliction, |
| 329 | set of afflictors (such as 2 of the same module), |
| 330 | info on affliction (attribute name, modifier, and modification amount), |
| 331 | item that will be used to determine icon (required due to GH issue #335) |
| 332 | whether this affliction is actually used (unlearned skills are not used) |
| 333 | ] |
| 334 | """ |
| 335 | |
| 336 | attributes = self.stuff.itemModifiedAttributes if self.item == self.stuff.item else self.stuff.chargeModifiedAttributes |
| 337 | container = {} |
| 338 | for attrName in attributes.iterAfflictions(): |
| 339 | # if value is 0 or there has been no change from original to modified, return |
| 340 | if attributes[attrName] == (attributes.getOriginal(attrName, 0)): |
| 341 | continue |
| 342 | |
| 343 | for fit, afflictors in attributes.getAfflictions(attrName).items(): |
| 344 | for afflictor, operator, stackingGroup, preResAmount, postResAmount, used in afflictors: |
| 345 | if not used or getattr(afflictor, 'item', None) is None: |
| 346 | continue |
| 347 | |
| 348 | if fit.ID != self.activeFit: |
| 349 | # affliction fit does not match our fit |
| 350 | if fit not in container: |
| 351 | container[fit] = {} |
| 352 | items = container[fit] |
| 353 | else: |
| 354 | # local afflictions |
| 355 | if self.stuff not in container: |
| 356 | container[self.stuff] = {} |
| 357 | items = container[self.stuff] |
| 358 | |
| 359 | if afflictor == self.stuff and getattr(afflictor, 'charge', None): |
| 360 | # we are showing a charges modifications, see #335 |
| 361 | item = afflictor.charge |
| 362 | else: |
| 363 | item = afflictor.item |
| 364 | |
| 365 | # items hold our module: info mappings |
| 366 | if item.name not in items: |
| 367 | items[item.name] = [type(afflictor), set(), [], item, getattr(afflictor, "projected", False)] |
| 368 | |
| 369 | info = items[item.name] |
| 370 | info[1].add(afflictor) |
| 371 | operatorStr = formatOperator(operator, stackingGroup, preResAmount, postResAmount) |
| 372 | # If info[1] > 1, there are two separate modules working. |
| 373 | # Check to make sure we only include the modifier once |
| 374 | # See GH issue 154 |
| 375 | if len(info[1]) > 1 and (attrName, operatorStr, postResAmount) in info[2]: |
| 376 | continue |
| 377 | info[2].append((attrName, operatorStr, postResAmount)) |
no test coverage detected