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
* Skip assignment and return expression directly
* Simplify get_bom_index() parameters
- Use the actual BOM as first parameter instead of the whole harness.
- Use a whole AdditionalComponent as second parameter instead of each
attribute separately.
* Use the same lambda in get_bom_index() as for deduplicating BOM
Move the lambda declaration out of the function scope for common
access from two different functions.
* Convert dataclass object to dict to use the same lambda
* Redefine the common lambda to an ordinary function
* Simplify BOM header row logic
* Simplify collecting designators for a joined BOM entry
Assign input designators once to a temporary variable for easy reusage.
* Simplify deduplication and sorting of collected designators
* Remove parentheses around return expressions
https://stackoverflow.com/questions/4978567/should-a-return-statement-have-parentheses
* Move out code from inner loop into helper functions
* Move BOM sorting above grouping to use groupby()
- Use one common entry loop to consume iterator only once.
- Use same key function for sort() and groupby(),
except replace None with empty string when sorting.
* Make the BOM grouping function return string tuple for sorting
* Use a generator expressions and raise exception if failing
Seems to be the most popular search alternative:
https://stackoverflow.com/questions/8653516/python-list-of-dictionaries-search
Raising StopIteration if not found is better than returning None
to detect such an internal error more easily.
* Replace accumulation loop with sum expressions
Make a list from the group iterator for reusage in sum expressions
and to pick first group entry. The expected group sizes are very small,
so performance loss by creating a temporary list should be neglectable.
Alternativly, itertools.tee(group, 3) could be called to triplicate
the iterator, but it was not chosen for readability reasons.
* Add function type hints and doc strings
* Add BOMEntry type alias
This type alias describes the possible types of keys and values in
the dict representing a BOM entry.
* Rename extra variable to part for consistency
* Build output string in one big expression
Build output string in component_table_entry() as the similar strings
in generate_bom(). Repeating a couple of minor if-expressions is small
cost to obtain a more compact and readable main expression.
* Move default qty value=1 to BOM deduplication
* Eliminate local variable
* Rename the 'item' key to 'description' in all BOMEntry dicts
This way, both BOM and harness.additional_bom_items uses the same
set of keys in their dict entries. This was originally suggested
in a #115 review, but had too many issues to be implemented then.
* Move repeated code into new optional_fields() function
* Group common function arguments into a dict
* Revert "Use a generator expressions and raise exception if failing"
This reverts commit 96d393dfb757afc61ffb319c34035d8d2ce7c33d.
However, raising an exception if failing the BOM index search is still
wanted, so a custom exception is raised instead of returning None.
* Use new BOMKey type alias for get_bom_index() target argument
Replace the get_bom_index() part argument with the target key argument
to prepare for quering any BOM entry that matches the target key.
* Cache the BOM entry key in the entry itself
* Rename bom_types_group() to bom_entry_key()
* Define tuples of BOM columns as common constants
* Clarify a comment
* Change BOM heading from `Item` to `Description`
Co-authored-by: kvid <kvid@users.noreply.github.com>
Co-authored-by: Daniel Rojas <github@danielrojas.net>