Make sure loop connected pins are not hidden (#264)

- 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.
This commit is contained in:
KV 2021-12-28 19:04:28 +01:00 committed by kvid
parent 23bc184620
commit f6c3a37563
2 changed files with 7 additions and 2 deletions

View File

@ -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)

View File

@ -204,11 +204,16 @@ class Connector:
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):