53 Commits

Author SHA1 Message Date
4e80bf2c76 Add resolve_pin() docstring and loop labels example
Some checks failed
Create Examples / build (ubuntu-22.04, 3.7) (push) Has been cancelled
Create Examples / build (ubuntu-22.04, 3.8) (push) Has been cancelled
Create Examples / build (ubuntu-latest, 3.10) (push) Has been cancelled
Create Examples / build (ubuntu-latest, 3.11) (push) Has been cancelled
Create Examples / build (ubuntu-latest, 3.12) (push) Has been cancelled
Create Examples / build (ubuntu-latest, 3.9) (push) Has been cancelled
- Document return contract, resolution precedence, and type-sensitivity
  note in resolve_pin() docstring
- Add ex17_loop_labels.yml: RS-232 loopback adapter demonstrating
  loops with pin labels, mixed number+label, and label-based connections
2026-02-13 01:17:46 -07:00
48377f3a8d Harden pin resolution for safety-critical correctness
Some checks are pending
Create Examples / build (ubuntu-22.04, 3.7) (push) Waiting to run
Create Examples / build (ubuntu-22.04, 3.8) (push) Waiting to run
Create Examples / build (ubuntu-latest, 3.10) (push) Waiting to run
Create Examples / build (ubuntu-latest, 3.11) (push) Waiting to run
Create Examples / build (ubuntu-latest, 3.12) (push) Waiting to run
Create Examples / build (ubuntu-latest, 3.9) (push) Waiting to run
Code review fixes for the #432 loop-pin-labels feature:

- Fix loop rendering to use port indices instead of pin numbers
  (pre-existing bug: non-sequential pins produced wrong diagram)
- Add duplicate label check to the ambiguity branch in resolve_pin()
- Prevent self-referencing loops (pin looped to itself)
- Fix activate_pin() type annotation to accept Optional[Side]
- Deduplicate pin resolution: Harness.connect() now delegates to
  Connector.resolve_pin() instead of reimplementing the logic
- Add 21-test suite covering all resolution paths and error modes
2026-02-13 00:58:28 -07:00
f5c1b1c87f Allow pin labels in loop definitions (fixes #432)
Some checks are pending
Create Examples / build (ubuntu-22.04, 3.7) (push) Waiting to run
Create Examples / build (ubuntu-22.04, 3.8) (push) Waiting to run
Create Examples / build (ubuntu-latest, 3.10) (push) Waiting to run
Create Examples / build (ubuntu-latest, 3.11) (push) Waiting to run
Create Examples / build (ubuntu-latest, 3.12) (push) Waiting to run
Create Examples / build (ubuntu-latest, 3.9) (push) Waiting to run
Loops now accept pin labels (from pinlabels) in addition to pin
numbers, matching the behavior of the connections section. Labels
are resolved to pin numbers during __post_init__ via the new
Connector.resolve_pin() method, which handles ambiguity checking.
2026-02-13 00:42:09 -07:00
KV
73f56b2efc Apply black *.py ../../setup.py
black==23.3.0
2024-07-12 19:05:12 +02:00
Daniel Rojas
591ae7f84a
Apply suggestions from code review
Co-authored-by: kvid <kvid@users.noreply.github.com>
2024-05-09 10:53:32 +02:00
Daniel Rojas
55c6ab51f1 Apply black 2024-05-05 15:50:59 +02:00
Daniel Rojas
fdb75693dd Fix but in additional component description generation 2024-04-16 14:05:25 +02:00
Daniel Rojas
f98bf2afec Do not allow negative qty_multiplier
Co-authored-by: kvid <kvid@users.noreply.github.com>
2024-04-16 13:46:46 +02:00
Jeremy Ruhland (hatchery)
df4a4188ba Add unpopulated option to additional components qty multiplier 2024-04-16 13:46:46 +02:00
kvid
a26f734b94 Update src/wireviz/DataClasses.py as requested in review (#264)
No need to reference github issue in the code.

Co-authored-by: Daniel Rojas <github@danielrojas.net>
2023-09-08 17:37:25 +02:00
KV
f6c3a37563 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.
2023-09-08 17:37:25 +02:00
KV
f9d1dd0148 Fix bug commented in #186
Changes in #186 made it impossible to hide cable wire numbers.

https://github.com/wireviz/WireViz/pull/186#discussion_r716246852
2023-08-27 15:47:08 +02:00
Daniel Rojas
ba3f0248a5 Simplify Enum 2021-10-16 22:58:47 +02:00
Daniel Rojas
45bcc1dd45 Make template separator character user-configurable 2021-10-16 22:27:00 +02:00
Daniel Rojas
c89cf735ae Apply some manual fixes, reapply black 2021-10-16 22:09:59 +02:00
Daniel Rojas
f92985a61c Apply black 2021-10-16 22:09:59 +02:00
Daniel Rojas
344615483a Apply isort 2021-10-16 22:09:59 +02:00
Daniel Rojas
3a181f6f95 Fix smart file resolver for images 2021-10-16 22:08:01 +02:00
Daniel Rojas
6b1e274d57 Refactor functions for harness building
- Use pin names instead of pin indices, until the last moment when generating the ports for the GraphViz nodes
- `Harness.add_mate_pin()` now uses pin names
- Remove unused `if is_arrow()` check from `Harness.connect()`
- Consolidate calling of `Connector.activate_pin()` to prevent subtle bugs
  - Call it from `connect()` and `add_mate_pin()`
  - No longer call it from `create_graph()`
- Misc. other tuning
2021-10-16 21:46:31 +02:00
Daniel Rojas
8ea8248721 Squash feature/mate+autogenerate branch 2021-10-13 21:38:23 +02:00
Daniel Rojas
3cc36e1573 Harmonize shebangs and encoding info
- Use `#!/usr/bin/env python3` on executable modules
- Remove shebangs on all other `.py` files
- Add UTF-8 encoding info where mising
2021-10-11 20:05:52 +02:00
KV
7125f28760 Move color type aliases into wv_colors.py to avoid circular imports 2021-09-28 19:14:28 +02:00
KV
166ab2fdf1 Support bgcolor of additional components
Maybe not needed that much, but mainly for consistency, to support
bgcolor in all dataclasses that represent boxes in the diagram.
2021-09-28 19:14:28 +02:00
KV
324508a8ee Support image.bgcolor to enable adapting to image colors 2021-09-28 19:14:28 +02:00
KV
45d7d03fe0 Support both bgcolor and bgcolor_title attributes
Solves #210 completely by supporting bgcolor of both the node title
and the whole node independently using separate attributes.
2021-09-28 19:14:28 +02:00
KV
dbccb77b08 Add bgcolor attribute to connectors and cables
This solves the #210 suggestion to render the title row of
the graph nodes with this bgcolor.
2021-09-28 19:14:28 +02:00
Daniel Rojas
a3eefe6659
Implement suppliers and supplier part numbers (#241)
Co-authored-by: kvid <kvid@users.noreply.github.com>
2021-09-14 19:29:59 +02:00
kvid
db05514469
Add optional tweaking of the .gv output (#215)
Co-authored-by: Daniel Rojas <github@danielrojas.net>
2021-09-14 19:20:51 +02:00
kvid
92354e6852
Add basic options and metadata (#214) 2021-08-25 19:46:37 +02:00
Daniel Rojas
e212fc9058
Use unique index for connector pin ports (#229)
Closes #160.

Co-authored-by: kvid <kvid@users.noreply.github.com>
2021-08-23 19:26:23 +02:00
gopiballava
c0a885a800 Correctly check for default of None
If `show_wirenumbers` is omitted from a cable section, its value will be `None`. In that case, we want to choose a default based on whether this is a bundle or not.

If the user did specify `show_wirenumbers`, then its value will be `True` or `False`, and we want to respect that whether it's a bundle or not.
2021-03-20 11:09:13 +01:00
kvid
da56841290
Assign the default cable length unit when not present (#206)
Bug: Failing to assign the default cable length unit when not present.
It was introduced in #198.

Fix: Test the correct cable attribute. This fix solves issue #205.
2020-12-29 13:31:55 +01:00
Daniel Rojas
606ddbf977
Detect and assign unit within cable length attribute (#198)
Co-authored-by: kvid <kvid@users.noreply.github.com>
2020-12-13 12:39:29 +01:00
William Sutton
dec64abaf5 Add support for wire length units
Based on #161, #162, #171.

Co-authored-by: stevegt <stevegt@t7a.org>
Co-authored-by: kvid <kvid@users.noreply.github.com>
2020-11-16 17:14:46 +01:00
Daniel Rojas
96bd121403 Create separate modules for BOM and HTML functions 2020-11-15 08:42:57 +01:00
Daniel Rojas
03e6077512 Allow referencing wires by color/label (#169,#193) 2020-11-14 23:21:08 +01:00
Daniel Rojas
feff47f47b
Add option to add colors to connector pins (#141) 2020-11-14 09:43:01 +01:00
KV
64bd34a7c6 Add type aliases that reflect their semantics
Using Any or str in type annotations might increase the need for extra
comments to explain the real valid values. However, such needs can be
drastically reduced with the help of semanticly named type aliases.

Each type alias have their legal values described in comments.
Actual validation might be implemented in the future.
2020-11-01 15:26:11 +01:00
KV
3f091bb419 Update the types of dataclass attributes according to usage
Fixes #156
2020-11-01 15:26:11 +01:00
Tyler Ward
e85ee5d285
Allow addittional BOM items within components (#115) 2020-10-22 17:53:33 +02:00
kvid
4782da47c9
Add optional image to connectors and cables (#153)
This image, with an optional caption below, is displayed in the lower 
section of the connector/cable node in the diagram - just above the 
notes if present.

This solves the basic part of issue #27, and is a continuation of 
PR #137 that was closed due to changes in the base branch.
2020-10-14 16:08:16 +02:00
Daniel Rojas
43f85aedb2 Add color attribute to cables 2020-08-13 17:21:42 +02:00
Daniel Rojas
79e751dca8 Remove obsolete code 2020-08-13 17:21:42 +02:00
Tyler Ward
b9a4783b6f
Shorten BOM field names (#121)
- Shorten `part_number` to `pn`
- Shorten `manufacturer_part_number` to `mpn`
- Show `manufacturer` and `mpn` in a single cell of the node
- Replace `manufacturer` with `'MPN'`within the node if no manufacturer is specified.
- Rearrange order of P/N fields within node
  `{pn} | {manufacturer}: {mpn}`
2020-07-26 16:50:11 +02:00
Daniel Rojas
a1881eb49d Rename connector attributes (#77)
Rename `pinnumbers` to `pins`.
Rename `pinout` to `pinlabels`.
2020-07-21 22:01:10 +02:00
Daniel Rojas
831b423c03 Eliminate ferrule category, unify connectors (#78) 2020-07-20 08:21:54 +02:00
Daniel Rojas
9e11051cac Simplify connector loop code 2020-07-11 11:53:29 +02:00
Daniel Rojas
b4791900f2 Make connecting components together easier and more flexible
Closes #67.

- Allow defining arbitrarily long lists of alternating connectors and cables in a connection set.
- Start work towards removing 'ferrules' as special case, merging them with normal connectors
- Stramline auto-generation of simple, one pin connectors (ferrules, wire splices, ...)
2020-07-10 18:53:32 +02:00
Daniel Rojas
6a2924fa12 Check for duplicate pin numbers and raise an exception
Closes #72.
2020-07-09 18:10:38 +02:00
Tyler Ward
c200f66009 Merged in refactoring changes from upstream 2020-07-02 00:50:48 +01:00