Skip to content

Commit

Permalink
Make shield wires in cable nodes equal as spline shield wires
Browse files Browse the repository at this point in the history
As the spline shield wires are rendered as thin tinned wires with
black borders, and the shield wires in cable nodes were rendered as
a single (bottom) border, they didn't fit well together.

The shield wires in cable nodes are now rendered equally as the spline
shield wires. The shield wire color is moved into a common definition.

This fixes bug #125.
  • Loading branch information
kvid committed Jul 26, 2020
1 parent f2f6548 commit ef41789
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/wireviz/Harness.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@
import re


# shield wires are shown as thin tinned wires
shield_color_hex = wv_colors.get_color_hex('SN')[0]


class Harness:

def __init__(self):
Expand Down Expand Up @@ -230,7 +234,7 @@ def create_graph(self) -> Graph:
for bla in p:
html = html + f'<td>{bla}</td>'
html = f'{html}</tr>'
html = f'{html}<tr><td colspan="{len(p)}" cellpadding="0" height="6" border="2" sides="b" port="ws"></td></tr>'
html = f'{html}<tr><td colspan="{len(p)}" cellpadding="0" height="6" bgcolor="{shield_color_hex}" border="2" sides="tb" port="ws"></td></tr>'

html = f'{html}<tr><td>&nbsp;</td></tr>' # spacer at the end

Expand All @@ -249,7 +253,7 @@ def create_graph(self) -> Graph:
dot.attr('edge', color=':'.join(['#000000'] + wv_colors.get_color_hex(cable.colors[connection_color.via_port - 1], pad=pad) + ['#000000']))
else: # it's a shield connection
# shield is shown as a thin tinned wire
dot.attr('edge', color=':'.join(['#000000', wv_colors.get_color_hex('SN', pad=False)[0], '#000000']))
dot.attr('edge', color=':'.join(['#000000', shield_color_hex, '#000000']))
if connection_color.from_port is not None: # connect to left
from_port = f':p{connection_color.from_port}r' if self.connectors[connection_color.from_name].style != 'simple' else ''
code_left_1 = f'{connection_color.from_name}{from_port}:e'
Expand Down

0 comments on commit ef41789

Please sign in to comment.