The HTML_Table class is used to create a table of data that can be visualized in the graph.
| 22 | """ |
| 23 | |
| 24 | def __init__(self): |
| 25 | """ |
| 26 | Create an HTML_Table object. |
| 27 | """ |
| 28 | self.rows = [[]] |
| 29 | self.add_new_line_flag = False |
| 30 | self.is_empty = True |
| 31 | self.col_count = 0 |
| 32 | self.row_count = 0 |
| 33 | self.ref_count = 0 |
| 34 | self.max_col_count = 0 |
| 35 | self.edges = [] |
| 36 | self.rows_reversed = False |
| 37 | self.columns_reversed = False |
| 38 | |
| 39 | def __repr__(self): |
| 40 | """ Get the string representation of the HTML_Table object. """ |
| 41 | return str(self.rows) |
| 42 | |
| 43 | def add_row(self): |
| 44 | self.rows.append([]) |
| 45 | |
| 46 | def add_column(self, s): |
| 47 | self.rows[-1].append(s) |
| 48 | |
| 49 | def reverse_rows(self, reversed=True): |
| 50 | self.rows_reversed = reversed |
| 51 | |
| 52 | def reverse_columns(self, reversed=True): |
| 53 | self.columns_reversed = reversed |
| 54 | |
| 55 | def add_new_line(self): |
| 56 | """ Set the 'add_new_line_flag' to add a new line to the table when adding the next table element. """ |
| 57 | self.add_new_line_flag = True |
| 58 | self.row_count += 1 |
| 59 | if self.col_count > self.max_col_count: |
| 60 | self.max_col_count = self.col_count |
| 61 | self.col_count = 0 |
| 62 | |
| 63 | def check_add_new_line(self): |
| 64 | """ Check if a new line should be added to the table, and if so add it and sets the 'add_new_line_flag' to False.""" |
| 65 | if self.add_new_line_flag: |
| 66 | self.add_row() |
| 67 | self.add_new_line_flag = False |
| 68 | |
| 69 | def add_index(self, s): |
| 70 | """ Add an index s to the table. """ |
| 71 | self.check_add_new_line() |
| 72 | self.add_column(f'<TD BORDER="0"><font color="{config.index_color}">{str(s)}</font></TD>') |
| 73 | self.col_count += 1 |
| 74 | |
| 75 | def add_entry(self, node, nodes, child, id_to_slices, rounded=False, border=1, dashed=False, embed=False): |
| 76 | """ Add child to the table either as reference if it is a Node_Base or as a value otherwise. """ |
| 77 | child_id = id(child) |
| 78 | if not embed and child_id in nodes: |
| 79 | child = nodes[child_id] |
| 80 | if child_id in id_to_slices: |
| 81 | self.add_reference(node, child, rounded, border, dashed) |
no outgoing calls
no test coverage detected