From 7e2339e74cd686b011875aa9b860e61e959753d9 Mon Sep 17 00:00:00 2001 From: Daniel Rojas Date: Sun, 22 Aug 2021 19:01:20 +0200 Subject: [PATCH] Make internal pin IDs start from 1 instead of 0 so that in the standard case, internal pin IDs match the actual connector's pin numbers, which usually start from 1. Co-authored-by: kvid --- src/wireviz/Harness.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/wireviz/Harness.py b/src/wireviz/Harness.py index 14a48ad..69bc9a9 100644 --- a/src/wireviz/Harness.py +++ b/src/wireviz/Harness.py @@ -143,7 +143,7 @@ class Harness: continue pinhtml.append(' ') if connector.ports_left: - pinhtml.append(f' {pinname}') + pinhtml.append(f' {pinname}') if pinlabel: pinhtml.append(f' {pinlabel}') if connector.pincolors: @@ -158,7 +158,7 @@ class Harness: pinhtml.append( ' ') if connector.ports_right: - pinhtml.append(f' {pinname}') + pinhtml.append(f' {pinname}') pinhtml.append(' ') pinhtml.append(' ') @@ -301,7 +301,7 @@ class Harness: dot.attr('edge', color=':'.join(['#000000', shield_color_hex, '#000000']) if isinstance(cable.shield, str) else '#000000') 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 '' + from_port = f':p{connection.from_port+1}r' if from_connector.style != 'simple' else '' code_left_1 = f'{connection.from_name}{from_port}:e' code_left_2 = f'{cable.name}:w{connection.via_port}:w' dot.edge(code_left_1, code_left_2) @@ -318,7 +318,7 @@ class Harness: if connection.to_port is not None: # connect to right to_connector = self.connectors[connection.to_name] code_right_1 = f'{cable.name}:w{connection.via_port}:e' - to_port = f':p{connection.to_port}l' if self.connectors[connection.to_name].style != 'simple' else '' + to_port = f':p{connection.to_port+1}l' if self.connectors[connection.to_name].style != 'simple' else '' code_right_2 = f'{connection.to_name}{to_port}:w' dot.edge(code_right_1, code_right_2) if to_connector.show_name: