Improved graph layout.

This commit is contained in:
Sleepy Monax 2023-02-06 13:25:12 +01:00
parent 59e4bc424e
commit ce48c48abd
2 changed files with 12 additions and 8 deletions

View file

@ -3,20 +3,23 @@ from graphviz import Digraph
from osdk.context import Context
def view(context: Context):
def view(context: Context, showExe: bool = False):
g = Digraph(context.target.id, filename='graph.gv')
g.attr('graph', splines='ortho', concentrate='true')
g.attr('node', shape='ellipse')
for instance in context.instances:
if not instance.isLib():
if not instance.isLib() and not showExe:
continue
g.node(instance.manifest.id, f"<<B>{instance.manifest.id}</B><BR/>{instance.manifest.decription}>",
shape="plaintext", style="filled")
for req in instance.manifest.requires:
g.edge(req, instance.manifest.id)
for req in instance.manifest.provides:
g.node(instance.manifest.id, f"<<B>{instance.manifest.id}</B><BR/>{instance.manifest.decription}>",
shape="plaintext", style="filled", fillcolor="lightgrey" if instance.isLib() else "lightblue")
for req in instance.manifest.requires:
g.edge(instance.manifest.id, req)
for req in instance.manifest.provides:
g.edge(req, instance.manifest.id)
g.view(filename=f"{context.builddir()}/graph.gv")

View file

@ -1 +1,2 @@
requests ~= 2.28.0
graphviz ~= 0.20.1