gcc-slycooper50 0.1.128__tar.gz → 0.1.130__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.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gcc_slycooper50
3
- Version: 0.1.128
3
+ Version: 0.1.130
4
4
  Summary: Get it in.
5
5
  Author-email: sly cooper <slycooper50@gmail.com>
6
6
  License-Expression: MIT
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "gcc_slycooper50"
7
- version = "0.1.128"
7
+ version = "0.1.130"
8
8
  authors = [
9
9
  { name="sly cooper", email="slycooper50@gmail.com" },
10
10
  ]
@@ -0,0 +1,272 @@
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", "Child 3"]},
9
+
10
+ "Child 1": {"type": "branch", "value": 5, "children": ["Grandchild 1.1", "Grandchild 1.2"]},
11
+ "Child 2": {"type": "branch", "value": 7, "children": ["Grandchild 2.1", "Grandchild 2.2"]},
12
+ "Child 3": {"type": "branch", "value": 6, "children": ["Grandchild 3.1"]},
13
+
14
+ "Grandchild 1.1": {"type": "leaf", "value": 3, "children": []},
15
+ "Grandchild 1.2": {"type": "leaf", "value": 4, "children": [], "highlight": True},
16
+
17
+ "Grandchild 2.1": {"type": "branch", "value": 2, "children": ["GreatGrandchild 2.1.1"]},
18
+ "Grandchild 2.2": {"type": "leaf", "value": 4, "children": []},
19
+
20
+ "Grandchild 3.1": {"type": "branch", "value": 5, "children": ["GreatGrandchild 3.1.1", "GreatGrandchild 3.1.2"]},
21
+
22
+ "GreatGrandchild 2.1.1": {"type": "leaf", "value": 1, "children": [], "highlight": True},
23
+ "GreatGrandchild 3.1.1": {"type": "leaf", "value": 2, "children": []},
24
+ "GreatGrandchild 3.1.2": {"type": "leaf", "value": 3, "children": [], "highlight": True},
25
+ }
26
+
27
+ # ---------------------------
28
+ # Positions for layout (x,y)
29
+ # ---------------------------
30
+ positions = {
31
+ "Root": (0, 0),
32
+ "Child 1": (-300, 150),
33
+ "Child 2": (0, 150),
34
+ "Child 3": (300, 150),
35
+
36
+ "Grandchild 1.1": (-400, 300),
37
+ "Grandchild 1.2": (-200, 300),
38
+
39
+ "Grandchild 2.1": (-50, 300),
40
+ "Grandchild 2.2": (50, 300),
41
+
42
+ "Grandchild 3.1": (300, 300),
43
+
44
+ "GreatGrandchild 2.1.1": (-50, 450),
45
+ "GreatGrandchild 3.1.1": (250, 450),
46
+ "GreatGrandchild 3.1.2": (350, 450),
47
+ }
48
+
49
+ colors = {"root": "#ffcc00", "branch": "#66ccff", "leaf": "#99ff99"}
50
+
51
+ # ---------------------------
52
+ # Build Pyvis Network
53
+ # ---------------------------
54
+ #net = Network(height="600px", width="100%", directed=True, notebook=False)
55
+
56
+ net = Network(
57
+ height="600px",
58
+ width="100%",
59
+ directed=True,
60
+ notebook=False,
61
+ cdn_resources='remote' # <-- load JS via CDN, avoids utils.js errors
62
+ )
63
+ net.toggle_physics(False)
64
+
65
+ for name, props in tree_data.items():
66
+ x, y = positions[name]
67
+ node_color = "red" if props.get("highlight") else colors[props["type"]]
68
+ net.add_node(name, label=name, x=x, y=y, fixed=False, color=node_color, size=25)
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>
148
+ </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
+
156
+ // Recursive red propagation
157
+ function updateRedness() {{
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
+ }}
177
+
178
+ // Node click → sidebar
179
+ network.on("click", function(params){{
180
+ hideExpandMenu();
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
+ }}
262
+
263
+ // Initial red calculation
264
+ updateRedness();
265
+ </script>
266
+ """
267
+
268
+ with open("tree.html", "w") as f:
269
+ f.write(html.replace("</body>", extra_js + "</body>"))
270
+
271
+ print("✅ Open tree.html in your browser")
272
+
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: gcc_slycooper50
3
- Version: 0.1.128
3
+ Version: 0.1.130
4
4
  Summary: Get it in.
5
5
  Author-email: sly cooper <slycooper50@gmail.com>
6
6
  License-Expression: MIT
@@ -1,7 +1,7 @@
1
1
  LICENSE
2
2
  README.md
3
3
  pyproject.toml
4
- src/gcc_slycooper50/glad-2.0.8.tar.gz
4
+ src/gcc_slycooper50/tree_app.py
5
5
  src/gcc_slycooper50.egg-info/PKG-INFO
6
6
  src/gcc_slycooper50.egg-info/SOURCES.txt
7
7
  src/gcc_slycooper50.egg-info/dependency_links.txt