Skip to content

Commit

Permalink
Make sure loop connected pins are not hidden (#264)
Browse files Browse the repository at this point in the history
- Resolves #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 2, 2023
1 parent 23bc184 commit 9a39de0
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
2 changes: 1 addition & 1 deletion docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
### Misc. fixes
- Use `isort` and `black` for cleaner code and easier merging ([#248](https://github.com/wireviz/WireViz/pull/248))
- Code improvements ([#246](https://github.com/wireviz/WireViz/pull/246), [#250](https://github.com/wireviz/WireViz/pull/250))
- Bug fix ([#318](https://github.com/wireviz/WireViz/pull/318))
- Bug fixes ([#264](https://github.com/wireviz/WireViz/pull/264), [#318](https://github.com/wireviz/WireViz/pull/318))


## [0.3.2](https://github.com/formatc1702/WireViz/tree/v0.3.2) (2021-11-27)
Expand Down
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 9a39de0

Please sign in to comment.