# SPDX-License-Identifier: AGPL-3.0-or-later import pygraphviz as pgv def draw_setup(computers, networks, destination=None, icon_prefix = '../../../static/icons/', format='svg', icon_path = '', icon_suffix = None): if icon_suffix is None: icon_suffix = format icon_suffix = '.' + icon_suffix G = pgv.AGraph(imagepath=icon_path + '/') print(G.graph_attr) have_internet = [] for net in networks: net_name = net.get('name', 'net') if net.get('public', False): have_internet.append(net_name) G.add_node('net-' + net_name, label=net_name, shape='rectangle') if len(have_internet): G.add_node('net-' + 'internet', label='internet', labelloc='b', image=icon_prefix + 'internet' + icon_suffix, shape='none') for n in have_internet: G.add_edge('net-' + n, 'net-internet') for properties in computers: c = properties.get('name', '') label_str = '<
{} | |
{} |