89 Commits

Author SHA1 Message Date
KV
82751e439e Move mates processing above tweak processing (#358)
Bug: Not all generated dot output could be changed by tweak entries.
Seen in https://github.com/wireviz/WireViz/issues/325#issuecomment-2116395221

Tweak processing must be the very last dot producing code to enable
tweaking any dot output.

Fix: Move all other dot producing code above Tweak processing.
2024-07-05 18:16:34 +02:00
KV
557122c4a3 Look-up mated connectors before mate processing (#358)
Symptom reported in #355: Unable to connect an arrow (mate) to
pins higher than 1 without failing: ValueError: X is not in list

Bug: The code processing mates used a mix of repeated connector
look-ups and local connector variables, and one variable was used
before it was assigned the correct value.

Fix: The local connector variables are now both assigned initially
before processing each mate, and used when processing instead of
repeated connector look-ups.
2024-07-05 18:16:34 +02:00
KV
9b2b22d6ae Add check for outdated connector attributes 2024-05-09 16:06:22 +02:00
Daniel Rojas
55c6ab51f1 Apply black 2024-05-05 15:50:59 +02:00
Julien Lecoeur
9dbf4538fd Fix graphviz file header (#261)
The two header comments were missing trailing newlines.

This behavior is introduced by v0.18 of the graphviz Python package;
where as v0.17 did include the newline automatically.

Closes #258
2023-08-27 15:31:17 +02:00
Daniel Rojas
6f9bb67d02 Embed images into SVG output 2021-10-16 22:39:41 +02:00
Daniel Rojas
d19c260940 Simplify file access operations 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
65b8e36fe5 Create cache of graph to avoid generating it more than once 2021-10-16 22:08:01 +02:00
Daniel Rojas
b1fa2b9de9 Do not output .gv files by default 2021-10-16 22:08:01 +02:00
Daniel Rojas
d3e99abaa8 Only output requested file types (closes #60) 2021-10-16 22:08:00 +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
02a800abef Fix bug of arrows using the wrong port IDs 2021-10-14 18:03:18 +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
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
KV
7546991b04 Show connector pins even when all are unconnected
Bug: Hiding connector pins when none are connected is not reasonable.
When combined with loops or neither pinlabels nor pincolors, then
exceptions are raised as well.

Fix: Forcing pins at the left side in such cases solves #217.
2021-03-20 11:11:11 +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
eebf932c8d Show pin labels of adjacent connectors in cable node (#70) 2020-11-14 23:21:08 +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
Miklos Marton
e2e8bbfb91 Remove input text hyperlinks except in the HTML BOM
GraphViz does not support the a HTML tag when generating the tables for the
cables/connectors, so this change will remove these tags for the graph generation.
However for the HTML BOM output table these links will be generated.
2020-10-22 23:08:13 +02:00
Tyler Ward
e85ee5d285
Allow addittional BOM items within components (#115) 2020-10-22 17:53:33 +02:00
KV
fb17eae7a6 Avoid errors from HTML validator
The https://validator.w3.org/ reported Errors:
The align attribute on the th/td element is obsolete. Use CSS instead.

By replacing align="X" attributes with text-align:X; CSS equivalent,
the validator now completes without any errors or warnings.

This solves the remaining issues from #97.
2020-10-16 22:02:15 +02:00
KV
7dcd1a7eeb Define application name and URL only once
The application name and URL was defined several places in the code,
and the name was not written exactly the same everywhere.

By using the same constants everywhere, consistency is obtained.
2020-10-16 22:02:15 +02:00
KV
b00040cdd9 Add version number to output files with meta info
Tag the .gv and .html output files with generator and version number.
2020-10-16 22:02:15 +02:00
KV
1809f73d58 Simplify colorbar using the same technique as html_image()
Moving common code into html_colorbar() helper function.
2020-10-14 22:37:20 +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
e3fb39f5ae Add whitespace to GraphViz HTML for readability 2020-08-13 17:21:42 +02:00
Daniel Rojas
94faec536e Rebuild GV HTML generation using lists
Simplify code

remove superfluous temporary variables `pinlist`, `wirerow`

Add suggested changes
2020-08-13 17:21:42 +02:00
Daniel Rojas
af196dfd8c Improve line break handling 2020-08-13 17:21:42 +02:00
Daniel Rojas
102c7d6113 Simplify code and rename variables
Improve code based on review

Suggestions by @kvid
2020-08-13 17:21:42 +02:00
Daniel Rojas
43f85aedb2 Add color attribute to cables 2020-08-13 17:21:42 +02:00
Daniel Rojas
2639c77360 Refactor cable GraphViz HTML generation
to match the one for connectors.
2020-08-13 17:21:42 +02:00
Daniel Rojas
23c17e66bf Change wire padding behavior
Addresses #131
2020-07-27 22:40:59 +02:00
KV
1815a13cd6 Make each shield wire uniform and allow cable.shield color
As the spline shield wires were rendered as tinned wires with
black borders, and the shield wires in cable nodes were rendered
as a single (bottom) border, they didn't fit well together.

Each shield wire is now rendered equally along the spline sections
and in cable nodes. If cable.shield is true, they are rendered as
thin black wires in the same way as before multi-colors were
introduced. The new feature is that cable.shield is allowed to
contain a two-letter color code to specify a colored shield wire
with black borders.

The shield wire thickness is not increased, even if the cable has
some multi-colored wires that makes all other wires to increase.

This fixes bug #125.
2020-07-27 20:11:47 +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
b028e7a22b
Fix node rendering for cables with hidden name and/or no visible attributes (#104)
Closes #69.
2020-07-20 14:24:39 +02:00
Jason
a418005c2e
Fix superscript 2 in HTML output (#95)
Change `<sup></sup>` to `&sup2;`
2020-07-20 13:19:04 +02:00
Daniel Rojas
831b423c03 Eliminate ferrule category, unify connectors (#78) 2020-07-20 08:21:54 +02:00
Daniel Rojas
8cba79334c Disable color padding for cables with no multicolor wires 2020-07-19 19:03:07 +02:00