17 Commits

Author SHA1 Message Date
KV
204379a125 Move image attributes into Image dataclass to fix change requests
@formatc1702 requested changes in his review of #153:
- Lowercase attribute values
- Nested image attributes
- Avoid sending the whole node object as argument to helper functions
- Simplify html_size_attr()
- Move the resources folder
2020-08-15 07:13:23 +02:00
KV
41b3f3acfe Add an image_size attribute to both Connectors and Cables
It is a list containing minimum width and minimum height of the
image cell. To obtain more available space in the image cell,
this size must be set greater than the natural size of the image.
2020-08-13 22:52:40 +02:00
KV
3dc2a55f81 Add an image_scale attribute to both Connectors and Cables
It specifies how an image will use any extra space available in its
cell. Allowed values are one of these strings:
- FALSE : keep image its natural size. (Default)
- TRUE : scale image uniformly to fit.
- WIDTH : expand image width to fill.
- HEIGHT : expand image height to fill.
- BOTH : expand both image width and height to fill.

The value is sent to Graphviz as a scale attribute to the <img> tag.
Note that there is normally no extra height in the image cell.
2020-08-13 22:52:40 +02:00
KV
c8c4005487 Add a caption attribute to both Connectors and Cables 2020-08-13 19:14:09 +02:00
KV
43ec3bf798 Add an image attribute to both Connectors and Cables 2020-08-13 19:14:09 +02:00
Daniel Rojas
43f85aedb2 Add color attribute to cables 2020-08-13 17:21:42 +02:00
Daniel Rojas
79e751dca8 Remove obsolete code 2020-08-13 17:21:42 +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
a1881eb49d Rename connector attributes (#77)
Rename `pinnumbers` to `pins`.
Rename `pinout` to `pinlabels`.
2020-07-21 22:01:10 +02:00
Daniel Rojas
831b423c03 Eliminate ferrule category, unify connectors (#78) 2020-07-20 08:21:54 +02:00
Daniel Rojas
9e11051cac Simplify connector loop code 2020-07-11 11:53:29 +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
6a2924fa12 Check for duplicate pin numbers and raise an exception
Closes #72.
2020-07-09 18:10:38 +02:00
Tyler Ward
c200f66009 Merged in refactoring changes from upstream 2020-07-02 00:50:48 +01: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