(self, node_id='')
| 199 | return self.data |
| 200 | |
| 201 | def extract_treeview_data(self, node_id=''): |
| 202 | def node_to_dict(item): |
| 203 | children = self.tree.get_children(item) |
| 204 | if not children: |
| 205 | # If the node has no children, return the value |
| 206 | values = self.tree.item(item, 'values') |
| 207 | |
| 208 | re_val = self.parse_treeview_value(values[0]) |
| 209 | |
| 210 | return re_val if values else None |
| 211 | else: |
| 212 | # If the node has children, create a dictionary |
| 213 | node_dict = {} |
| 214 | for child in children: |
| 215 | child_key = self.tree.item(child, 'text') |
| 216 | node_dict[child_key] = node_to_dict(child) |
| 217 | return node_dict |
| 218 | |
| 219 | reconstructed_data = {} |
| 220 | root_nodes = self.tree.get_children(node_id) |
| 221 | for root_item in root_nodes: |
| 222 | key = self.tree.item(root_item, 'text') |
| 223 | reconstructed_data[key] = node_to_dict(root_item) |
| 224 | |
| 225 | return reconstructed_data |
| 226 | |
| 227 | def parse_treeview_value(self, value): |
| 228 | """ |
no outgoing calls
no test coverage detected