337 Commits

Author SHA1 Message Date
KV
0f3b5e9edf Skip assignment and return expression directly 2020-12-30 08:46:00 +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
eebf932c8d Show pin labels of adjacent connectors in cable node (#70) 2020-11-14 23:21:08 +01:00
Daniel Rojas
3bf448c692 Update example 08 to reference wires using colors 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
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
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
Daniel Rojas
4e4dac8597 Bump version to 0.3-dev 2020-10-17 11:53:11 +02:00
Daniel Rojas
b2d1a29cc2 Rebuild all examples with v0.2 2020-10-17 11:42:30 +02:00
Daniel Rojas
3e570d648f Bump version to 0.2 2020-10-17 11:41:27 +02:00
Daniel Rojas
6db1fcf0fe Improve documentation
- Create `docs/` directory
- Add syntax description (`syntax.md`)
- Track changes since first release (`CHANGELOG.md`)
- Expand contribution guidelines (`CONTRIBUTING.md`)
- Improve main readme (`README.md`)
- Add documentation for build script (`buildscript.md`)
2020-10-16 23:13:56 +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
KV
7df8a4b7cf Add command line options to show version number
Add -V command line option (and --version as an alias) to
both wireviz.py and build_examples.py that show version number.

Move the version number from setup.py into __init__.py to access
the same version number specification from all files needing it.

This solves part 4 of issue #167.
2020-10-11 13:37:34 +02:00
KV
c4957f1475 Comment out unimplemented command line option
It seems, that the current implementation ignores --generate-bom,
and that parser.add_argument() code line is therefore commented
out until it gets implemented to avoid any confusion.

This solves part 1 of issue #167.
2020-10-11 13:37:34 +02:00
KV
83a467a4aa Add diff as an alias to the compare command
When used to "git diff", it is easy to write "build_examples.py diff"
instead of "build_examples.py compare" by a mistake. Therefore,
"diff" is now an alias to "compare" so both commands will work.

This solves part 3 of issue #167.
2020-10-11 13:37:34 +02:00
KV
b14f5cba19 Add -b BRANCH argument to the compare and restore commands
Adding an optional -b BRANCH argument to build_examples.py to enable
comparing to and restoring from any branch or commit. That will help
when e.g. reversing an unfortunate commit of generated files.

This solves part 2 of issue #167.
2020-10-11 13:37:34 +02:00
Daniel Rojas
df90d8326a
Add .gitattributes for GitHub Linguist (#154) 2020-08-22 18:49:39 +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
79e751dca8 Remove obsolete code 2020-08-13 17:21:42 +02:00
Marc Brückner
19b82e9662 fix #149 introduced in #147 2020-08-12 18:06:06 +02:00
Marc Brückner
84edda64df
Extend unknown color error message (#147) 2020-08-10 20:13:13 +02:00
Daniel Rojas
4802705427 Improve handling of strings with '-' in wv_helper.expand()
Fixes #139
2020-08-10 17:04:23 +02:00
KV
9a3b8bce6e Add 25-pair comments and split lines according to coloring pattern
The coloring pattern is briefly explained. By splitting the source
code lines into 10 pairs per line, the pattern is more easily seen.
2020-08-10 16:51:17 +02:00
KV
113a7310e1 Replace 20 YW color codes with YE to avoid Unknown color specified
Fixes bug #144
2020-08-10 16:51:17 +02:00
Daniel Rojas
23c17e66bf Change wire padding behavior
Addresses #131
2020-07-27 22:40:59 +02:00
KV
99ca1859eb Fix change requests from owner as descibed in PR #118
- Add double quotes around path string in `os.system()` call and
  status output to handle any spaces in the path.
- Split the `generated_extensions` list into the two lists
  `extensions_not_containing_graphviz_output` and
  `extensions_containing_graphviz_output` for readability.
2020-07-27 20:14:14 +02:00
KV
21db0d509e Add CLI option -c that allows comparing Graphviz output also 2020-07-27 20:14:14 +02:00
KV
378e13b988 Move group loop into build_generated() for consistency
Now, all action functions are called with a group list as argument.
2020-07-27 20:14:14 +02:00
KV
94ca9cc358 Restructure the group dict initialization
By putting all value entries on separate lines with a trailing comma,
it becomes easier to read the diff when later inserting or deleting
the first or last value entry in any dict.
2020-07-27 20:14:14 +02:00
KV
476f85bcf5 Make all actions honor the optional argument -g or --group
This make it possible to append '-g' or '--groups' followed by
space separated group names to any CLI action command, and the
set of generated files affected by the command will be limited
to the selected groups ('examples', 'tutorial', and 'demos').
Default is all groups. A simple help text is added for each of
the arguments (action and groups) to improve the autogenerated
CLI help output.

This is a squash rebase of these commits:
- p ec29076 Make all actions honor the optional argument -generate
- s e3ad11a Move open_file_append() outside the if to avoid re-open
- s ba4b900 Avoid including readme in all file groups
- s 1ca8bd1 Simplify code
- s a9e7337 Rename some variables to better reflect their contents and relations
- s 58a54b2 Move test to include readme inside collect_filenames() function
- s f2a0db0 Improve status output by adding group name
- s d3b299b Rename -generate option to -g/--groups and add argument help
2020-07-27 20:14:14 +02:00
KV
4eedd94164 Add actions to compare against and restore from the latest commit
Add new actions:
- 'compare' action to compare generated files (except those
  generated by Graphviz) against the latest commit, and
- 'restore' action to restore generated files from the latest commit.

This is a squash rebase of these commits:
- p 9ad3e13 Reduce code duplication by moving common code into a generic function
- s d4feae6 Add action to restore generated files from git repository
- s 64f6507 Add action to compare generated files against git repository
- s 099c202 Simplify code
2020-07-27 20:14:14 +02:00
Daniel Rojas
3fa015cabd Refactor build_examples.py
- Use `pathlib.Path` instead of `os.path`
- Fix order of files while building
- Consolidate code for building demos, examples and tutorial
- Change argument from `tutorials` to `tutorial` to remain consistent
- Add some indentation in console output for better readability
2020-07-27 20:14:14 +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
f2f654854a Update README.md
Denote that WireViz reads and writes files in UTF-8 (or UTF-8 compatible) encodings, to disclaim against non UTF-8 input files.
2020-07-21 22:29:38 +02:00