14 Commits

Author SHA1 Message Date
Andrew Katz
fecf27165f Fix unicode issue for windows (force an encoding) 2020-07-19 19:03:07 +02:00
Andrew Katz
b147aa0eb1 Finish adding multicolor support 2020-07-19 18:59:34 +02:00
Daniel Rojas
6c7d700a1f Remove obsolete nesting function, fine-tune table generating behavior 2020-07-15 20:06:31 +02:00
Daniel Rojas
7e54c7aaef Refactor connector GraphViz code generation (#66) 2020-07-15 20:04:58 +02:00
KV
ba8b83f792 Make multi-line connector attributes centered for consistency 2020-07-15 19:16:24 +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
e1e665583f Outsource nested HTML table creation to helper function 2020-07-05 20:36:02 +02:00
Daniel Rojas
46ed2418b4 Remove any newlines in fields for BOM generation 2020-07-05 18:06:57 +02:00
Daniel Rojas
d4ac4da651 Implement line break parsing for some fields
Implemented in `type`, `subtype`, `notes` fields
2020-07-05 17:41:18 +02:00
kvid
4e9933f01d
Simplify BOM code (#62)
* Remove bundle grouping as it is not needed for the wire grouping

Grouping the bundles has no purpose, as the same
wires can be collected by just looping all bundles.

* Allow one common value or list of values for each wire

Allow one common value when they are equal for all wires,
or a list of values to allow each wire a different value.

* Fix the minor issues commented by the owner

The owner review comments can be seen here:
https://github.com/formatc1702/WireViz/pull/62

* Make grouping code more pythonic
2020-07-05 16:52:10 +02:00
Andreas Nordin
08e53bcd48
Feature: bidirectional AWG/mm2 unit conversion (#41)
* Fix AWG<-> mm2 conversions

Add an inverted dictionary and a lookup function from awg -> mm2. Also
do some minor refactoring. Both sides of the conversion table were
converted to strings, since '0000' and '2/0' are perfectly valid AWG
values.

* Update example ex02 with awg -> mm2 conversion

Show conversions for ex02, and make sure it displays conversions in both
directions. Rebuild the example files.

* Fix faulty conversion of non-(mm2,AWG) units

The parsing allows arbitrary units to be used for cable dimensions --
this might be valid units, e.g. square inches, or invalid, e.g. bananas.
We only allow conversion between mm2 and AWG, so check that the
gauge_unit is either of those before conversion. If not, pass through as
is.

* Fix AWG string casing in output

Convert e.g. 'awg, 'AwG' to upper case for consistent rendering. Leave
any other input gauge units as they were.

Co-authored-by: Daniel Rojas <github@danielrojas.net>
2020-06-29 14:41:45 +02: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
Daniel Rojas
dfb184c1a4 Move source from src/ to src/wireviz/
in preparation for merge of refactor brancb
2020-06-28 10:39:11 +02:00