gcc-slycooper50 0.1.127__tar.gz → 0.1.129__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of gcc-slycooper50 might be problematic. Click here for more details.
- {gcc_slycooper50-0.1.127/src/gcc_slycooper50.egg-info → gcc_slycooper50-0.1.129}/PKG-INFO +1 -1
- {gcc_slycooper50-0.1.127 → gcc_slycooper50-0.1.129}/pyproject.toml +1 -1
- gcc_slycooper50-0.1.129/src/gcc_slycooper50/glad-2.0.8.tar.gz +0 -0
- gcc_slycooper50-0.1.129/src/gcc_slycooper50/tree_app.py +228 -0
- {gcc_slycooper50-0.1.127 → gcc_slycooper50-0.1.129/src/gcc_slycooper50.egg-info}/PKG-INFO +1 -1
- {gcc_slycooper50-0.1.127 → gcc_slycooper50-0.1.129}/src/gcc_slycooper50.egg-info/SOURCES.txt +2 -1
- gcc_slycooper50-0.1.127/src/gcc_slycooper50/subfiles.zip +0 -0
- {gcc_slycooper50-0.1.127 → gcc_slycooper50-0.1.129}/LICENSE +0 -0
- {gcc_slycooper50-0.1.127 → gcc_slycooper50-0.1.129}/README.md +0 -0
- {gcc_slycooper50-0.1.127 → gcc_slycooper50-0.1.129}/setup.cfg +0 -0
- {gcc_slycooper50-0.1.127 → gcc_slycooper50-0.1.129}/src/gcc_slycooper50.egg-info/dependency_links.txt +0 -0
- {gcc_slycooper50-0.1.127 → gcc_slycooper50-0.1.129}/src/gcc_slycooper50.egg-info/top_level.txt +0 -0
|
Binary file
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
from pyvis.network import Network
|
|
2
|
+
import json
|
|
3
|
+
|
|
4
|
+
# ---------------------------
|
|
5
|
+
# Tree data
|
|
6
|
+
# ---------------------------
|
|
7
|
+
tree_data = {
|
|
8
|
+
"Root": {"type": "root", "value": 10, "children": ["Child 1", "Child 2"]},
|
|
9
|
+
"Child 1": {"type": "branch", "value": 5, "children": ["Grandchild 1.1"]},
|
|
10
|
+
"Child 2": {"type": "branch", "value": 7, "children": ["Grandchild 2.1", "Grandchild 2.2"]},
|
|
11
|
+
"Grandchild 1.1": {"type": "leaf", "value": 3, "children": []},
|
|
12
|
+
"Grandchild 2.1": {"type": "leaf", "value": 2, "children": [], "highlight": True}, # highlight in red
|
|
13
|
+
"Grandchild 2.2": {"type": "leaf", "value": 4, "children": []}
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
positions = {
|
|
17
|
+
"Root": (0, 0),
|
|
18
|
+
"Child 1": (-150, 150),
|
|
19
|
+
"Child 2": (150, 150),
|
|
20
|
+
"Grandchild 1.1": (-200, 300),
|
|
21
|
+
"Grandchild 2.1": (100, 300),
|
|
22
|
+
"Grandchild 2.2": (200, 300)
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
colors = {"root": "#ffcc00", "branch": "#66ccff", "leaf": "#99ff99"}
|
|
26
|
+
|
|
27
|
+
# ---------------------------
|
|
28
|
+
# Build Pyvis Network
|
|
29
|
+
# ---------------------------
|
|
30
|
+
net = Network(height="600px", width="100%", directed=True)
|
|
31
|
+
net.toggle_physics(True) # Enable physics for draggable nodes
|
|
32
|
+
|
|
33
|
+
for name, props in tree_data.items():
|
|
34
|
+
x, y = positions[name]
|
|
35
|
+
net.add_node(name, label=name, x=x, y=y, fixed=False, color=colors[props["type"]], size=25)
|
|
36
|
+
|
|
37
|
+
for parent, props in tree_data.items():
|
|
38
|
+
for child in props["children"]:
|
|
39
|
+
net.add_edge(parent, child, arrows='to', smooth={'type': 'cubicBezier', 'roundness': 0.4})
|
|
40
|
+
|
|
41
|
+
html = net.generate_html()
|
|
42
|
+
|
|
43
|
+
# ---------------------------
|
|
44
|
+
# Sidebar, expand menu, delete, save
|
|
45
|
+
# ---------------------------
|
|
46
|
+
extra_js = f"""
|
|
47
|
+
<style>
|
|
48
|
+
#sidebar {{
|
|
49
|
+
position: absolute;
|
|
50
|
+
left: 10px;
|
|
51
|
+
top: 10px;
|
|
52
|
+
width: 250px;
|
|
53
|
+
background: #f8f8f8;
|
|
54
|
+
padding: 10px;
|
|
55
|
+
border-radius: 10px;
|
|
56
|
+
box-shadow: 0 0 8px rgba(0,0,0,0.2);
|
|
57
|
+
font-family: Arial;
|
|
58
|
+
}}
|
|
59
|
+
#menuBar button {{
|
|
60
|
+
margin: 3px;
|
|
61
|
+
padding: 5px 8px;
|
|
62
|
+
border: none;
|
|
63
|
+
background: #ddd;
|
|
64
|
+
border-radius: 4px;
|
|
65
|
+
cursor: pointer;
|
|
66
|
+
}}
|
|
67
|
+
#menuBar button:hover {{
|
|
68
|
+
background: #ccc;
|
|
69
|
+
}}
|
|
70
|
+
#expandMenu {{
|
|
71
|
+
display: none;
|
|
72
|
+
position: absolute;
|
|
73
|
+
background: white;
|
|
74
|
+
border: 1px solid #aaa;
|
|
75
|
+
box-shadow: 0 0 5px rgba(0,0,0,0.2);
|
|
76
|
+
border-radius: 5px;
|
|
77
|
+
padding: 5px;
|
|
78
|
+
margin-top: 5px;
|
|
79
|
+
z-index: 1000;
|
|
80
|
+
}}
|
|
81
|
+
#expandMenu div {{
|
|
82
|
+
padding: 5px;
|
|
83
|
+
cursor: pointer;
|
|
84
|
+
}}
|
|
85
|
+
#expandMenu div:hover {{
|
|
86
|
+
background: #eee;
|
|
87
|
+
}}
|
|
88
|
+
#saveButton {{
|
|
89
|
+
width: 100%;
|
|
90
|
+
margin-top: 10px;
|
|
91
|
+
padding: 8px;
|
|
92
|
+
border: none;
|
|
93
|
+
background: #4CAF50;
|
|
94
|
+
color: white;
|
|
95
|
+
font-weight: bold;
|
|
96
|
+
border-radius: 6px;
|
|
97
|
+
cursor: pointer;
|
|
98
|
+
}}
|
|
99
|
+
#saveButton:hover {{
|
|
100
|
+
background: #45a049;
|
|
101
|
+
}}
|
|
102
|
+
</style>
|
|
103
|
+
|
|
104
|
+
<div id="sidebar">
|
|
105
|
+
<h3 style="text-align:center;">Node Details</h3>
|
|
106
|
+
<div id="nodeInfo">
|
|
107
|
+
<p><b>Click a node</b> to view details.</p>
|
|
108
|
+
</div>
|
|
109
|
+
<hr>
|
|
110
|
+
<div id="menuBar" style="display:none; text-align:center;">
|
|
111
|
+
<button onclick="menuAction('edit')">✏️ Edit</button>
|
|
112
|
+
<button onclick="menuAction('delete')">🗑️ Delete</button>
|
|
113
|
+
<button id="expandBtn" onclick="menuAction('expand')">🔽 Expand</button>
|
|
114
|
+
</div>
|
|
115
|
+
<div id="expandMenu"></div>
|
|
116
|
+
<button id="saveButton" onclick="saveTree()">💾 Save Tree</button>
|
|
117
|
+
</div>
|
|
118
|
+
|
|
119
|
+
<script>
|
|
120
|
+
var treeData = {json.dumps(tree_data)};
|
|
121
|
+
|
|
122
|
+
// Click node → update sidebar
|
|
123
|
+
network.on("click", function(params) {{
|
|
124
|
+
hideExpandMenu();
|
|
125
|
+
if(params.nodes.length > 0){{
|
|
126
|
+
var nodeId = params.nodes[0];
|
|
127
|
+
var node = treeData[nodeId];
|
|
128
|
+
document.getElementById("nodeInfo").innerHTML =
|
|
129
|
+
"<p><b>Name:</b> " + nodeId + "</p>" +
|
|
130
|
+
"<p><b>Type:</b> " + node.type + "</p>" +
|
|
131
|
+
"<p><b>Value:</b> " + node.value + "</p>" +
|
|
132
|
+
"<p><b>Children:</b> " + (node.children.join(", ") || "None") + "</p>";
|
|
133
|
+
document.getElementById("menuBar").style.display = "block";
|
|
134
|
+
document.getElementById("menuBar").setAttribute("data-node", nodeId);
|
|
135
|
+
}}
|
|
136
|
+
}});
|
|
137
|
+
|
|
138
|
+
// Menu actions
|
|
139
|
+
function menuAction(action){{
|
|
140
|
+
var nodeId = document.getElementById("menuBar").getAttribute("data-node");
|
|
141
|
+
if(action === 'expand'){{
|
|
142
|
+
showExpandMenu(treeData[nodeId]);
|
|
143
|
+
}} else if(action === 'delete'){{
|
|
144
|
+
deleteNode(nodeId);
|
|
145
|
+
}} else {{
|
|
146
|
+
alert(action + " action on node: " + nodeId);
|
|
147
|
+
}}
|
|
148
|
+
}}
|
|
149
|
+
|
|
150
|
+
// Expand button → show children
|
|
151
|
+
function showExpandMenu(node){{
|
|
152
|
+
var menu = document.getElementById("expandMenu");
|
|
153
|
+
menu.innerHTML = "";
|
|
154
|
+
|
|
155
|
+
if(node.children.length === 0){{
|
|
156
|
+
menu.innerHTML = "<div><i>No children</i></div>";
|
|
157
|
+
}} else {{
|
|
158
|
+
node.children.forEach(c => {{
|
|
159
|
+
var item = document.createElement("div");
|
|
160
|
+
item.textContent = c;
|
|
161
|
+
|
|
162
|
+
// Highlight children in red if 'highlight' property is true
|
|
163
|
+
if(treeData[c] && treeData[c].highlight){{
|
|
164
|
+
item.style.color = "red";
|
|
165
|
+
item.style.fontWeight = "bold";
|
|
166
|
+
}}
|
|
167
|
+
|
|
168
|
+
item.onclick = function(){{
|
|
169
|
+
alert("Selected child: " + c);
|
|
170
|
+
hideExpandMenu();
|
|
171
|
+
}};
|
|
172
|
+
menu.appendChild(item);
|
|
173
|
+
}});
|
|
174
|
+
}}
|
|
175
|
+
var expandBtn = document.getElementById("expandBtn");
|
|
176
|
+
var rect = expandBtn.getBoundingClientRect();
|
|
177
|
+
menu.style.left = rect.left + "px";
|
|
178
|
+
menu.style.top = (rect.bottom + window.scrollY) + "px";
|
|
179
|
+
menu.style.display = "block";
|
|
180
|
+
}}
|
|
181
|
+
|
|
182
|
+
function hideExpandMenu(){{
|
|
183
|
+
document.getElementById("expandMenu").style.display = "none";
|
|
184
|
+
}}
|
|
185
|
+
|
|
186
|
+
window.addEventListener('click', function(e){{
|
|
187
|
+
var menu = document.getElementById("expandMenu");
|
|
188
|
+
if (!menu.contains(e.target) && e.target.id !== 'expandBtn') {{
|
|
189
|
+
hideExpandMenu();
|
|
190
|
+
}}
|
|
191
|
+
}});
|
|
192
|
+
|
|
193
|
+
// Delete node from treeData and remove from graph
|
|
194
|
+
function deleteNode(nodeId){{
|
|
195
|
+
if(confirm("Delete node '" + nodeId + "'?")){{
|
|
196
|
+
for(let key in treeData){{
|
|
197
|
+
let idx = treeData[key].children.indexOf(nodeId);
|
|
198
|
+
if(idx !== -1) treeData[key].children.splice(idx, 1);
|
|
199
|
+
}}
|
|
200
|
+
delete treeData[nodeId];
|
|
201
|
+
network.body.data.nodes.remove({{id: nodeId}});
|
|
202
|
+
document.getElementById("nodeInfo").innerHTML = "<p><b>Click a node</b> to view details.</p>";
|
|
203
|
+
document.getElementById("menuBar").style.display = "none";
|
|
204
|
+
hideExpandMenu();
|
|
205
|
+
}}
|
|
206
|
+
}}
|
|
207
|
+
|
|
208
|
+
// Save tree to fixed file name
|
|
209
|
+
function saveTree(){{
|
|
210
|
+
const jsonData = JSON.stringify(treeData, null, 2);
|
|
211
|
+
const blob = new Blob([jsonData], {{ type: "application/json" }});
|
|
212
|
+
const url = URL.createObjectURL(blob);
|
|
213
|
+
const a = document.createElement("a");
|
|
214
|
+
a.href = url;
|
|
215
|
+
a.download = "tree_data.json";
|
|
216
|
+
document.body.appendChild(a);
|
|
217
|
+
a.click();
|
|
218
|
+
document.body.removeChild(a);
|
|
219
|
+
URL.revokeObjectURL(url);
|
|
220
|
+
}}
|
|
221
|
+
</script>
|
|
222
|
+
"""
|
|
223
|
+
|
|
224
|
+
with open("tree.html", "w") as f:
|
|
225
|
+
f.write(html.replace("</body>", extra_js + "</body>"))
|
|
226
|
+
|
|
227
|
+
print("✅ Open tree.html in your browser")
|
|
228
|
+
|
{gcc_slycooper50-0.1.127 → gcc_slycooper50-0.1.129}/src/gcc_slycooper50.egg-info/SOURCES.txt
RENAMED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
LICENSE
|
|
2
2
|
README.md
|
|
3
3
|
pyproject.toml
|
|
4
|
-
src/gcc_slycooper50/
|
|
4
|
+
src/gcc_slycooper50/glad-2.0.8.tar.gz
|
|
5
|
+
src/gcc_slycooper50/tree_app.py
|
|
5
6
|
src/gcc_slycooper50.egg-info/PKG-INFO
|
|
6
7
|
src/gcc_slycooper50.egg-info/SOURCES.txt
|
|
7
8
|
src/gcc_slycooper50.egg-info/dependency_links.txt
|
|
Binary file
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{gcc_slycooper50-0.1.127 → gcc_slycooper50-0.1.129}/src/gcc_slycooper50.egg-info/top_level.txt
RENAMED
|
File without changes
|