Added executable chack
This commit is contained in:
parent
d172407f9d
commit
5260faad98
@ -87,14 +87,7 @@ tweak: # optional tweaking of .gv output
|
|||||||
# on the connector that are to be shorted
|
# on the connector that are to be shorted
|
||||||
|
|
||||||
# shorts
|
# shorts
|
||||||
shorts:
|
shorts: <List>
|
||||||
<name>:
|
|
||||||
pins: <pins>
|
|
||||||
color: <color> # optional
|
|
||||||
manufacturer: <manufacturer> # optional
|
|
||||||
mpn: <mpn> # optional
|
|
||||||
description: <description> # optional
|
|
||||||
type: <loop/internal> # optional, default is internal
|
|
||||||
```
|
```
|
||||||
|
|
||||||
## Cable attributes
|
## Cable attributes
|
||||||
|
|||||||
@ -18,7 +18,7 @@ MultilineHypertext = (
|
|||||||
Designator = PlainText # Case insensitive unique name of connector or cable
|
Designator = PlainText # Case insensitive unique name of connector or cable
|
||||||
|
|
||||||
# Literal type aliases below are commented to avoid requiring python 3.8
|
# Literal type aliases below are commented to avoid requiring python 3.8
|
||||||
ConnectorMultiplier = PlainText # = Literal['pincount', 'populated', 'unpopulated', 'shorts']
|
ConnectorMultiplier = PlainText # = Literal['pincount', 'populated', 'unpopulated']
|
||||||
CableMultiplier = (
|
CableMultiplier = (
|
||||||
PlainText # = Literal['wirecount', 'terminations', 'length', 'total_length']
|
PlainText # = Literal['wirecount', 'terminations', 'length', 'total_length']
|
||||||
)
|
)
|
||||||
@ -207,18 +207,17 @@ class Connector:
|
|||||||
# hide pincount for simple (1 pin) connectors by default
|
# hide pincount for simple (1 pin) connectors by default
|
||||||
self.show_pincount = self.style != "simple"
|
self.show_pincount = self.style != "simple"
|
||||||
|
|
||||||
# for loop in self.loops:
|
for loop in self.loops:
|
||||||
# # TODO: allow using pin labels in addition to pin numbers, just like when defining regular connections
|
# 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
|
# TODO: include properties of wire used to create the loop
|
||||||
# if len(loop) != 2:
|
for loopName in loop:
|
||||||
# raise Exception("Loops must be between exactly two pins!")
|
for pin in loop[loopName]:
|
||||||
# for pin in loop:
|
if pin not in self.pins:
|
||||||
# if pin not in self.pins:
|
raise Exception(
|
||||||
# raise Exception(
|
f'Unknown loop pin "{pin}" for connector "{self.name}"!'
|
||||||
# f'Unknown loop pin "{pin}" for connector "{self.name}"!'
|
)
|
||||||
# )
|
# Make sure loop connected pins are not hidden.
|
||||||
# # Make sure loop connected pins are not hidden.
|
self.activate_pin(pin, None)
|
||||||
# self.activate_pin(pin, None)
|
|
||||||
|
|
||||||
for i, item in enumerate(self.additional_components):
|
for i, item in enumerate(self.additional_components):
|
||||||
if isinstance(item, dict):
|
if isinstance(item, dict):
|
||||||
|
|||||||
@ -8,6 +8,7 @@ from itertools import zip_longest
|
|||||||
from pathlib import Path
|
from pathlib import Path
|
||||||
from typing import Any, List, Union
|
from typing import Any, List, Union
|
||||||
from dataclasses import asdict
|
from dataclasses import asdict
|
||||||
|
from distutils.spawn import find_executable
|
||||||
|
|
||||||
from graphviz import Graph
|
from graphviz import Graph
|
||||||
|
|
||||||
@ -731,9 +732,13 @@ class Harness:
|
|||||||
|
|
||||||
# This renders the graph with gvpr and neato, this is needed to be able to draw the stright lines for the jumpers
|
# 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):
|
def graphRender(self, type, filename, graph):
|
||||||
|
|
||||||
|
if find_executable("dot") and find_executable("gvpr") and find_executable("neato"):
|
||||||
graph.save(filename=f"{filename}_tmp.gv")
|
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}")
|
os.system(f"dot {filename}_tmp.gv | gvpr -q -cf pin2pin.gvpr | neato -n2 -T{type} -o {filename}.{type}")
|
||||||
os.remove(f"{filename}_tmp.gv")
|
os.remove(f"{filename}_tmp.gv")
|
||||||
|
else:
|
||||||
|
graph.render(filename=filename) # old rendering methode, befor jumper implementations
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def graph(self):
|
def graph(self):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user