`updateList()` takes the output of `output_list()` in `analyze.py` (via `sortOutlist()`) or a copy thereof stored in self.option, and uses it to populate the grid widget. Before it does so, it checks each item in outlist against a list of ignored characters, corporat
(self, outlist, duration=None)
| 488 | return org + " + " + app |
| 489 | |
| 490 | def updateList(self, outlist, duration=None): |
| 491 | ''' |
| 492 | `updateList()` takes the output of `output_list()` in `analyze.py` (via |
| 493 | `sortOutlist()`) or a copy thereof stored in self.option, and uses it |
| 494 | to populate the grid widget. Before it does so, it checks each |
| 495 | item in outlist against a list of ignored characters, corporations |
| 496 | and alliances. Finally, it highlights certain characters and |
| 497 | updates the statusbar message. |
| 498 | |
| 499 | :param `outlist`: A list of rows with character data. |
| 500 | |
| 501 | :param `duration`: Time in seconds taken to query all relevant |
| 502 | databases for each character. |
| 503 | ''' |
| 504 | # If updateList() gets called before outlist has been provided, do nothing |
| 505 | if outlist is None: |
| 506 | return |
| 507 | # Clean up grid |
| 508 | if self.grid.GetNumberRows() > 0: |
| 509 | self.grid.DeleteRows(numRows=self.grid.GetNumberRows()) |
| 510 | self.grid.AppendRows(len(outlist)) |
| 511 | # Add any NPSI fleet related characters to ignored_list |
| 512 | npsi_list = self.options.Get("NPSIList", default=[]) |
| 513 | ignored_list = self.options.Get("ignoredList", default=[]) |
| 514 | highlighted_list = self.options.Get("highlightedList", default=[]) |
| 515 | hl_blops = self.options.Get("HlBlops", True) |
| 516 | hl_hic = self.options.Get("HlHic", True) |
| 517 | hl_cyno = self.options.Get("HlCyno", True) |
| 518 | hl_list = self.options.Get("HlList", True) |
| 519 | hl_cyno_prob = config.CYNO_HL_PERCENTAGE |
| 520 | ignore_count = 0 |
| 521 | rowidx = 0 |
| 522 | for r in outlist: |
| 523 | |
| 524 | ignore = False |
| 525 | for rec in ignored_list: |
| 526 | if r[0] == rec[0] or r[3] == rec[0] or r[5] == rec[0]: |
| 527 | ignore = True |
| 528 | for rec in npsi_list: |
| 529 | if r[0] == rec[0]: |
| 530 | ignore = True |
| 531 | if ignore: |
| 532 | self.grid.HideRow(rowidx) |
| 533 | ignore_count += 1 |
| 534 | |
| 535 | # Schema depending on output_list() in analyze.py |
| 536 | id = r[0] # Hidden, used for zKillboard link |
| 537 | faction_id = r[1] # Hidden, used for faction ignoring |
| 538 | name = r[2] |
| 539 | corp_id = r[3] |
| 540 | corp_name = r[4] |
| 541 | alliance_id = r[5] |
| 542 | alliance_name = r[6] |
| 543 | faction = r[7] if r[7] is not None else "-" |
| 544 | allies = "{:,}".format(int(r[8])) |
| 545 | |
| 546 | # Add number of allies to alliance name |
| 547 | if alliance_name is not None: |
no test coverage detected