Skip to content

Commit

Permalink
Make sure loop connected pins are not hidden (wireviz#264)
Browse files Browse the repository at this point in the history
- Resolves wireviz#263 that describes warnings and weird loop drawing because
  loop connected pins are hidden when hide_disconnected_pins=True.

- Activate loop pins as early as possible to enable correct counting of
  connected pins when
  connector.additional_components.qty_multiplier=populated.

- Check that loop pins actually exist before activating them.
  • Loading branch information
kvid committed Sep 1, 2023
1 parent 6f9007f commit 6aa0c58
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion src/wireviz/DataClasses.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,11 +204,16 @@ def __post_init__(self) -> None:
self.show_pincount = self.style != "simple"

for loop in self.loops:
# TODO: check that pins to connect actually exist
# TODO: allow using pin labels in addition to pin numbers, just like when defining regular connections
# TODO: include properties of wire used to create the loop
if len(loop) != 2:
raise Exception("Loops must be between exactly two pins!")
for pin in loop:
if pin not in self.pins:
raise Exception(f'Unknown loop pin "{pin}" for connector "{self.name}"!')
# Resolve https://github.com/formatc1702/WireViz/issues/263
# Make sure loop connected pins are not hidden.
self.activate_pin(pin)

for i, item in enumerate(self.additional_components):
if isinstance(item, dict):
Expand Down

0 comments on commit 6aa0c58

Please sign in to comment.