Returns the last entry in the TreeView as a dictionary, including nested items.
(self)
| 257 | |
| 258 | |
| 259 | def get_last_entry(self): |
| 260 | """Returns the last entry in the TreeView as a dictionary, including nested items.""" |
| 261 | children = self.tree.get_children() |
| 262 | if children: # Check if there are any items in the TreeView |
| 263 | last_item_id = children[-1] # Get the identifier of the last item |
| 264 | last_item = self.tree.item(last_item_id) |
| 265 | key = last_item['text'] |
| 266 | # Extract complete data structure under this item |
| 267 | full_data = self.extract_treeview_data(last_item_id) |
| 268 | return {key: full_data} # Return as a dictionary with key and nested data |
| 269 | else: |
| 270 | return None # Returns None if the TreeView is empty |
| 271 | |
| 272 | def setup_tags(self, text_widget): |
| 273 | """Define tags for JSON highlighting""" |
no test coverage detected