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

Method setup_ui

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

Source from the content-addressed store, hash-verified

12 self.insert_json('', self.data)
13
14 def setup_ui(self):
15 self.tree = ttk.Treeview(self.root, columns=['Value'])
16 self.tree.heading('#0', text='Key')
17 self.tree.heading('Value', text='Value')
18 self.tree.bind('<Double-1>', self.item_clicked)
19 self.tree.pack(fill='both', expand=True)
20
21 # Context menu
22 self.context_menu = tk.Menu(self.root, tearoff=0)
23 self.context_menu.add_command(label="Copy", command=self.copy_json)
24 self.context_menu.add_command(label="Paste", command=self.paste_json)
25 self.tree.bind("<Button-3>", self.on_right_click) # For Windows/Linux, use "<Button-2>" for Mac
26
27 # Button frame
28 button_frame = tk.Frame(self.root)
29 button_frame.pack(pady=10)
30
31 # Control buttons
32 # Load an image
33 self.moveup_icon = tk.PhotoImage(file=".//AGUI//resources//moveUp.png")
34 self.movedown_icon = tk.PhotoImage(file=".//AGUI//resources//moveDown.png")
35 self.editor_icon = tk.PhotoImage(file=".//AGUI//resources//editor.png")
36 self.clear_icon = tk.PhotoImage(file=".//AGUI//resources//clear.png")
37 self.delete_icon = tk.PhotoImage(file=".//AGUI//resources//delete.png")
38 self.copy_icon = tk.PhotoImage(file=".//AGUI//resources//copy.png")
39 self.paste_icon = tk.PhotoImage(file=".//AGUI//resources//paste.png")
40
41 up_button = tk.Button(button_frame, text="Move Up", image=self.moveup_icon, command=self.move_up)
42 up_button.pack(side='left', padx=5)
43 self.create_tooltip(up_button, "Move up")
44
45 down_button = tk.Button(button_frame, text="Move Down", image=self.movedown_icon, command=self.move_down)
46 down_button.pack(side='left', padx=5)
47 self.create_tooltip(down_button, "Move down")
48
49 delete_button = tk.Button(button_frame, text="Delete Item", image=self.delete_icon, command=self.delete_item)
50 delete_button.pack(side='left', padx=5)
51 self.create_tooltip(delete_button, "Delete item")
52
53 copy_button = tk.Button(button_frame, text="Copy Item", image=self.copy_icon, command=self.copy_json)
54 copy_button.pack(side='left', padx=5)
55 self.create_tooltip(copy_button, "Copy JSON")
56
57 paste_button = tk.Button(button_frame, text="Paste Item", image=self.paste_icon, command=self.paste_json)
58 paste_button.pack(side='left', padx=5)
59 self.create_tooltip(paste_button, "Paste JSON")
60
61 load_json_button = tk.Button(self.root, text="Editor", image=self.editor_icon, command=self.load_and_highlight_json)
62 load_json_button.pack(pady=10)
63 self.create_tooltip(load_json_button, "Editor")
64
65 clear_button = tk.Button(self.root, text="Clear All", image=self.clear_icon, command=self.clear_all)
66 clear_button.pack(pady=10)
67 self.create_tooltip(clear_button, "Clear all")
68
69 def create_tooltip(self, widget, text):
70 tooltip = ToolTip(widget, text)

Callers 1

__init__Method · 0.95

Calls 1

create_tooltipMethod · 0.95

Tested by

no test coverage detected