Cleand up and added comends, description in the readme
This commit is contained in:
parent
9e54d02e39
commit
e0dd2c1670
@ -148,6 +148,12 @@ To see how to specify the output formats, as well as additional options, run:
|
||||
$ wireviz --help
|
||||
```
|
||||
|
||||
For using the .gv output one needs to use the following command:
|
||||
|
||||
```
|
||||
dot <filename>.gv | gvpr -q -cf <filename>_pin2pin.gvpr | neato -n2 -T<type> -o <filename>.<type>
|
||||
```
|
||||
|
||||
|
||||
### (Re-)Building the example projects
|
||||
|
||||
|
||||
@ -272,7 +272,7 @@ class Harness:
|
||||
# fmt: on
|
||||
else:
|
||||
pinhtml.append(' <td colspan="2"></td>')
|
||||
|
||||
# Add Short columns
|
||||
for short in connector.shorts:
|
||||
shortName = list(short.keys())[0]
|
||||
shortPins = list(short.values())[0]
|
||||
@ -284,8 +284,6 @@ class Harness:
|
||||
|
||||
if pinindex+1 in shortPins:
|
||||
pinhtml.append(f' <td width="21" port="p{pinindex+1}J"></td>')
|
||||
|
||||
# pinhtml.append(f' <td port="p{pinindex+1}J"><FONT FACE="Sans" POINT-SIZE="12.0" COLOR="{wv_colors.translate_color(shColor, "HEX")}">⬤</FONT></td>')
|
||||
else:
|
||||
pinhtml.append(f' <td></td>')
|
||||
|
||||
@ -302,6 +300,7 @@ class Harness:
|
||||
for row in html
|
||||
]
|
||||
|
||||
# Add short connections/vertical lines with dots
|
||||
for short in connector.shorts:
|
||||
shortName = list(short.keys())[0]
|
||||
shortPins = list(short.values())[0]
|
||||
@ -318,7 +317,7 @@ class Harness:
|
||||
f"{connector.name}:p{shortPins[i]}j:c",
|
||||
straight="straight",
|
||||
addPTS=".18", # Size of the point at the end of the straight line/edge, it also enables the drawing of it
|
||||
colorPTS=str(wv_colors.translate_color(shColor, "HEX")), # the color of the point at the end of the line, it is requered that the circle is drawin
|
||||
colorPTS=str(wv_colors.translate_color(shColor, "HEX")), # the color of the point at the end of the line, it is required that the circle is drawing
|
||||
)
|
||||
|
||||
dot.attr("edge", headclip="true", tailclip="true", style="bold")
|
||||
@ -332,6 +331,7 @@ class Harness:
|
||||
fillcolor=translate_color(self.options.bgcolor_connector, "HEX"),
|
||||
)
|
||||
|
||||
# Draw loop connections
|
||||
for loop in connector.loops:
|
||||
loopName = list(loop.keys())[0]
|
||||
loopPins = list(loop.values())[0]
|
||||
@ -357,22 +357,6 @@ class Harness:
|
||||
label= " ",
|
||||
)
|
||||
|
||||
# if len(connector.loops) > 0:
|
||||
# dot.attr("edge", color="#000000:#ffffff:#000000")
|
||||
# if connector.ports_left:
|
||||
# loop_side = "l"
|
||||
# loop_dir = "w"
|
||||
# elif connector.ports_right:
|
||||
# loop_side = "r"
|
||||
# loop_dir = "e"
|
||||
# else:
|
||||
# raise Exception("No side for loops")
|
||||
# for loop in connector.loops:
|
||||
# dot.edge(
|
||||
# f"{connector.name}:p{loop[0]}{loop_side}:{loop_dir}",
|
||||
# f"{connector.name}:p{loop[1]}{loop_side}:{loop_dir}",
|
||||
# )
|
||||
|
||||
# determine if there are double- or triple-colored wires in the harness;
|
||||
# if so, pad single-color wires to make all wires of equal thickness
|
||||
pad = any(
|
||||
@ -748,13 +732,18 @@ class Harness:
|
||||
|
||||
# This renders the graph with gvpr and neato, this is needed to be able to draw the stright lines for the jumpers
|
||||
def graphRender(self, type, filename, graph):
|
||||
|
||||
# Chack if the needed commands are existing
|
||||
if find_executable("dot") and find_executable("gvpr") and find_executable("neato"):
|
||||
# Set enviorments variable to path of this file
|
||||
os.environ['GVPRPATH'] = str(Path(__file__).parent)
|
||||
# Export the gv output to a temporay file
|
||||
graph.save(filename=f"{filename}_tmp.gv")
|
||||
os.system(f"dot {filename}_tmp.gv | gvpr -q -cf pin2pin.gvpr | neato -n2 -T{type} -o {filename}.{type}")#{':cairo'if type == 'svg' else ''}
|
||||
# Run the vomand and generait the output
|
||||
os.system(f"dot {filename}_tmp.gv | gvpr -q -cf pin2pin.gvpr | neato -n2 -T{type} -o {filename}.{type}")
|
||||
# Remove the temporary file
|
||||
os.remove(f"{filename}_tmp.gv")
|
||||
else:
|
||||
print('The "dot", "gvpr" and "neato" comand where not found on the system, use old methode of generaiton, this may lead to not wanted output.')
|
||||
graph.render(filename=filename) # old rendering methode, befor jumper implementations
|
||||
|
||||
@property
|
||||
@ -797,7 +786,6 @@ class Harness:
|
||||
_filename = f"{filename}.tmp" if f == "svg" else filename
|
||||
# TODO: prevent rendering SVG twice when both SVG and HTML are specified
|
||||
graph.format = f
|
||||
# graph.render(filename=_filename) # old rendering methode, befor jumper implementations
|
||||
self.graphRender(f, _filename, graph)
|
||||
# embed images into SVG output
|
||||
if "svg" in fmt or "html" in fmt:
|
||||
@ -805,9 +793,10 @@ class Harness:
|
||||
# GraphViz output
|
||||
if "gv" in fmt:
|
||||
graph.save(filename=f"{filename}.gv")
|
||||
# Print the needed comand for generaitong an output
|
||||
filename_str = str(filename)
|
||||
shutil.copyfile(str(Path(__file__).parent).replace('\\', '/') + "/pin2pin.gvpr", filename_str + "_pin2pin.gvpr")
|
||||
print(f"Use: dot {filename_str}_tmp.gv | gvpr -q -cf {filename_str}_pin2pin.gvpr | neato -n2 -T<type> -o {filename_str}.<type>")
|
||||
print(f"Use: dot {filename_str}.gv | gvpr -q -cf {filename_str}_pin2pin.gvpr | neato -n2 -T<type> -o {filename_str}.<type>")
|
||||
# BOM output
|
||||
bomlist = bom_list(self.bom())
|
||||
if "tsv" in fmt:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user