288 Commits

Author SHA1 Message Date
KV
c47de6be53 Include "tests" folders in the build tool groups
Allow absent "prefix" in group entries to simplify the code
2025-03-01 19:41:27 +01:00
KV
d0e25864b3 Change BOM output file extension from .bom.tsv to .tsv
Complementary changes to the commit with the same title
earlier in the same PR. Avoid refering to the old filenames.
2025-03-01 19:41:27 +01:00
KV
e7902e8f8e Change version string to comply with PEP440
It seems "-dev" (normalized to ".dev") should only be directly followed
by a number for different deveopment releases of the same version.
See full description: https://peps.python.org/pep-0440/
2025-03-01 19:41:27 +01:00
Daniel Rojas
c33a19708c Refactor code (squashed commit)
Refactor connector node generation

Further refactor connector node generation

Rebuild demos

Generate gauge string inside Cable object

WIP: refactor cable node generation

Implement HTML indentation

WIP

More WIP

Remove old stuff, slightly simplify code

Outsource `gv_pin_table()`, simplify padding

Add TODOs

Outsource `set_dot_basics()` and `apply_dot_tweaks()`

Make setting HTML tag attributes easier through `kwargs`

Fix and simplify bgcolor logic

Reactivate cable edge generation

Outsource `gv_edge_wire()`

Make connecting things more object-oriented

Alphabetize HTML tags, improve bgcolor rendering

Make mates object-oriented

Run `autoflake -i`

Run `autoflake -i --remove-all-unused-imports`

Streamline assignment of ports to simple connectors

Implement color objects

Use color objects in WireViz

Re-sort `wv_colors.py`

Make green color darker

Break longer lines not caught by `black`

because they were unbroken strings or comments

Make variable name more expressive

Apply dot tweaks last

Remove unused line

Improve subclassing of components, prepare for BOM refactoring

Clean up

Include nested additional components in BOM

do not add autogenerated designators to BOM

Improve BOM generation (TODO: wires from a bundle)

Prepare `harness.populate_bom()`

Change `description` to `type` in additional BOM item YAML

Define CLI epilog str in single statement

Rename modules, adjust imports, move `build_examples.py`

Restructure and update `.gitignore`

Clarify `wireviz.parse()` input types

Implement BOM population (missing: qty multipliers)

Make `pin_objects` and `wire_objects` dictionaries

Compute qty's of additional components (WIP)

Add qty test file

Adapt `tutorial08.yml` (remove `unit` field)

Add `tabulate` to dependency list (might remove later if not needed)

Sort BOM by category, assign BOM IDs

Rename `Options.color_mode` to `.color_output_mod` for consistency

Change BOM output file extension from `.bom.tsv` to `.tsv`

Implement BOM bubbles

Stop recursive nesting of additional components

Add BOM bubble to additional component list (WIP)

Fix gauge conversion

Fix line breaks in code

Optimize BOM bubble geometry

Implement pin color output

Small issue: GraphViz warning
```
Warning: table size too small for content
```

Add some test files to `tests/` directory

Update test files

Allow multiple colors for components

Implement multiple colors for components, improve multicolor table rendering

Fix color cell implementation

Fix node background color rendering

Add test file for node and title bgcolors

WIP: BOM modes

Add TODO for empty connector pin tables

Comment out BOM modes (WIP) and BOM bubbles

Resume work on BOM

Include part number info in BOM table

Fix BOM output in TSV and HTML

Add bundles' wires' part number info to BOM

Add TODOs

Implement bundle part number rendering

Improve conductor table rendering

Fix additional component BOM table layout

Disable CLI BOM output

Add suggestions from #246

Add suggestions from #186

Add .vscode/ to .gitignore

Fix PyLance problems

Update interim version number

Fix zero-size cell for simple connectors without type

Implement additional parameters dict for components

Implement note for additional components

Thicken additional component table

Add placeholder for add.comp. PN info

Apply black
2025-03-01 19:41:27 +01:00
Daniel Rojas
c73738e041 Bump version to 0.4.1 2024-07-13 13:10:31 +02:00
KV
73f56b2efc Apply black *.py ../../setup.py
black==23.3.0
2024-07-12 19:05:12 +02:00
KV
828de3f118 Apply isort *.py ../../setup.py
isort==5.11.5
2024-07-12 19:04:29 +02:00
KV
ae03bd60e5 Add TODOs about utf-8 encoding/charset (#395) 2024-07-07 16:16:56 +02:00
KV
19cdff1774 Avoid ResourceWarning: unclosed file (#395)
A number of such warnings showed up when running e.g.
PYTHONWARNINGS=always python build_examples.py
PYTHONWARNINGS=always wireviz ../../examples/demo0?.yml
See https://github.com/wireviz/WireViz/pull/309#issuecomment-2170988381

Fix: All open() calls should be in a "with open() as x" statement
to ensure closing the file when exiting the block in any way.
Otherwise, use the new file_read_text() or file_write_text() functions
to read or write the whole utf-8 text file and closing it.
2024-07-07 16:16:56 +02:00
KV
ee1bd7801e Provide more information when raising exception 2024-07-05 18:16:34 +02:00
Martin Rieder
f2a1aa8856 Update comment in src/wireviz/wireviz.py (#392)
Clarify all exceptions catched, including changes in #392

Co-authored-by: kvid <kvid@users.noreply.github.com>
2024-07-05 18:16:34 +02:00
Martin Rieder
0e8ab7a668 Catch also ValueError (#392)
In Windows might ValueError be raised instead of the already
catched exceptions in some cases (depending on the Python version)

Fixes point 2 of https://github.com/wireviz/WireViz/pull/318#pullrequestreview-1457016602
2024-07-05 18:16:34 +02:00
Martin Rieder
42d10dfab4 Catch OSError also with errno=None (#392)
In Windows might OSError(errno = None) be raised instead of the already
catched exceptions in some cases (depending on the Python version)

Fixes #391
2024-07-05 18:16:34 +02:00
kvid
858b2664db Update src/wireviz/wireviz.py (#383)
Raising TypeError is better than assert. (Black reformatted)

Co-authored-by: Andreas Motl <andreas.motl@panodata.org>
2024-07-05 18:23:32 +02:00
KV
5cedba9def Explain unexpeced top-level type (#383)
Might help in reported issues like #342
2024-07-05 18:16:34 +02:00
KV
6d772cf697 Add non-empty label to avoid over-sized loops (#381)
Work-around to improve the #286 use case.
- https://github.com/wireviz/WireViz/issues/286#issuecomment-2094309143
- https://stackoverflow.com/questions/70996779/graphviz-edges-between-cells-in-the-same-html-table-are-too-long
2024-07-05 18:16:34 +02:00
KV
c997bfe19b Rename "sheetsize_default" to <!-- %template_sheetsize% --> (#380)
Fixes #377 (makes HTML output template placeholders more consistent)
2024-07-05 18:16:34 +02:00
KV
6488eb582b Avoid Graphviz error when hiding all pins (#375)
Fixes #257
2024-07-05 18:16:34 +02:00
KV
668ba72975 Avoid decimal point and trailing zero for integer BOM quantities (#374)
Fixes #340
2024-07-05 18:16:34 +02:00
KV
6ba33fb5dc Rename diagram_png_base64 to diagram_png_b64 (#371) 2024-07-05 18:22:24 +02:00
KV
fc7ea088b4 Add HTML output templates README.md (#371)
Describe the HTML Output Templates, how they are specified,
and placeholder usage within these templates.
2024-07-05 18:21:58 +02:00
KV
70a33edca5 Avoid reading diagram file to embed unless used (#371)
Add local replacement_if_used() that call function to read the file
only when needed and append the return value as replacement.
2024-07-05 18:20:57 +02:00
KV
ea26116c81 Add HTML template placeholder for diagram_png_base64 (#371)
This will enable users to replace the SVG diagram with an embedded PNG,
that is an improved work-around when the SVG output from Graphviz
is not looking good. Suggested as work-around for Graphviz bug in
https://github.com/wireviz/WireViz/issues/175#issuecomment-2132206026
2024-07-05 18:16:34 +02:00
KV
f474cddedb Add HTML template placeholders for filename (#371)
This will e.g. enable users to replace the SVG diagram with PNG,
that is needed as a work-around when the SVG output from Graphviz
is not looking good. Suggested as work-around for Graphviz bug in
https://github.com/wireviz/WireViz/issues/175#issuecomment-2132206026
2024-07-05 18:16:34 +02:00
KV
2336231d3e Update APP_URL (#364)
The project was moved into the new organization 2023-05-30, but old
URLs are still working due to automatic redirects by GitHub.

https://github.com/wireviz/WireViz/issues/316#issuecomment-1568748914
2024-07-05 18:16:34 +02:00
Frank Adämmer
a5f91e91b7 Add missing import of embed_svg_images (#363)
Resort module import:

Co-authored-by: kvid <kvid@users.noreply.github.com>
2024-07-05 18:16:34 +02:00
KV
7ae3fb33fd Use output_name as default title (#361)
The CLI handling code was redesigned for v0.4 and it seems the code
to assign a default title from v0.3.1 has been messed up. This bug
has not been triggered by build_examples.py due to it seems to call
the parse() function differently.

The output_name should be used as default title when present.

This will fix the #360 bug report.
2024-07-05 18:16:34 +02:00
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
77061a0656 Handle OSError(errno=EINVAL) that might be raised in Windows (#346)
In Windows might OSError(errno=EINVAL) be raised instead of the already
catched exceptions in some cases (depending on the Python version).

Suggested fix posted by JarrettR in
https://github.com/wireviz/WireViz/issues/344#issuecomment-2113476151

Co-authored-by: JarrettR <jrainier@gmail.com>
2024-07-05 18:16:34 +02:00
Liam Beguin
4d9346a365 Add jinja2 preprocessor stage
Some checks failed
Create Examples / build (3.7) (push) Has been cancelled
Create Examples / build (3.8) (push) Has been cancelled
This allows users to leverage jinja to include other files but also
loops, conditions, and other templating features.

Signed-off-by: Liam Beguin <liambeguin@gmail.com>
2024-06-09 17:53:54 -04:00
KV
9435fc2c2f Create PR to collect changes for v0.4.1-rc 2024-06-08 00:43:57 +02:00
KV
9b2b22d6ae Add check for outdated connector attributes 2024-05-09 16:06:22 +02:00
Daniel Rojas
50d29172ee Remove references for unsupported output formats
Remove the references in the CLI help, but keep the placeholders elsewhere in the code as a TODO
2024-05-09 14:10:19 +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
487498e128 Merge branch 'release/v0.4-rc' into release/v0.4-rc2
`rc2` branch is based directly on `master`. By merging into `rc2`, any merge conflicts can be resolved while leaving `master` intact until final merge is approved.

# Conflicts:
#	docs/CHANGELOG.md
#	src/wireviz/Harness.py
#	src/wireviz/__init__.py
#	src/wireviz/wireviz.py
2024-05-05 15:30:40 +02:00
Daniel Rojas
455d14ea4a Bump version to 0.4 2024-04-16 14:06:53 +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)
848fdf03fb Hide qty 0 additional components from BOM 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
Daniel Rojas
8ba9131a11 Add warning about unconnected components 2024-04-16 10:15:33 +02:00
Daniel Rojas
18782444b1 Make prefix for autogenerated component names configurable
`edotor.net` does not seem to like leading underscores, which makes GraphViz debugging difficult.
2023-09-12 19:37:05 +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
RedshiftVelocities
6f9007f45d
Use portable OS error codes so program doesn't crash (#318)
Hard-coding OS error numbers that differ between different platforms
caused the program to crash at platforms using a different error number.

Using the Standard errno system symbols will avoid this problem.

Co-authored-by: kvid <kvid@users.noreply.github.com>
2023-09-01 22:24:34 +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
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
b0d0070f08 Bump version to 0.3.2 2021-11-27 13:32:40 +01:00