Appends rows created from the data contained in the provided list of tuples of strings. The first tuple of the list can be set as table title. Args: content (list): list of tuples of strings. Each tuple is a row. fill_title (bool): if true, t
(self, content, fill_title=False)
| 2943 | return obj |
| 2944 | |
| 2945 | def append_from_list(self, content, fill_title=False): |
| 2946 | """ |
| 2947 | Appends rows created from the data contained in the provided |
| 2948 | list of tuples of strings. The first tuple of the list can be |
| 2949 | set as table title. |
| 2950 | |
| 2951 | Args: |
| 2952 | content (list): list of tuples of strings. Each tuple is a row. |
| 2953 | fill_title (bool): if true, the first tuple in the list will |
| 2954 | be set as title. |
| 2955 | """ |
| 2956 | row_index = 0 |
| 2957 | for row in content: |
| 2958 | tr = TableRow() |
| 2959 | column_index = 0 |
| 2960 | for item in row: |
| 2961 | if row_index == 0 and fill_title: |
| 2962 | ti = TableTitle(item) |
| 2963 | else: |
| 2964 | ti = TableItem(item) |
| 2965 | tr.append(ti, str(column_index)) |
| 2966 | column_index = column_index + 1 |
| 2967 | self.append(tr, str(row_index)) |
| 2968 | row_index = row_index + 1 |
| 2969 | |
| 2970 | def append(self, value, key=''): |
| 2971 | keys = super(Table, self).append(value, key) |
no test coverage detected