52 Commits

Author SHA1 Message Date
Daniel Rojas
a255596471
Apply some manual fixes, reapply black 2023-01-19 16:36:17 -05:00
Daniel Rojas
343cd2949f
Apply black 2023-01-19 16:36:17 -05:00
Daniel Rojas
e6f76f9ab7
Apply isort 2023-01-19 16:35:25 -05:00
Daniel Rojas
23db602445
Split file output logic and object return logic
Use `output_formats` parameter to specify which *files* to output to disk,
Use `return_types` parameter to specify which objects to return to a calling Python script
2023-01-19 16:35:24 -05:00
Daniel Rojas
63be33e9db
Add main() to wireviz.py as fallback 2023-01-19 16:35:22 -05:00
Daniel Rojas
7638425fd9
Remove obsolete comments 2023-01-19 16:35:21 -05:00
Daniel Rojas
97207e6986
Fix smart file resolver for images 2023-01-19 16:35:21 -05:00
Daniel Rojas
b9527a8086
Do not output .gv files by default 2023-01-19 16:35:20 -05:00
Daniel Rojas
a4a89eb3df
Implement image path resolver 2023-01-19 16:35:20 -05:00
Daniel Rojas
471a6c3e29
Split the YAML loading and parsing functions 2023-01-19 16:35:20 -05:00
Daniel Rojas
f325b69d9a
Fix entry point 2023-01-19 16:35:19 -05:00
Daniel Rojas
a98e17b737
Only output requested file types (closes #60) 2023-01-19 16:35:19 -05:00
Daniel Rojas
d0909d4cbb
Remove unneeded code from wireviz.py
Re-add `parse_file()` for building examples

bla
2023-01-19 16:35:18 -05:00
Daniel Rojas
095a2a023b
Simplify main() 2023-01-19 16:35:17 -05:00
Daniel Rojas
f78f83cfdd
Add explanatory comment 2023-01-19 16:35:16 -05:00
Daniel Rojas
0192f6defd
Replace os.path with pathlib.Path where used 2023-01-19 16:35:16 -05:00
Daniel Rojas
37cd08d476
Simplify code 2023-01-19 16:35:11 -05:00
Daniel Rojas
def03d1ce3
Resolve component level mate not revealing connection count 2023-01-19 16:35:09 -05:00
Daniel Rojas
e3fbc91312
Squash feature/mate+autogenerate branch 2023-01-19 16:35:08 -05:00
Andreas Motl
80b7a5407b 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.
2021-10-25 20:05:05 +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
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
Daniel Rojas
831b423c03 Eliminate ferrule category, unify connectors (#78) 2020-07-20 08:21:54 +02:00
Andrew Katz
fecf27165f Fix unicode issue for windows (force an encoding) 2020-07-19 19:03:07 +02:00
Jason
12d3002af8
Add type hinting (#92) 2020-07-15 19:30:23 +02:00
Jason
34cd9c2612
Match parse() return tuple order to input tuple order (#89)
Fixes #88.
2020-07-15 08:07:15 +02:00
Jason
c8dc697845
Add ability for parse() to return the Harness instance (#87) 2020-07-14 22:01:00 +02:00
Tyler Ward
8b69e9a8a8
Add ability to include aditional BOM lines (#80) 2020-07-13 18:23:23 +02:00
Jason
3eed9681da
Remove unused parameter, fix default parameter (#76) 2020-07-12 08:21:28 +02:00
Daniel Rojas
cf6d3676c4 Ensure items in a connection set alternate between connectors and cables 2020-07-11 11:31:02 +02:00
Daniel Rojas
b4791900f2 Make connecting components together easier and more flexible
Closes #67.

- Allow defining arbitrarily long lists of alternating connectors and cables in a connection set.
- Start work towards removing 'ferrules' as special case, merging them with normal connectors
- Stramline auto-generation of simple, one pin connectors (ferrules, wire splices, ...)
2020-07-10 18:53:32 +02:00
Daniel Rojas
de1e45f72b Fix bug in refactoring of #55, add SVG output option 2020-07-05 12:24:51 +02:00
Daniel Rojas
144c99e021 Refactor #55 2020-07-04 17:16:00 +02:00
Jason
ebf1e5a6f2
Add ability to export PNG data directly to other programs. (#55) 2020-07-04 17:03:04 +02:00
Tyler Ward
c200f66009 Merged in refactoring changes from upstream 2020-07-02 00:50:48 +01:00
Tyler Ward
9c5ea06ca2 Added spaces after MPN: and IPN: 2020-07-01 23:47:49 +01:00
Tyler Ward
f67235e326 Added diagram support for part numbers on ferrules 2020-07-01 23:45:35 +01:00
Tyler Ward
1ec9ca4f81 Improved part number support
Added internal part number and manufacturer fields
Added support for wire part numbers in a bundle
Moved part number information to seperate row in table
2020-07-01 23:17:20 +01:00
Daniel Rojas
c42b33b38d Address FIXMEs and fine-tune merge of #39 2020-06-29 12:35:40 +02:00
Gabe R
82b173f2ce Refactor and clean up code (#39)
* Format all files using autopep8 to add basic PEP8 conformity.
* Add Exception types to bare excepts to prevent catching `ctrl+c`
* Remove some unnecessary assignment to dummy variables before returning
* Add `Optional` to type hints that can be `NoneType`
* Change a number of single-letter variables to more descriptive names
* Replace string.format() use with Python's f-strings, as they tends to be cleaner, and provide a performance boost.
  * One multiline string was left as string.format() as I do not believe f-strings support multiline
  * Some of the string.format() instances had unused/ignored arguments. I left them out of the f-strings, but I marked those cases with a comments that begins `# FIXME:`
* Rename variables that were shadowding python standard functions (specifically `format->fmt`, `input->inp`, `type->maintype`)
  * Some instances of `type` were not changed, as it breaks the yaml parsing. Needs to be looked into.
* Move classes in `wireviz.py` to two new files `DataClasses.py` and `Harness.py`.

Co-authored-by: Daniel Rojas <github@danielrojas.net>
2020-06-29 11:57:03 +02:00
Tyler Ward
92b6b21895 Added ability to set part numbers 2020-06-28 22:11:05 +01:00
Tyler Ward
a3728f52ce
Fix for Designators apearing across all colours of wires of a guage. (#37)
The wirelist for the bom now has individual designators added. this also 
alows for the removal of designator list merging later.
2020-06-28 22:58:24 +02:00
Florian Pigorsch
eb65be39dc Fix some typos: budnle, conector, separetely 2020-06-28 14:55:09 +02:00
Daniel Rojas
7060c38f07 Add parse_file() function and use it in build_examples.py 2020-06-28 12:28:13 +02:00
Andreas Nordin
1f06c6017c refactor: rename 'input' -> 'yaml_data'
'input' overloads a python built-in name. Refactor to avoid this.
2020-06-28 10:52:08 +02:00
Andreas Nordin
f14a07fe95 feature: add --prepend-file option
- Allow prepending a separate YAML file for e.g. including common
  template definitions. This is accomodated by a new commandline option,
  --prepend-file, which takes a path to a YAML file. This is prepended
  to the regular input as-is.

- Refactor file loading to accomodate the above. This includes moving
  relevant parts to main() and instead supplying parse () with a string
  representation of the YAML data. Also add early file existance checks
  and bail out if any of the inputs are inaccessible or nonexistant.
2020-06-28 10:51:49 +02:00
Andreas Nordin
9af391ff9d clean up imports, cmdline handling
Order imports properly. Fix path when running script directly from repo
rather than as an installed package. Refactor command line handling.
2020-06-28 10:47:15 +02:00