52 Commits

Author SHA1 Message Date
Daniel Rojas
c2fb59f937
Use color objects in WireViz 2023-01-19 16:36:35 -05:00
Daniel Rojas
d4fc17408b
Run autoflake -i --remove-all-unused-imports 2023-01-19 16:36:33 -05:00
Daniel Rojas
539e9e3869
Run autoflake -i 2023-01-19 16:36:32 -05:00
Daniel Rojas
974e9a4abd
Make mates object-oriented 2023-01-19 16:36:32 -05:00
Daniel Rojas
efda8fa219
Make connecting things more object-oriented 2023-01-19 16:36:31 -05:00
Daniel Rojas
7c0e75f45e
Outsource gv_pin_table(), simplify padding 2023-01-19 16:36:28 -05:00
Daniel Rojas
d993f58685
More WIP 2023-01-19 16:36:27 -05:00
Daniel Rojas
c8690a99c9
WIP 2023-01-19 16:36:27 -05:00
Daniel Rojas
4eff1de6f7
Generate gauge string inside Cable object 2023-01-19 16:36:26 -05:00
Daniel Rojas
77080c90a2
Refactor connector node generation 2023-01-19 16:36:25 -05:00
Daniel Rojas
81b0dba858
Make prefix for autogenerated component names configurable
`edotor.net` does not seem to like leading underscores, which makes GraphViz debugging difficult.
2023-01-19 16:36:23 -05:00
Daniel Rojas
abd53ec404
Simplify Enum 2023-01-19 16:36:22 -05:00
Daniel Rojas
fbc90c0475
Make template separator character user-configurable 2023-01-19 16:36:21 -05:00
Daniel Rojas
a255596471
Apply some manual fixes, reapply black 2023-01-19 16:36:17 -05:00
Daniel Rojas
343cd2949f
Apply black 2023-01-19 16:36:17 -05:00
Daniel Rojas
e6f76f9ab7
Apply isort 2023-01-19 16:35:25 -05:00
Daniel Rojas
97207e6986
Fix smart file resolver for images 2023-01-19 16:35:21 -05:00
Daniel Rojas
d44b649fcc
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
2023-01-19 16:35:11 -05:00
Daniel Rojas
e3fbc91312
Squash feature/mate+autogenerate branch 2023-01-19 16:35:08 -05: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
Andreas Nordin
08e53bcd48
Feature: bidirectional AWG/mm2 unit conversion (#41)
* Fix AWG<-> mm2 conversions

Add an inverted dictionary and a lookup function from awg -> mm2. Also
do some minor refactoring. Both sides of the conversion table were
converted to strings, since '0000' and '2/0' are perfectly valid AWG
values.

* Update example ex02 with awg -> mm2 conversion

Show conversions for ex02, and make sure it displays conversions in both
directions. Rebuild the example files.

* Fix faulty conversion of non-(mm2,AWG) units

The parsing allows arbitrary units to be used for cable dimensions --
this might be valid units, e.g. square inches, or invalid, e.g. bananas.
We only allow conversion between mm2 and AWG, so check that the
gauge_unit is either of those before conversion. If not, pass through as
is.

* Fix AWG string casing in output

Convert e.g. 'awg, 'AwG' to upper case for consistent rendering. Leave
any other input gauge units as they were.

Co-authored-by: Daniel Rojas <github@danielrojas.net>
2020-06-29 14:41:45 +02:00