MCPcopy Create free account
hub / github.com/Bleemsys/Artisan-Core / rehighlight_json_on_enter

Method rehighlight_json_on_enter

AGUI/JSONtreeview.py:298–307  ·  view source on GitHub ↗

Event handler to rehighlight JSON on pressing Enter key

(self, event)

Source from the content-addressed store, hash-verified

296 text_widget.tag_add(tag, start_idx, end_idx)
297
298 def rehighlight_json_on_enter(self, event):
299 """Event handler to rehighlight JSON on pressing Enter key"""
300 text_widget = event.widget
301 try:
302 json_content = text_widget.get("1.0", tk.END)
303 parsed_json = json.loads(json_content)
304 formatted_json = json.dumps(parsed_json, indent=4)
305 self.highlight_json(text_widget, formatted_json)
306 except json.JSONDecodeError:
307 pass
308
309 def update_treeview_from_json(self, text_widget):
310 """Updates the treeview from JSON in the text widget"""

Callers

nothing calls this directly

Calls 2

highlight_jsonMethod · 0.95
getMethod · 0.80

Tested by

no test coverage detected