481 Commits

Author SHA1 Message Date
Daniel Rojas
152f97cc7b 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

Co-authored-by: kvid <kvid@users.noreply.github.com>
2025-03-01 19:41:28 +01:00
Daniel Rojas
f5c00fa31c Rename "sheetsize_default" to <!-- %template_sheetsize% --> (#380)
Fixes #377 (makes HTML output template placeholders more consistent)

Co-authored-by: kvid <kvid@users.noreply.github.com>
2025-03-01 19:41:28 +01:00
KV
860844574f Add link from syntax.md to HTML output templates (#371) 2025-03-01 19:41:28 +01:00
Daniel Rojas
b06c75bf2f Rename diagram_png_base64 to diagram_png_b64 (#371)
Co-authored-by: kvid <kvid@users.noreply.github.com>
2025-03-01 19:41:28 +01:00
KV
7420718f10 Add HTML output templates README.md (#371)
Describe the HTML Output Templates, how they are specified,
and placeholder usage within these templates.
2025-03-01 19:41:27 +01:00
Daniel Rojas
812c4aa572 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.

Co-authored-by: kvid <kvid@users.noreply.github.com>
2025-03-01 19:41:27 +01:00
Daniel Rojas
6c30d0c40a 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

Co-authored-by: kvid <kvid@users.noreply.github.com>
2025-03-01 19:41:27 +01:00
Daniel Rojas
287c47a65e 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

Co-authored-by: kvid <kvid@users.noreply.github.com>
2025-03-01 19:41:27 +01:00
Daniel Rojas
ceaad3c39a 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

Co-authored-by: kvid <kvid@users.noreply.github.com>
2025-03-01 19:41:27 +01:00
Daniel Rojas
32a62a6dd7 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.

Co-authored-by: kvid <kvid@users.noreply.github.com>
2025-03-01 19:41:27 +01:00
KV
50b190113b Add package_data to to setup() call in setup.py (#347)
Specify all HTML files under templates folder
to be included as package data files.
2025-03-01 19:41:27 +01:00
Daniel Rojas
98e103a0af 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: kvid <kvid@users.noreply.github.com>
Co-authored-by: JarrettR <jrainier@gmail.com>
2025-03-01 19:41:27 +01:00
KV
e73e189131 Update setup.py with all tested python versions (#442) 2025-03-01 19:41:27 +01:00
KV
7d8999b45e Use ubuntu-latest for the supported Python versions (#442)
Use ubuntu-22.04 only for Python 3.7-3.8
by including them separately into the matrix.
2025-03-01 19:41:27 +01:00
Martin Rieder
abbedc4e24 Update deprecated GitHub Actions and add Python versions (#408)
Running 6 different Python versions (3.7 to 3.12) in parallel now.
NOTE: This is in conflict with #309, but can be resolved easily in a later PR.

GitHub Actions require an update:
- actions/upload-artifact@v3 is scheduled for deprecation on November
30, 2024.
- Similarly, v1/v2 are scheduled for deprecation on June 30, 2024.
- Updating this comes with a breaking change in upload-artifact@v4:

Uploading to the same named Artifact multiple times.

Due to how Artifacts are created in this new version, it is no longer
possible to upload to the same named Artifact multiple times. You must
either split the uploads into multiple Artifacts with different names,
or only upload once. Otherwise you will encounter an error.

The artifact .zip files therefore have the python version added to
their name.
2025-03-01 19:41:27 +01:00
Daniel Rojas
fb8c6e94c9 Add documentation on template separator character 2025-03-01 19:41:27 +01:00
Daniel Rojas
2400193435 Add check for outdated connector attributes
Co-authored-by: kvid <kvid@users.noreply.github.com>
2025-03-01 19:41:27 +01:00
Daniel Rojas
701815874c Remove references for unsupported output formats
Remove the references in the CLI help, but keep the placeholders elsewhere in the code as a TODO
2025-03-01 19:41:27 +01:00
Daniel Rojas
0fed30aa05 Apply suggestions from code review
Co-authored-by: kvid <kvid@users.noreply.github.com>
2025-03-01 19:41:27 +01:00
Daniel Rojas
9d1700c4a0 Improve gracefulness when invoking wireviz.parse() without file_out
This happened to be a regression for WireViz-Web [1], which aims to do
as much in memory as possible.

[1] https://github.com/daq-tools/wireviz-web.

kvid rebased and mixed original commit with similar change by Daniel Rojas

Co-authored-by: Andreas Motl <andreas.motl@panodata.org>
Co-authored-by: kvid <kvid@users.noreply.github.com>
2025-03-01 19:41:27 +01:00
Daniel Rojas
7077543600 Adjust tutorial08.yml 2025-03-01 19:41:27 +01:00
Daniel Rojas
fee05a71fc Do not allow negative qty_multiplier
Co-authored-by: kvid <kvid@users.noreply.github.com>
2025-03-01 19:41:27 +01:00
Daniel Rojas
e756d62e50 Add unpopulated option to additional components qty multiplier
Co-authored-by: Jeremy Ruhland (hatchery) <jeremy@goopypanther.org>

squash me
2025-03-01 19:41:27 +01:00
Daniel Rojas
c376c491d4 Update syntax description 2025-03-01 19:41:27 +01:00
Daniel Rojas
d8c6230b85 Add warning about unconnected components 2025-03-01 19:41:27 +01:00
Daniel Rojas
a7e667e9b7 Update changelog
Use version from v0.4.1 master branch.
Fix missing link to v0.4.1 (L8) so it's not forgotten.
2025-03-01 19:41:27 +01:00
Daniel Rojas
400c242c90 Move parse_number_and_unit() and NumberAndUnit definition to wv_utils.py
Remove unused attribute

Remove unused `&&` in GitHub workflow

Remove duplicate `category` attribute

Removed from `Connector` class since it is already defined in the `Component` superclass.

Remove unnecessary casting of `int` to `float`

https://github.com/wireviz/WireViz/pull/251#discussion_r1359000766

Continue work on BOM handling (WIP)
2025-03-01 19:41:27 +01:00
KV
6f6235ad25 Split out class AdditionalBomItem from AdditionalComponent
https://github.com/wireviz/WireViz/pull/251#discussion_r1359055105

No output changed for any examples/tutorial/tests input.
2025-03-01 19:41:27 +01:00
KV
51f730f28c Rename fill_partnumbers() to __post_init__()
https://github.com/wireviz/WireViz/pull/251#discussion_r1358992408
2025-03-01 19:41:27 +01:00
KV
bc01e7c59e Add PN string in gv_additional_component_table() 2025-03-01 19:41:27 +01:00
KV
e4ecf97c1a Avoid wrong function name in warnings 2025-03-01 19:41:27 +01:00
KV
f5f3842fa5 Handle also int colors in colon separated string
Bug: 0x112233:0x445566 in YAML input didn't convert such colors
to #112233:#445566 and the strings where just passed as uppercase
to the .gv file. Hence Graphviz printed warnings about unknown
colors and used black as color instead.

Add test for int as string. Re-ordered if statements to give an
exception when a color has an unknown type.
2025-03-01 19:41:27 +01:00
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
2f737c2371 Prepare for refactoring (squashed commit)
no diff should ocurr as a result of the refactoring

Add `metadata.title` to `demo01.yml`

to avoid diffs later when calling via CLI

Add temporary loop to `demo01`

for debugging purposes

Add `cleanup.sh` (maybe move/delete later? or add commit hook?)

Deprecate Python 3.7, add Python 3.10

Add `devtools.txt`

Add `pyan` to `devtools.txt`

Add sample use to `devtools.txt`
2025-03-01 19:41:27 +01: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
KV
9cb9ede487 Add #256 2023-09-08 21:02:53 +02:00
Andreas Motl
c0590ff20f Update .gitignore (#256)
Add two more folders to be ignored.

- .idea: Used by PyCharm
- .venv: My convention for creating virtualenvs
2023-09-08 20:56:15 +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
23bc184620 Add #318 2023-09-03 00:10:12 +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
KV
5eb208daf5 Fix typo in issue link text 2023-08-27 15:40:28 +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
92af90518c Add v0.3.2 to changelog 2023-06-07 20:55:08 +02:00
Daniel Rojas
509dc75762 Update changelog 2023-06-07 19:56:28 +02:00
Daniel Rojas
0ef285ad13 Fix header levels 2023-06-07 19:26:33 +02:00