Skip to content

Commit

Permalink
Avoid href=None for edges
Browse files Browse the repository at this point in the history
It seems that Graphviz then uses the href value from a previous edge!
  • Loading branch information
kvid committed Nov 24, 2020
1 parent 4ee9286 commit c3bcaf7
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/wireviz/Harness.py
Original file line number Diff line number Diff line change
Expand Up @@ -288,13 +288,14 @@ def create_graph(self) -> Graph:

# connections
for connection in cable.connections:
# Avoid href=None for edges as it seems that Graphviz then uses the href value from a previous edge!
if isinstance(connection.via_port, int): # check if it's an actual wire and not a shield
dot.attr('edge', color=':'.join(['#000000'] + wv_colors.get_color_hex(cable.colors[connection.via_port - 1], pad=pad) + ['#000000']),
href=index_if_list(cable.url, connection.via_port - 1))
href=index_if_list(cable.url, connection.via_port - 1) or '')
else: # it's a shield connection
# shield is shown with specified color and black borders, or as a thin black wire otherwise
dot.attr('edge', color=':'.join(['#000000', shield_color_hex, '#000000']) if isinstance(cable.shield, str) else '#000000',
href=cable.url if isinstance(cable.url, str) else None)
href=cable.url if isinstance(cable.url, str) else '')
if connection.from_port is not None: # connect to left
from_connector = self.connectors[connection.from_name]
from_port = f':p{connection.from_port}r' if from_connector.style != 'simple' else ''
Expand Down

0 comments on commit c3bcaf7

Please sign in to comment.