radiochart 0.1.0__py3-none-any.whl → 0.2.0__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.
- radiochart/cli.py +35 -4
- {radiochart-0.1.0.dist-info → radiochart-0.2.0.dist-info}/METADATA +1 -1
- radiochart-0.2.0.dist-info/RECORD +7 -0
- radiochart-0.1.0.dist-info/RECORD +0 -7
- {radiochart-0.1.0.dist-info → radiochart-0.2.0.dist-info}/WHEEL +0 -0
- {radiochart-0.1.0.dist-info → radiochart-0.2.0.dist-info}/entry_points.txt +0 -0
- {radiochart-0.1.0.dist-info → radiochart-0.2.0.dist-info}/top_level.txt +0 -0
radiochart/cli.py
CHANGED
@@ -2,21 +2,49 @@ import argparse
|
|
2
2
|
import json
|
3
3
|
from graphviz import Digraph
|
4
4
|
import os
|
5
|
+
import itertools
|
6
|
+
|
7
|
+
# Predefined colors for squads
|
8
|
+
SQUAD_COLORS = [
|
9
|
+
"lightblue",
|
10
|
+
"lightgreen",
|
11
|
+
"lightyellow",
|
12
|
+
"lightpink",
|
13
|
+
"lightcyan",
|
14
|
+
"lightsalmon",
|
15
|
+
"lightgray"
|
16
|
+
]
|
5
17
|
|
6
18
|
def load_json(filepath):
|
7
19
|
with open(filepath, 'r') as f:
|
8
20
|
return json.load(f)
|
9
21
|
|
10
|
-
def
|
22
|
+
def is_squad(name):
|
23
|
+
return "Squad" in name
|
24
|
+
|
25
|
+
def build_graph(tree, graph=None, parent=None, squad_color=None, color_cycle=None):
|
11
26
|
if graph is None:
|
12
27
|
graph = Digraph(format='png')
|
13
|
-
|
28
|
+
# Only set default shape and font globally — no fillcolor here!
|
29
|
+
graph.attr('node', shape='box', fontname='Arial')
|
30
|
+
|
31
|
+
if color_cycle is None:
|
32
|
+
color_cycle = itertools.cycle(SQUAD_COLORS)
|
14
33
|
|
15
34
|
for node, children in tree.items():
|
16
|
-
|
35
|
+
# Assign color for squads and their children
|
36
|
+
if is_squad(node):
|
37
|
+
squad_color = next(color_cycle)
|
38
|
+
|
39
|
+
fillcolor = squad_color if squad_color else "white"
|
40
|
+
# Set fillcolor and style per node (style='filled' enables fillcolor)
|
41
|
+
graph.node(node, style='filled', fillcolor=fillcolor)
|
42
|
+
|
17
43
|
if parent:
|
18
44
|
graph.edge(parent, node)
|
19
|
-
|
45
|
+
|
46
|
+
# Pass the squad color down to children if applicable
|
47
|
+
build_graph(children, graph, node, squad_color, color_cycle)
|
20
48
|
|
21
49
|
return graph
|
22
50
|
|
@@ -32,3 +60,6 @@ def main():
|
|
32
60
|
output_path = os.path.splitext(args.output)[0]
|
33
61
|
graph.render(output_path, cleanup=True)
|
34
62
|
print(f"✅ Chart saved as {output_path}.png")
|
63
|
+
|
64
|
+
if __name__ == "__main__":
|
65
|
+
main()
|
@@ -0,0 +1,7 @@
|
|
1
|
+
radiochart/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
+
radiochart/cli.py,sha256=Hw9fbVl17eUgsI-u9wB8kFrfiZoBfwnuM8NUEle6UnQ,1970
|
3
|
+
radiochart-0.2.0.dist-info/METADATA,sha256=2XG1FVda0OyBr68-uZzq04CUjnpzxq7RKDeqGNSLjZQ,312
|
4
|
+
radiochart-0.2.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
5
|
+
radiochart-0.2.0.dist-info/entry_points.txt,sha256=0YgYH_Sc1VwuKgcS1Vum6VAnn1e4HUyE9JLOHEYEB9w,51
|
6
|
+
radiochart-0.2.0.dist-info/top_level.txt,sha256=Q1BACtGLsnWStOzjTlXfurlbIBu5Wx6sbP-zZtLnXj8,11
|
7
|
+
radiochart-0.2.0.dist-info/RECORD,,
|
@@ -1,7 +0,0 @@
|
|
1
|
-
radiochart/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
2
|
-
radiochart/cli.py,sha256=Z7-3E_D3cs2QhtY6wzlHCNJdyPF4IApsZoQ9ntG_OQ0,1119
|
3
|
-
radiochart-0.1.0.dist-info/METADATA,sha256=wOnW7hqtaTZBSkF9OF_tlQMBxsjUPUsKhCrQUR2Jp4Q,312
|
4
|
-
radiochart-0.1.0.dist-info/WHEEL,sha256=_zCd3N1l69ArxyTb8rzEoP9TpbYXkqRFSNOD5OuxnTs,91
|
5
|
-
radiochart-0.1.0.dist-info/entry_points.txt,sha256=0YgYH_Sc1VwuKgcS1Vum6VAnn1e4HUyE9JLOHEYEB9w,51
|
6
|
-
radiochart-0.1.0.dist-info/top_level.txt,sha256=Q1BACtGLsnWStOzjTlXfurlbIBu5Wx6sbP-zZtLnXj8,11
|
7
|
-
radiochart-0.1.0.dist-info/RECORD,,
|
File without changes
|
File without changes
|
File without changes
|