From e4a4e7d1887a82a969d8da88fac4ce431d271dce Mon Sep 17 00:00:00 2001 From: Laurier Loiselle Date: Wed, 29 Mar 2023 16:29:40 -0400 Subject: [PATCH] options: add placement options for din-6771 --- examples/demo02.yml | 5 +++++ examples/ex05.yml | 2 +- src/wireviz/templates/din-6771.html | 24 ++++++++++++++++-------- src/wireviz/templates/notes.html | 12 ++++++++++-- src/wireviz/wv_dataclasses.py | 5 ++++- src/wireviz/wv_output.py | 5 ++++- 6 files changed, 40 insertions(+), 13 deletions(-) diff --git a/examples/demo02.yml b/examples/demo02.yml index 32f8b47..4c81498 100644 --- a/examples/demo02.yml +++ b/examples/demo02.yml @@ -23,6 +23,7 @@ metadata: notes: |
    +
  1. NO BOM by config! WOW!
  2. Wire color is a recommendation
  3. Label harnesses with text given in diagram
  4. Label every connector to match the designation in the drawing
  5. @@ -30,6 +31,10 @@ metadata:
  6. Cover all cables with 1/2" or 1/8" black sleeving as required. Make it very long for wrapping test
+options: + show_bom: False + notes_on_right: False + templates: # defining templates to be used later on - &molex_f diff --git a/examples/ex05.yml b/examples/ex05.yml index 93531a3..7041460 100644 --- a/examples/ex05.yml +++ b/examples/ex05.yml @@ -36,4 +36,4 @@ connections: - X3: [1-4] options: - notes_to_right: False + notes_on_right: False diff --git a/src/wireviz/templates/din-6771.html b/src/wireviz/templates/din-6771.html index 3948eeb..a48a0ff 100644 --- a/src/wireviz/templates/din-6771.html +++ b/src/wireviz/templates/din-6771.html @@ -53,18 +53,21 @@ height: 400mm; } + /* custom count of rows depending on the sheetsize */ + {% if not show_bom %} + {% set bottom_rows = titleblock_rows + 1 %} + {% elif sheetsize == 'A4' %} + {% set bottom_rows = bom_rows + titleblock_rows + 1 %} + {% else %} + {% set bottom_rows = [bom_rows, titleblock_rows]|max + 1 %} + {% endif %} + #diagram { position: relative; top: 0; left: 0; max-width: 100%; - {% if sheetsize == 'A4' %} - height: calc(100% - {{ [bom_rows, 13, ]|sum }} * 4.25mm); - {% else %} - height: calc(100% - {{ [bom_rows, 13]|max }} * 4.25mm); - {% endif %} - /* TODO: auto-adapt to height of title block + BOM table; - BOM table might be above (A4) or to the left (A3 and larger) of the title block */ + height: calc(100% - {{ bottom_rows }} * 4.25mm); text-align: center; vertical-align: middle; } @@ -105,9 +108,14 @@ {{ diagram }} - + {% if show_notes %} {{ notes }} + {% endif %} + + {% if show_bom %} {{ bom }} + {% endif %} + {{ titleblock }} diff --git a/src/wireviz/templates/notes.html b/src/wireviz/templates/notes.html index fe5ea25..e24e518 100644 --- a/src/wireviz/templates/notes.html +++ b/src/wireviz/templates/notes.html @@ -1,17 +1,25 @@