gcc-slycooper50 0.1.130__py3-none-any.whl → 0.1.131__py3-none-any.whl
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/extra.js +69 -0
- gcc_slycooper50/tree_app.py +91 -262
- {gcc_slycooper50-0.1.130.dist-info → gcc_slycooper50-0.1.131.dist-info}/METADATA +1 -1
- gcc_slycooper50-0.1.131.dist-info/RECORD +7 -0
- gcc_slycooper50-0.1.130.dist-info/RECORD +0 -6
- {gcc_slycooper50-0.1.130.dist-info → gcc_slycooper50-0.1.131.dist-info}/WHEEL +0 -0
- {gcc_slycooper50-0.1.130.dist-info → gcc_slycooper50-0.1.131.dist-info}/licenses/LICENSE +0 -0
- {gcc_slycooper50-0.1.130.dist-info → gcc_slycooper50-0.1.131.dist-info}/top_level.txt +0 -0
gcc_slycooper50/extra.js
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
window.addEventListener('load', () => {
|
|
2
|
+
const network = window.network;
|
|
3
|
+
const nodes = window.nodes;
|
|
4
|
+
const edges = window.edges;
|
|
5
|
+
|
|
6
|
+
const nodeList = document.getElementById("nodeList");
|
|
7
|
+
const nodeTitle = document.getElementById("nodeTitle");
|
|
8
|
+
const info = document.getElementById("info");
|
|
9
|
+
const save = document.getElementById("save_btt");
|
|
10
|
+
|
|
11
|
+
// Build adjacency map
|
|
12
|
+
const adjacency = {};
|
|
13
|
+
edges.get().forEach(e => {
|
|
14
|
+
if (!adjacency[e.from]) adjacency[e.from] = [];
|
|
15
|
+
adjacency[e.from].push(e.to);
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
// Update sidebar list with children of a node
|
|
19
|
+
function showChildren(nodeId) {
|
|
20
|
+
nodeList.innerHTML = "";
|
|
21
|
+
nodeTitle.textContent = "Children of " + nodeId;
|
|
22
|
+
|
|
23
|
+
const children = adjacency[nodeId] || [];
|
|
24
|
+
if (children.length === 0) {
|
|
25
|
+
const li = document.createElement("li");
|
|
26
|
+
li.textContent = "(no children)";
|
|
27
|
+
li.style.color = "#888";
|
|
28
|
+
nodeList.appendChild(li);
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
children.forEach(childId => {
|
|
33
|
+
const li = document.createElement("li");
|
|
34
|
+
li.textContent = childId;
|
|
35
|
+
li.style.cursor = "pointer";
|
|
36
|
+
li.style.padding = "4px 0";
|
|
37
|
+
li.onmouseenter = () => li.style.color = "#ffcc00";
|
|
38
|
+
li.onmouseleave = () => li.style.color = "";
|
|
39
|
+
li.onclick = () => {
|
|
40
|
+
// Focus and highlight the clicked child
|
|
41
|
+
network.focus(childId, { scale: 1.5, animation: true });
|
|
42
|
+
nodes.update({ id: childId, color: "#ff4444" });
|
|
43
|
+
setTimeout(() => nodes.update({ id: childId, color: "#00ccff" }), 1500);
|
|
44
|
+
};
|
|
45
|
+
nodeList.appendChild(li);
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
// --- Event handlers ---
|
|
50
|
+
network.on("click", params => {
|
|
51
|
+
if (params.nodes.length > 0) {
|
|
52
|
+
const nodeId = params.nodes[0];
|
|
53
|
+
showChildren(nodeId);
|
|
54
|
+
}
|
|
55
|
+
});
|
|
56
|
+
|
|
57
|
+
network.on("hoverNode", params => {
|
|
58
|
+
info.textContent = "Hovering: " + params.node;
|
|
59
|
+
});
|
|
60
|
+
|
|
61
|
+
network.on("blurNode", () => {
|
|
62
|
+
info.textContent = "Click a node to see its children.";
|
|
63
|
+
});
|
|
64
|
+
|
|
65
|
+
save.addEventListener("click", () => {
|
|
66
|
+
console.log("SLYCOOPER");
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
});
|
gcc_slycooper50/tree_app.py
CHANGED
|
@@ -1,272 +1,101 @@
|
|
|
1
1
|
from pyvis.network import Network
|
|
2
|
-
import
|
|
3
|
-
|
|
4
|
-
#
|
|
5
|
-
#
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
"Root"
|
|
9
|
-
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"
|
|
13
|
-
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
2
|
+
from pathlib import Path
|
|
3
|
+
|
|
4
|
+
# --- Create network ---
|
|
5
|
+
net = Network(height="100vh", width="100%", directed=True, bgcolor="#222222", font_color="white")
|
|
6
|
+
|
|
7
|
+
edges = [
|
|
8
|
+
("Root", "Child1"),
|
|
9
|
+
("Root", "Child2"),
|
|
10
|
+
("Root", "Child3"),
|
|
11
|
+
("Child1", "Sub1"),
|
|
12
|
+
("Child1", "Sub2"),
|
|
13
|
+
("Child2", "Sub3"),
|
|
14
|
+
("Child3", "Sub4"),
|
|
15
|
+
("Child3", "Sub5"),
|
|
16
|
+
]
|
|
17
|
+
|
|
18
|
+
# Collect unique nodes
|
|
19
|
+
all_nodes = set([n for e in edges for n in e])
|
|
20
|
+
for n in all_nodes:
|
|
21
|
+
net.add_node(n, color="#00ccff" if n != "Root" else "#ffcc00")
|
|
22
|
+
|
|
23
|
+
for src, dst in edges:
|
|
24
|
+
net.add_edge(src, dst)
|
|
25
|
+
|
|
26
|
+
# Curvy edges + physics
|
|
27
|
+
net.set_options("""
|
|
28
|
+
{
|
|
29
|
+
"edges": {
|
|
30
|
+
"smooth": {
|
|
31
|
+
"type": "curvedCW",
|
|
32
|
+
"roundness": 0.3
|
|
33
|
+
}
|
|
34
|
+
},
|
|
35
|
+
"physics": {
|
|
36
|
+
"stabilization": false
|
|
37
|
+
}
|
|
25
38
|
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
#
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
#
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
for parent, props in tree_data.items():
|
|
71
|
-
for child in props["children"]:
|
|
72
|
-
net.add_edge(parent, child, arrows='to', smooth={'type': 'cubicBezier', 'roundness': 0.4})
|
|
73
|
-
|
|
74
|
-
# Generate HTML
|
|
75
|
-
html = net.generate_html()
|
|
76
|
-
|
|
77
|
-
# ---------------------------
|
|
78
|
-
# Extra sidebar JS/CSS
|
|
79
|
-
# ---------------------------
|
|
80
|
-
extra_js = f"""
|
|
81
|
-
<style>
|
|
82
|
-
#sidebar {{
|
|
83
|
-
position: absolute;
|
|
84
|
-
left: 10px;
|
|
85
|
-
top: 10px;
|
|
86
|
-
width: 250px;
|
|
87
|
-
background: #f8f8f8;
|
|
88
|
-
padding: 10px;
|
|
89
|
-
border-radius: 10px;
|
|
90
|
-
box-shadow: 0 0 8px rgba(0,0,0,0.2);
|
|
91
|
-
font-family: Arial;
|
|
92
|
-
}}
|
|
93
|
-
#menuBar button {{
|
|
94
|
-
margin: 3px;
|
|
95
|
-
padding: 5px 8px;
|
|
96
|
-
border: none;
|
|
97
|
-
background: #ddd;
|
|
98
|
-
border-radius: 4px;
|
|
99
|
-
cursor: pointer;
|
|
100
|
-
}}
|
|
101
|
-
#menuBar button:hover {{
|
|
102
|
-
background: #ccc;
|
|
103
|
-
}}
|
|
104
|
-
#expandMenu {{
|
|
105
|
-
display: none;
|
|
106
|
-
position: absolute;
|
|
107
|
-
background: white;
|
|
108
|
-
border: 1px solid #aaa;
|
|
109
|
-
box-shadow: 0 0 5px rgba(0,0,0,0.2);
|
|
110
|
-
border-radius: 5px;
|
|
111
|
-
padding: 5px;
|
|
112
|
-
margin-top: 5px;
|
|
113
|
-
z-index: 1000;
|
|
114
|
-
}}
|
|
115
|
-
#expandMenu div {{
|
|
116
|
-
padding: 5px;
|
|
117
|
-
cursor: pointer;
|
|
118
|
-
}}
|
|
119
|
-
#expandMenu div:hover {{
|
|
120
|
-
background: #eee;
|
|
121
|
-
}}
|
|
122
|
-
#saveButton {{
|
|
123
|
-
width: 100%;
|
|
124
|
-
margin-top: 10px;
|
|
125
|
-
padding: 8px;
|
|
126
|
-
border: none;
|
|
127
|
-
background: #4CAF50;
|
|
128
|
-
color: white;
|
|
129
|
-
font-weight: bold;
|
|
130
|
-
border-radius: 6px;
|
|
131
|
-
cursor: pointer;
|
|
132
|
-
}}
|
|
133
|
-
#saveButton:hover {{
|
|
134
|
-
background: #45a049;
|
|
135
|
-
}}
|
|
136
|
-
</style>
|
|
137
|
-
|
|
138
|
-
<div id="sidebar">
|
|
139
|
-
<h3 style="text-align:center;">Node Details</h3>
|
|
140
|
-
<div id="nodeInfo">
|
|
141
|
-
<p><b>Click a node</b> to view details.</p>
|
|
142
|
-
</div>
|
|
143
|
-
<hr>
|
|
144
|
-
<div id="menuBar" style="display:none; text-align:center;">
|
|
145
|
-
<button onclick="menuAction('edit')">✏️ Edit</button>
|
|
146
|
-
<button onclick="menuAction('delete')">🗑️ Delete</button>
|
|
147
|
-
<button id="expandBtn" onclick="menuAction('expand')">🔽 Expand</button>
|
|
39
|
+
""")
|
|
40
|
+
|
|
41
|
+
# Save base template
|
|
42
|
+
net.save_graph("template.html")
|
|
43
|
+
|
|
44
|
+
# --- Inject sidebar and JS ---
|
|
45
|
+
with open("template.html", "r") as f:
|
|
46
|
+
html = f.read()
|
|
47
|
+
|
|
48
|
+
sidebar_html = """
|
|
49
|
+
<div id="sidebar" style="
|
|
50
|
+
position: fixed;
|
|
51
|
+
left: 10px;
|
|
52
|
+
top: 10px;
|
|
53
|
+
width: 240px;
|
|
54
|
+
height: 95vh;
|
|
55
|
+
background: #2c2c2c;
|
|
56
|
+
color: white;
|
|
57
|
+
padding: 12px;
|
|
58
|
+
border-radius: 8px;
|
|
59
|
+
font-family: sans-serif;
|
|
60
|
+
display: flex;
|
|
61
|
+
flex-direction: column;
|
|
62
|
+
box-shadow: 0 0 10px rgba(0,0,0,0.4);
|
|
63
|
+
">
|
|
64
|
+
<h3 style="margin-top: 0;">Graph Controls</h3>
|
|
65
|
+
|
|
66
|
+
<hr style="border: 0; border-top: 1px solid #555; margin: 8px 0;">
|
|
67
|
+
<h4 id="nodeTitle" style="margin: 4px 0;">Children</h4>
|
|
68
|
+
<div id="nodeContainer" style="
|
|
69
|
+
flex: 1;
|
|
70
|
+
overflow-y: auto;
|
|
71
|
+
border: 1px solid #555;
|
|
72
|
+
border-radius: 6px;
|
|
73
|
+
background: #1e1e1e;
|
|
74
|
+
padding: 6px;
|
|
75
|
+
scrollbar-width: thin;
|
|
76
|
+
scrollbar-color: #666 #2c2c2c;
|
|
77
|
+
">
|
|
78
|
+
<ul id="nodeList" style="
|
|
79
|
+
list-style: none;
|
|
80
|
+
padding-left: 0;
|
|
81
|
+
margin: 0;
|
|
82
|
+
"></ul>
|
|
148
83
|
</div>
|
|
149
|
-
<div id="expandMenu"></div>
|
|
150
|
-
<button id="saveButton" onclick="saveTree()">💾 Save Tree</button>
|
|
151
|
-
</div>
|
|
152
|
-
|
|
153
|
-
<script>
|
|
154
|
-
var treeData = {json.dumps(tree_data)};
|
|
155
84
|
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
const redNodes = new Set();
|
|
159
|
-
function isRed(nodeId) {{
|
|
160
|
-
const node = treeData[nodeId];
|
|
161
|
-
if(node.children.length === 0) return !!node.highlight;
|
|
162
|
-
for(let c of node.children) {{
|
|
163
|
-
if(isRed(c)) return true;
|
|
164
|
-
}}
|
|
165
|
-
return false;
|
|
166
|
-
}}
|
|
167
|
-
for(let nodeId in treeData) {{
|
|
168
|
-
if(isRed(nodeId)) redNodes.add(nodeId);
|
|
169
|
-
}}
|
|
170
|
-
network.body.data.nodes.forEach(n => {{
|
|
171
|
-
let baseColor = (treeData[n.id].type === 'root') ? "#ffcc00" :
|
|
172
|
-
(treeData[n.id].type === 'branch') ? "#66ccff" : "#99ff99";
|
|
173
|
-
n.color = redNodes.has(n.id) ? "red" : baseColor;
|
|
174
|
-
}});
|
|
175
|
-
network.redraw();
|
|
176
|
-
}}
|
|
85
|
+
<hr style="border: 0; border-top: 1px solid #555; margin: 8px 0;">
|
|
86
|
+
<p id="info" style="font-size: 14px; color: #ccc;">Click a node to see its children.</p>
|
|
177
87
|
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
if(params.nodes.length > 0){{
|
|
182
|
-
var nodeId = params.nodes[0];
|
|
183
|
-
var node = treeData[nodeId];
|
|
184
|
-
document.getElementById("nodeInfo").innerHTML =
|
|
185
|
-
"<p><b>Name:</b> " + nodeId + "</p>" +
|
|
186
|
-
"<p><b>Type:</b> " + node.type + "</p>" +
|
|
187
|
-
"<p><b>Value:</b> " + node.value + "</p>" +
|
|
188
|
-
"<p><b>Children:</b> " + (node.children.join(", ") || "None") + "</p>";
|
|
189
|
-
document.getElementById("menuBar").style.display = "block";
|
|
190
|
-
document.getElementById("menuBar").setAttribute("data-node", nodeId);
|
|
191
|
-
}}
|
|
192
|
-
}});
|
|
193
|
-
|
|
194
|
-
// Menu actions
|
|
195
|
-
function menuAction(action){{
|
|
196
|
-
var nodeId = document.getElementById("menuBar").getAttribute("data-node");
|
|
197
|
-
if(action === 'expand') showExpandMenu(treeData[nodeId]);
|
|
198
|
-
else if(action === 'delete') deleteNode(nodeId);
|
|
199
|
-
else alert(action + " action on node: " + nodeId);
|
|
200
|
-
}}
|
|
201
|
-
|
|
202
|
-
// Expand menu
|
|
203
|
-
function showExpandMenu(node){{
|
|
204
|
-
var menu = document.getElementById("expandMenu");
|
|
205
|
-
menu.innerHTML = "";
|
|
206
|
-
if(node.children.length === 0){{
|
|
207
|
-
menu.innerHTML = "<div><i>No children</i></div>";
|
|
208
|
-
}} else {{
|
|
209
|
-
node.children.forEach(c => {{
|
|
210
|
-
var item = document.createElement("div");
|
|
211
|
-
item.textContent = c;
|
|
212
|
-
if(treeData[c] && treeData[c].highlight){{
|
|
213
|
-
item.style.color = "red";
|
|
214
|
-
item.style.fontWeight = "bold";
|
|
215
|
-
}}
|
|
216
|
-
item.onclick = function(){{ alert("Selected child: " + c); hideExpandMenu(); }};
|
|
217
|
-
menu.appendChild(item);
|
|
218
|
-
}});
|
|
219
|
-
}}
|
|
220
|
-
var expandBtn = document.getElementById("expandBtn");
|
|
221
|
-
var rect = expandBtn.getBoundingClientRect();
|
|
222
|
-
menu.style.left = rect.left + "px";
|
|
223
|
-
menu.style.top = (rect.bottom + window.scrollY) + "px";
|
|
224
|
-
menu.style.display = "block";
|
|
225
|
-
}}
|
|
226
|
-
|
|
227
|
-
function hideExpandMenu(){{ document.getElementById("expandMenu").style.display = "none"; }}
|
|
228
|
-
window.addEventListener('click', function(e){{
|
|
229
|
-
var menu = document.getElementById("expandMenu");
|
|
230
|
-
if(!menu.contains(e.target) && e.target.id !== 'expandBtn') hideExpandMenu();
|
|
231
|
-
}});
|
|
232
|
-
|
|
233
|
-
// Delete node
|
|
234
|
-
function deleteNode(nodeId){{
|
|
235
|
-
if(confirm("Delete node '" + nodeId + "'?")){{
|
|
236
|
-
for(let key in treeData){{
|
|
237
|
-
let idx = treeData[key].children.indexOf(nodeId);
|
|
238
|
-
if(idx !== -1) treeData[key].children.splice(idx, 1);
|
|
239
|
-
}}
|
|
240
|
-
delete treeData[nodeId];
|
|
241
|
-
network.body.data.nodes.remove({{id: nodeId}});
|
|
242
|
-
document.getElementById("nodeInfo").innerHTML = "<p><b>Click a node</b> to view details.</p>";
|
|
243
|
-
document.getElementById("menuBar").style.display = "none";
|
|
244
|
-
hideExpandMenu();
|
|
245
|
-
updateRedness();
|
|
246
|
-
}}
|
|
247
|
-
}}
|
|
248
|
-
|
|
249
|
-
// Save tree
|
|
250
|
-
function saveTree(){{
|
|
251
|
-
const jsonData = JSON.stringify(treeData, null, 2);
|
|
252
|
-
const blob = new Blob([jsonData], {{ type: "application/json" }});
|
|
253
|
-
const url = URL.createObjectURL(blob);
|
|
254
|
-
const a = document.createElement("a");
|
|
255
|
-
a.href = url;
|
|
256
|
-
a.download = "tree_data.json";
|
|
257
|
-
document.body.appendChild(a);
|
|
258
|
-
a.click();
|
|
259
|
-
document.body.removeChild(a);
|
|
260
|
-
URL.revokeObjectURL(url);
|
|
261
|
-
}}
|
|
88
|
+
<div style="display: flex; gap: 10px; margin-bottom: 12px;">
|
|
89
|
+
<button id="del_node">Delete Node</button>
|
|
90
|
+
</div>
|
|
262
91
|
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
</script>
|
|
92
|
+
<button id="save_btt">Save New Connections</button>
|
|
93
|
+
</div>
|
|
266
94
|
"""
|
|
267
95
|
|
|
268
|
-
|
|
269
|
-
f.write(html.replace("</body>", extra_js + "</body>"))
|
|
96
|
+
html = html.replace("</body>", f"{sidebar_html}\n<script src={str(Path(__file__).resolve().parent)+"/"+"extra.js"}></script>\n</body>")
|
|
270
97
|
|
|
271
|
-
|
|
98
|
+
with open("index.html", "w") as f:
|
|
99
|
+
f.write(html)
|
|
272
100
|
|
|
101
|
+
print("✅ Created index.html with child-list sidebar.")
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
gcc_slycooper50/extra.js,sha256=I0EYNY40uJMxWlH8LpM_DdJMZyX6Ym9y2RsnqaY-Xas,2017
|
|
2
|
+
gcc_slycooper50/tree_app.py,sha256=7tCKw_2rTBpQvwQm4CmcoAS1JAF8E4ggUsKsXOSFo-4,2395
|
|
3
|
+
gcc_slycooper50-0.1.131.dist-info/licenses/LICENSE,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
4
|
+
gcc_slycooper50-0.1.131.dist-info/METADATA,sha256=oCJtS-IntJBPOc8PZJxtbD5LKQ-ZblC6RhvhwmdMBoQ,356
|
|
5
|
+
gcc_slycooper50-0.1.131.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
6
|
+
gcc_slycooper50-0.1.131.dist-info/top_level.txt,sha256=yDxkl8ek8lYZRCxgy1mWsk0qEPq8BBIkw_EQIlq5_q8,16
|
|
7
|
+
gcc_slycooper50-0.1.131.dist-info/RECORD,,
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
gcc_slycooper50/tree_app.py,sha256=jZEvJl9vGWMUea75_FIs-RW1muaE577NNc7w_zoAhHM,8392
|
|
2
|
-
gcc_slycooper50-0.1.130.dist-info/licenses/LICENSE,sha256=AbpHGcgLb-kRsJGnwFEktk7uzpZOCcBY74-YBdrKVGs,1
|
|
3
|
-
gcc_slycooper50-0.1.130.dist-info/METADATA,sha256=kaxcjcNnGwWjE2DAN0n8afx7pVikvn5t8oX04kT0HsA,356
|
|
4
|
-
gcc_slycooper50-0.1.130.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
|
5
|
-
gcc_slycooper50-0.1.130.dist-info/top_level.txt,sha256=yDxkl8ek8lYZRCxgy1mWsk0qEPq8BBIkw_EQIlq5_q8,16
|
|
6
|
-
gcc_slycooper50-0.1.130.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|
|
File without changes
|