diff --git a/examples/ex07.gv b/examples/ex07.gv index fd13951..5dafeea 100644 --- a/examples/ex07.gv +++ b/examples/ex07.gv @@ -30,5 +30,5 @@ graph { edge [color="#000000:#a52a2a:#000000"] X1:p8r:e -- W1:w8:w W1:w8:e -- X2:p5l:w - W1 [label=<
W1
8x24 AWG1 m
 
X1:1WHGNX2:3
X1:2GNX2:6
X1:3WHOGX2:1
X1:4BUX2:7
X1:5WHBUX2:8
X1:6OGX2:2
X1:7WHBNX2:4
X1:8BNX2:5
 
> fillcolor=white margin=0 shape=box style=""] + W1 [label=<
W1
8x24 AWG1 m
X1:1WHGNX2:3
X1:2GNX2:6
X1:3WHOGX2:1
X1:4BUX2:7
X1:5WHBUX2:8
X1:6OGX2:2
X1:7WHBNX2:4
X1:8BNX2:5
> fillcolor=white margin=0 shape=box style=""] } diff --git a/examples/ex07.html b/examples/ex07.html index a616265..78ba408 100644 --- a/examples/ex07.html +++ b/examples/ex07.html @@ -4,294 +4,276 @@ - - + + %3 - + X1 - -X1 - -Stewart Connector SS-37000-002 - -male - -8-pin - -DA+ - -DA- - -DB+ - -DC+ - -DC- - -DB- - -DD+ - -DD- - -1 - -2 - -3 - -4 - -5 - -6 - -7 - -8 + +X1 + +Stewart Connector SS-37000-002 + +male + +8-pin + +DA+ + +DA- + +DB+ + +DC+ + +DC- + +DB- + +DD+ + +DD- + +1 + +2 + +3 + +4 + +5 + +6 + +7 + +8 W1 - - -W1 - -8x - -24 AWG - -1 m -  -X1:1 -WHGN -X2:3 - - - - - - - - - -X1:2 -GN -X2:6 - - - -X1:3 -WHOG -X2:1 - - - - - - - - - -X1:4 -BU -X2:7 - - - -X1:5 -WHBU -X2:8 - - - - - - - - - -X1:6 -OG -X2:2 - - - -X1:7 -WHBN -X2:4 - - - - - - - - - -X1:8 -BN -X2:5 - - - -  + + +W1 + +8x + +24 AWG + +1 m +X1:1 +WHGN +X2:3 + + + + + +X1:2 +GN +X2:6 + + + +X1:3 +WHOG +X2:1 + + + + + +X1:4 +BU +X2:7 + + + +X1:5 +WHBU +X2:8 + + + + + +X1:6 +OG +X2:2 + + + +X1:7 +WHBN +X2:4 + + + + + +X1:8 +BN +X2:5 + + + X1:p1r:e--W1:w1:w - - - - - + + + + + X1:p2r:e--W1:w2:w - - - + + + X1:p3r:e--W1:w3:w - - - - - + + + + + X1:p4r:e--W1:w4:w - - - + + + X1:p5r:e--W1:w5:w - - - - - + + + + + X1:p6r:e--W1:w6:w - - - + + + X1:p7r:e--W1:w7:w - - - - - + + + + + X1:p8r:e--W1:w8:w - - - + + + X2 - -X2 - -Stewart Connector SS-37000-002 - -male - -8-pin - -1 - -2 - -3 - -4 - -5 - -6 - -7 - -8 - -DB+ - -DB- - -DA+ - -DD+ - -DD- - -DA- - -DC+ - -DC- + +X2 + +Stewart Connector SS-37000-002 + +male + +8-pin + +1 + +2 + +3 + +4 + +5 + +6 + +7 + +8 + +DB+ + +DB- + +DA+ + +DD+ + +DD- + +DA- + +DC+ + +DC- W1:w1:e--X2:p3l:w - - - - - + + + + + W1:w2:e--X2:p6l:w - - - + + + W1:w3:e--X2:p1l:w - - - - - + + + + + W1:w4:e--X2:p7l:w - - - + + + W1:w5:e--X2:p8l:w - - - - - + + + + + W1:w6:e--X2:p2l:w - - - + + + W1:w7:e--X2:p4l:w - - - - - + + + + + W1:w8:e--X2:p5l:w - - - + + + diff --git a/examples/ex07.png b/examples/ex07.png index 949acde..4d6b2b3 100644 Binary files a/examples/ex07.png and b/examples/ex07.png differ diff --git a/examples/ex07.svg b/examples/ex07.svg index 28eb9bf..c7afe09 100644 --- a/examples/ex07.svg +++ b/examples/ex07.svg @@ -4,294 +4,276 @@ - - + + %3 - + X1 - -X1 - -Stewart Connector SS-37000-002 - -male - -8-pin - -DA+ - -DA- - -DB+ - -DC+ - -DC- - -DB- - -DD+ - -DD- - -1 - -2 - -3 - -4 - -5 - -6 - -7 - -8 + +X1 + +Stewart Connector SS-37000-002 + +male + +8-pin + +DA+ + +DA- + +DB+ + +DC+ + +DC- + +DB- + +DD+ + +DD- + +1 + +2 + +3 + +4 + +5 + +6 + +7 + +8 W1 - - -W1 - -8x - -24 AWG - -1 m -  -X1:1 -WHGN -X2:3 - - - - - - - - - -X1:2 -GN -X2:6 - - - -X1:3 -WHOG -X2:1 - - - - - - - - - -X1:4 -BU -X2:7 - - - -X1:5 -WHBU -X2:8 - - - - - - - - - -X1:6 -OG -X2:2 - - - -X1:7 -WHBN -X2:4 - - - - - - - - - -X1:8 -BN -X2:5 - - - -  + + +W1 + +8x + +24 AWG + +1 m +X1:1 +WHGN +X2:3 + + + + + +X1:2 +GN +X2:6 + + + +X1:3 +WHOG +X2:1 + + + + + +X1:4 +BU +X2:7 + + + +X1:5 +WHBU +X2:8 + + + + + +X1:6 +OG +X2:2 + + + +X1:7 +WHBN +X2:4 + + + + + +X1:8 +BN +X2:5 + + + X1:p1r:e--W1:w1:w - - - - - + + + + + X1:p2r:e--W1:w2:w - - - + + + X1:p3r:e--W1:w3:w - - - - - + + + + + X1:p4r:e--W1:w4:w - - - + + + X1:p5r:e--W1:w5:w - - - - - + + + + + X1:p6r:e--W1:w6:w - - - + + + X1:p7r:e--W1:w7:w - - - - - + + + + + X1:p8r:e--W1:w8:w - - - + + + X2 - -X2 - -Stewart Connector SS-37000-002 - -male - -8-pin - -1 - -2 - -3 - -4 - -5 - -6 - -7 - -8 - -DB+ - -DB- - -DA+ - -DD+ - -DD- - -DA- - -DC+ - -DC- + +X2 + +Stewart Connector SS-37000-002 + +male + +8-pin + +1 + +2 + +3 + +4 + +5 + +6 + +7 + +8 + +DB+ + +DB- + +DA+ + +DD+ + +DD- + +DA- + +DC+ + +DC- W1:w1:e--X2:p3l:w - - - - - + + + + + W1:w2:e--X2:p6l:w - - - + + + W1:w3:e--X2:p1l:w - - - - - + + + + + W1:w4:e--X2:p7l:w - - - + + + W1:w5:e--X2:p8l:w - - - - - + + + + + W1:w6:e--X2:p2l:w - - - + + + W1:w7:e--X2:p4l:w - - - - - + + + + + W1:w8:e--X2:p5l:w - - - + + + diff --git a/src/batch.py b/src/batch.py index 300cd84..bf15874 100644 --- a/src/batch.py +++ b/src/batch.py @@ -1,8 +1,8 @@ import wireviz import os -demos = 0 # 2 -examples = 0 # 6 +demos = 2 # 2 +examples = 7 # 7 tutorials = 7 # 7 if demos: diff --git a/src/wireviz.py b/src/wireviz.py index eb89682..e832ab8 100755 --- a/src/wireviz.py +++ b/src/wireviz.py @@ -142,26 +142,37 @@ class Harness: for bla in p: html = html + '{}'.format(bla) html = html + '' - bgcolor = ":".join(wv_colors.translate_color(x, 'hex').split(':')[:2]) - html = html + '
'.format(colspan=len(p), bgcolor=bgcolor if bgcolor != '' else '#ffffff', port='w{}'.format(i)) - + colors = wv_colors.translate_color(x,'hex').split(':') + rowheight = 6 #/ len(colors) + collen = len(p) / len(colors) + html = html + '
'.format(colspan=len(p), port='w{}'.format(i)) + for j, bgcolor in enumerate(colors,1): + # todo border 2 + # port="{port}" + # html = html + ''.format( + # colspan=collen, bgcolor=bgcolor if bgcolor != '' else wv_colors.default_color, + # port='port="w{}"'.format(i) if j == len(colors) else '', rowheight=rowheight) + html = html + ''.format( + colspan=collen, bgcolor=bgcolor if bgcolor != '' else wv_colors.default_color, rowheight=rowheight) + html = html + '
' if c.shield: p = ['', 'Shield', ''] - html = html + ' ' # spacer + html = html + '' # spacer html = html + '' for bla in p: html = html + '{}'.format(bla) html = html + '' - html = html + ''.format(colspan=len(p), bgcolor=wv_colors.translate_color(x, 'hex'), port='ws') + html = html + ''.format( + colspan=len(p), bgcolor=wv_colors.translate_color(wv_colors.shield_color, 'hex'), port='ws') - html = html + ' ' # spacer at the end + html = html + '' # spacer at the end html = html + '' # conductor table html = html + '' # main table if c.notes: html = html + '{}'.format(c.notes) # notes table - html = html + ' ' # spacer at the end + html = html + ' ' # spacer at the end html = html + '' # main table diff --git a/src/wv_colors.py b/src/wv_colors.py index dcc58cf..c526a66 100644 --- a/src/wv_colors.py +++ b/src/wv_colors.py @@ -18,12 +18,16 @@ COLOR_CODES = { 'T568B': ['WHOG', 'OG', 'WHGN', 'BU', 'WHBU', 'GN', 'WHBN', 'BN'], } -_default_color = '#ffffff' +default_color = '#ffffff' # default_bkgnd_color = '#ffffff' # white default_bknd_color = '#fffbf8' # off-white beige-ish -color_hex = { +# Convention: Color names should be 2 letters long, to allow for multicolored wires + +shield_color = 'TI' + +_color_hex = { 'BK': '#000000', 'WH': '#ffffff', 'GY': '#999999',