Added List syntax for shorts and loops
This commit is contained in:
parent
57386a997c
commit
bb475ea7eb
@ -88,13 +88,20 @@ tweak: # optional tweaking of .gv output
|
||||
# on the connector that are to be shorted with a cable loop
|
||||
# more information about the loop can be added by additional
|
||||
# components definition (see below)
|
||||
# OR
|
||||
- <List> # a list of pins to be looped
|
||||
# Shorts
|
||||
shorts: # a list(dict) of shorts
|
||||
- <str>: <List> # every list item is itself a list of pins
|
||||
<str>: <List> # every list item is itself a list of pins
|
||||
# on the connector that are to be shorted represented inside
|
||||
# the connector table
|
||||
# more information about the loop can be added by additional
|
||||
# components definition (see below)
|
||||
# OR
|
||||
- <List> # a list of pins to be shorted
|
||||
# it is not posable to combine those two
|
||||
shorts_hide_lable: <bool> # A Boolean to control if the lable of the shorts should be shown, if a list is used this is automatically turned true.
|
||||
|
||||
```
|
||||
|
||||
## Cable attributes
|
||||
|
||||
12
examples/ex15.gv
generated
12
examples/ex15.gv
generated
@ -106,9 +106,9 @@ graph {
|
||||
</table>
|
||||
> shape=box style=filled]
|
||||
edge [color="#000000"]
|
||||
X1:p1j:c -- X1:p5j:c [addPTS=.18 color="#FF66CC" colorPTS="#FF66CC" headclip=false straight=straight tailclip=false]
|
||||
X1:p5j:c -- X1:p7j:c [addPTS=.18 color="#FF66CC" colorPTS="#FF66CC" headclip=false straight=straight tailclip=false]
|
||||
X1:p2j:c -- X1:p6j:c [addPTS=.18 color="#FF0000" colorPTS="#FF0000" headclip=false straight=straight tailclip=false]
|
||||
X1:p1j:c -- X1:p5j:c [addPTS=.18 color="#FFFFFF:#FF66CC:#FFFFFF" colorPTS="#FF66CC:#FFFFFF" headclip=false straight=straight tailclip=false]
|
||||
X1:p5j:c -- X1:p7j:c [addPTS=.18 color="#FFFFFF:#FF66CC:#FFFFFF" colorPTS="#FF66CC:#FFFFFF" headclip=false straight=straight tailclip=false]
|
||||
X1:p2j:c -- X1:p6j:c [addPTS=.18 color="#FFFFFF:#FF0000:#FFFFFF" colorPTS="#FF0000:#FFFFFF" headclip=false straight=straight tailclip=false]
|
||||
X2 [label=<
|
||||
<table border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF">
|
||||
<tr>
|
||||
@ -181,9 +181,9 @@ graph {
|
||||
</table>
|
||||
> shape=box style=filled]
|
||||
edge [color="#000000"]
|
||||
X2:p1j:c -- X2:p5j:c [addPTS=.18 color="#000000" colorPTS="#000000" headclip=false straight=straight tailclip=false]
|
||||
X2:p5j:c -- X2:p7j:c [addPTS=.18 color="#000000" colorPTS="#000000" headclip=false straight=straight tailclip=false]
|
||||
X2:p2j:c -- X2:p6j:c [addPTS=.18 color="#000000" colorPTS="#000000" headclip=false straight=straight tailclip=false]
|
||||
X2:p1j:c -- X2:p5j:c [addPTS=.18 color="#FFFFFF:#000000:#FFFFFF" colorPTS="#000000:#FFFFFF" headclip=false straight=straight tailclip=false]
|
||||
X2:p5j:c -- X2:p7j:c [addPTS=.18 color="#FFFFFF:#000000:#FFFFFF" colorPTS="#000000:#FFFFFF" headclip=false straight=straight tailclip=false]
|
||||
X2:p2j:c -- X2:p6j:c [addPTS=.18 color="#FFFFFF:#000000:#FFFFFF" colorPTS="#000000:#FFFFFF" headclip=false straight=straight tailclip=false]
|
||||
W1 [label=<
|
||||
<table border="0" cellspacing="0" cellpadding="0" bgcolor="#FFFFFF">
|
||||
<tr>
|
||||
|
||||
12
examples/ex15.html
generated
12
examples/ex15.html
generated
@ -111,17 +111,23 @@
|
||||
<!-- X1--X1 -->
|
||||
<g id="edge1" class="edge">
|
||||
<title>X1:c--X1:c</title>
|
||||
<path fill="none" stroke="#ffffff" stroke-width="2" d="M86.38,-246C86.38,-214 86.38,-182 86.38,-150"/>
|
||||
<path fill="none" stroke="#ff66cc" stroke-width="2" d="M88.38,-246C88.38,-214 88.38,-182 88.38,-150"/>
|
||||
<path fill="none" stroke="#ffffff" stroke-width="2" d="M90.38,-246C90.38,-214 90.38,-182 90.38,-150"/>
|
||||
</g>
|
||||
<!-- X1--X1 -->
|
||||
<g id="edge2" class="edge">
|
||||
<title>X1:c--X1:c</title>
|
||||
<path fill="none" stroke="#ffffff" stroke-width="2" d="M86.38,-150C86.38,-134 86.38,-118 86.38,-102"/>
|
||||
<path fill="none" stroke="#ff66cc" stroke-width="2" d="M88.38,-150C88.38,-134 88.38,-118 88.38,-102"/>
|
||||
<path fill="none" stroke="#ffffff" stroke-width="2" d="M90.38,-150C90.38,-134 90.38,-118 90.38,-102"/>
|
||||
</g>
|
||||
<!-- X1--X1 -->
|
||||
<g id="edge3" class="edge">
|
||||
<title>X1:c--X1:c</title>
|
||||
<path fill="none" stroke="#ffffff" stroke-width="2" d="M142.62,-222C142.62,-190 142.62,-158 142.62,-126"/>
|
||||
<path fill="none" stroke="#ff0000" stroke-width="2" d="M144.62,-222C144.62,-190 144.62,-158 144.62,-126"/>
|
||||
<path fill="none" stroke="#ffffff" stroke-width="2" d="M146.62,-222C146.62,-190 146.62,-158 146.62,-126"/>
|
||||
</g>
|
||||
<!-- W1 -->
|
||||
<g id="node2" class="node">
|
||||
@ -373,17 +379,23 @@
|
||||
<!-- X2--X2 -->
|
||||
<g id="edge18" class="edge">
|
||||
<title>X2:c--X2:c</title>
|
||||
<path fill="none" stroke="#ffffff" stroke-width="2" d="M885.78,-255C885.78,-223 885.78,-191 885.78,-159"/>
|
||||
<path fill="none" stroke="#000000" stroke-width="2" d="M887.78,-255C887.78,-223 887.78,-191 887.78,-159"/>
|
||||
<path fill="none" stroke="#ffffff" stroke-width="2" d="M889.78,-255C889.78,-223 889.78,-191 889.78,-159"/>
|
||||
</g>
|
||||
<!-- X2--X2 -->
|
||||
<g id="edge19" class="edge">
|
||||
<title>X2:c--X2:c</title>
|
||||
<path fill="none" stroke="#ffffff" stroke-width="2" d="M885.78,-159C885.78,-143 885.78,-127 885.78,-111"/>
|
||||
<path fill="none" stroke="#000000" stroke-width="2" d="M887.78,-159C887.78,-143 887.78,-127 887.78,-111"/>
|
||||
<path fill="none" stroke="#ffffff" stroke-width="2" d="M889.78,-159C889.78,-143 889.78,-127 889.78,-111"/>
|
||||
</g>
|
||||
<!-- X2--X2 -->
|
||||
<g id="edge20" class="edge">
|
||||
<title>X2:c--X2:c</title>
|
||||
<path fill="none" stroke="#ffffff" stroke-width="2" d="M936.59,-231C936.59,-199 936.59,-167 936.59,-135"/>
|
||||
<path fill="none" stroke="#000000" stroke-width="2" d="M938.59,-231C938.59,-199 938.59,-167 938.59,-135"/>
|
||||
<path fill="none" stroke="#ffffff" stroke-width="2" d="M940.59,-231C940.59,-199 940.59,-167 940.59,-135"/>
|
||||
</g>
|
||||
<!-- __CIRCLE__1 -->
|
||||
<g id="node4" class="node">
|
||||
|
||||
BIN
examples/ex15.png
generated
BIN
examples/ex15.png
generated
Binary file not shown.
|
Before Width: | Height: | Size: 70 KiB After Width: | Height: | Size: 70 KiB |
12
examples/ex15.svg
generated
12
examples/ex15.svg
generated
@ -82,17 +82,23 @@
|
||||
<!-- X1--X1 -->
|
||||
<g id="edge1" class="edge">
|
||||
<title>X1:c--X1:c</title>
|
||||
<path fill="none" stroke="#ffffff" stroke-width="2" d="M86.38,-246C86.38,-214 86.38,-182 86.38,-150"/>
|
||||
<path fill="none" stroke="#ff66cc" stroke-width="2" d="M88.38,-246C88.38,-214 88.38,-182 88.38,-150"/>
|
||||
<path fill="none" stroke="#ffffff" stroke-width="2" d="M90.38,-246C90.38,-214 90.38,-182 90.38,-150"/>
|
||||
</g>
|
||||
<!-- X1--X1 -->
|
||||
<g id="edge2" class="edge">
|
||||
<title>X1:c--X1:c</title>
|
||||
<path fill="none" stroke="#ffffff" stroke-width="2" d="M86.38,-150C86.38,-134 86.38,-118 86.38,-102"/>
|
||||
<path fill="none" stroke="#ff66cc" stroke-width="2" d="M88.38,-150C88.38,-134 88.38,-118 88.38,-102"/>
|
||||
<path fill="none" stroke="#ffffff" stroke-width="2" d="M90.38,-150C90.38,-134 90.38,-118 90.38,-102"/>
|
||||
</g>
|
||||
<!-- X1--X1 -->
|
||||
<g id="edge3" class="edge">
|
||||
<title>X1:c--X1:c</title>
|
||||
<path fill="none" stroke="#ffffff" stroke-width="2" d="M142.62,-222C142.62,-190 142.62,-158 142.62,-126"/>
|
||||
<path fill="none" stroke="#ff0000" stroke-width="2" d="M144.62,-222C144.62,-190 144.62,-158 144.62,-126"/>
|
||||
<path fill="none" stroke="#ffffff" stroke-width="2" d="M146.62,-222C146.62,-190 146.62,-158 146.62,-126"/>
|
||||
</g>
|
||||
<!-- W1 -->
|
||||
<g id="node2" class="node">
|
||||
@ -344,17 +350,23 @@
|
||||
<!-- X2--X2 -->
|
||||
<g id="edge18" class="edge">
|
||||
<title>X2:c--X2:c</title>
|
||||
<path fill="none" stroke="#ffffff" stroke-width="2" d="M885.78,-255C885.78,-223 885.78,-191 885.78,-159"/>
|
||||
<path fill="none" stroke="#000000" stroke-width="2" d="M887.78,-255C887.78,-223 887.78,-191 887.78,-159"/>
|
||||
<path fill="none" stroke="#ffffff" stroke-width="2" d="M889.78,-255C889.78,-223 889.78,-191 889.78,-159"/>
|
||||
</g>
|
||||
<!-- X2--X2 -->
|
||||
<g id="edge19" class="edge">
|
||||
<title>X2:c--X2:c</title>
|
||||
<path fill="none" stroke="#ffffff" stroke-width="2" d="M885.78,-159C885.78,-143 885.78,-127 885.78,-111"/>
|
||||
<path fill="none" stroke="#000000" stroke-width="2" d="M887.78,-159C887.78,-143 887.78,-127 887.78,-111"/>
|
||||
<path fill="none" stroke="#ffffff" stroke-width="2" d="M889.78,-159C889.78,-143 889.78,-127 889.78,-111"/>
|
||||
</g>
|
||||
<!-- X2--X2 -->
|
||||
<g id="edge20" class="edge">
|
||||
<title>X2:c--X2:c</title>
|
||||
<path fill="none" stroke="#ffffff" stroke-width="2" d="M936.59,-231C936.59,-199 936.59,-167 936.59,-135"/>
|
||||
<path fill="none" stroke="#000000" stroke-width="2" d="M938.59,-231C938.59,-199 938.59,-167 938.59,-135"/>
|
||||
<path fill="none" stroke="#ffffff" stroke-width="2" d="M940.59,-231C940.59,-199 940.59,-167 940.59,-135"/>
|
||||
</g>
|
||||
<!-- __CIRCLE__1 -->
|
||||
<g id="node4" class="node">
|
||||
|
||||
|
Before Width: | Height: | Size: 30 KiB After Width: | Height: | Size: 31 KiB |
@ -312,8 +312,9 @@ class Connector(TopLevelGraphicalComponent):
|
||||
# connector-specific properties
|
||||
style: Optional[str] = None
|
||||
# TODO: Move shorts and loops to PinClass
|
||||
loops: Dict[str, List[int]] = field(default_factory=dict)
|
||||
shorts: Dict[str, List[int]] = field(default_factory=dict)
|
||||
loops: Union[Dict[str, List[int]], List[List[int]]] = field(default_factory=dict)
|
||||
shorts: Union[Dict[str, List[int]], List[List[int]]] = field(default_factory=dict)
|
||||
shorts_hide_lable: bool = False
|
||||
# pin information in particular
|
||||
pincount: Optional[int] = None
|
||||
pins: List[Pin] = field(default_factory=list) # legacy
|
||||
@ -418,6 +419,23 @@ class Connector(TopLevelGraphicalComponent):
|
||||
# hide pincount for simple (1 pin) connectors by default
|
||||
self.show_pincount = self.style != "simple"
|
||||
|
||||
# Convert short List to Short Dict
|
||||
if type(self.shorts) == list:
|
||||
self.shorts_hide_lable = True
|
||||
shDict = dict()
|
||||
for shIndex in range(0, len(self.shorts)):
|
||||
key = "AutoSH" + str(shIndex)
|
||||
shDict[key] = self.shorts[shIndex]
|
||||
self.shorts = shDict
|
||||
|
||||
# Convert loop List to loop Dict
|
||||
if type(self.loops) == list:
|
||||
loDict = dict()
|
||||
for loIndex in range(0, len(self.loops)):
|
||||
key = "AutoLO" + str(loIndex)
|
||||
loDict[key] = self.loops[loIndex]
|
||||
self.loops = loDict
|
||||
|
||||
# TODO: allow using pin labels in addition to pin numbers,
|
||||
# just like when defining regular connections
|
||||
# TODO: include properties of wire used to create the loop
|
||||
|
||||
@ -277,7 +277,7 @@ def gv_shorts_info_row(component) -> Tr:
|
||||
def gv_pin_table(component) -> Table:
|
||||
pin_rows = []
|
||||
|
||||
if len(component.shorts) > 0:
|
||||
if len(component.shorts) > 0 and not component.shorts_hide_lable:
|
||||
pin_rows.append(gv_shorts_info_row(component))
|
||||
|
||||
for pin in component.pin_objects.values():
|
||||
@ -343,9 +343,9 @@ def gv_connector_shorts(connector: Connector) -> List:
|
||||
|
||||
for short, shPins in connector.shorts.items():
|
||||
comp = getAddCompFromRef(short, connector)
|
||||
shColor = "#000000"
|
||||
shColor = "#FFFFFF:#000000:#FFFFFF"
|
||||
if comp != None and comp.color != None:
|
||||
shColor = comp.color.html
|
||||
shColor = f"#FFFFFF:{comp.color.html}:#FFFFFF"
|
||||
|
||||
for i in range(1, len(shPins)):
|
||||
head = f"{connector.designator}:p{shPins[i - 1]}j:c"
|
||||
|
||||
@ -339,7 +339,7 @@ class Harness:
|
||||
color=color,
|
||||
straight="straight",
|
||||
addPTS=".18", # Size of the point at the end of the straight line/edge, it also enables the drawing of it
|
||||
colorPTS=color,
|
||||
colorPTS=color.replace("#FFFFFF:", ""),
|
||||
headclip="false", tailclip="false")
|
||||
|
||||
# determine if there are double- or triple-colored wires in the harness;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user