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

Method paste_json

AGUI/JSONtreeview.py:165–180  ·  view source on GitHub ↗
(self)

Source from the content-addressed store, hash-verified

163 pass
164
165 def paste_json(self):
166 selected_item = self.tree.selection()[0] if self.tree.selection() else ''
167 input_json = self.root.clipboard_get()
168 try:
169 json_data = json.loads(input_json)
170 if json_data:
171 if selected_item:
172 # Insert the JSON data as a child of the selected item
173 self.insert_json(selected_item, json_data)
174 else:
175 # If no item is selected, insert at the root
176 self.insert_json('', json_data)
177 except json.JSONDecodeError:
178 messagebox.showerror("Error", "Invalid JSON")
179 except Exception as e:
180 messagebox.showerror("Error", f"An error occurred: {str(e)}")
181
182 def clear_all(self):
183 """Clears all the nodes in the tree."""

Callers

nothing calls this directly

Calls 1

insert_jsonMethod · 0.95

Tested by

no test coverage detected