Added executable chack

This commit is contained in:
Tobias Falk 2024-06-16 14:32:41 +02:00
parent d172407f9d
commit 5260faad98
3 changed files with 21 additions and 24 deletions

View File

@ -87,14 +87,7 @@ tweak: # optional tweaking of .gv output
# on the connector that are to be shorted
# shorts
shorts:
<name>:
pins: <pins>
color: <color> # optional
manufacturer: <manufacturer> # optional
mpn: <mpn> # optional
description: <description> # optional
type: <loop/internal> # optional, default is internal
shorts: <List>
```
## Cable attributes

View File

@ -18,7 +18,7 @@ MultilineHypertext = (
Designator = PlainText # Case insensitive unique name of connector or cable
# 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 = (
PlainText # = Literal['wirecount', 'terminations', 'length', 'total_length']
)
@ -207,18 +207,17 @@ class Connector:
# hide pincount for simple (1 pin) connectors by default
self.show_pincount = self.style != "simple"
# for loop in self.loops:
# # 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
# if len(loop) != 2:
# raise Exception("Loops must be between exactly two pins!")
# for pin in loop:
# if pin not in self.pins:
# raise Exception(
# f'Unknown loop pin "{pin}" for connector "{self.name}"!'
# )
# # Make sure loop connected pins are not hidden.
# self.activate_pin(pin, None)
for loop in self.loops:
# 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
for loopName in loop:
for pin in loop[loopName]:
if pin not in self.pins:
raise Exception(
f'Unknown loop pin "{pin}" for connector "{self.name}"!'
)
# Make sure loop connected pins are not hidden.
self.activate_pin(pin, None)
for i, item in enumerate(self.additional_components):
if isinstance(item, dict):

View File

@ -8,6 +8,7 @@ from itertools import zip_longest
from pathlib import Path
from typing import Any, List, Union
from dataclasses import asdict
from distutils.spawn import find_executable
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
def graphRender(self, type, filename, graph):
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.remove(f"{filename}_tmp.gv")
if find_executable("dot") and find_executable("gvpr") and find_executable("neato"):
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.remove(f"{filename}_tmp.gv")
else:
graph.render(filename=filename) # old rendering methode, befor jumper implementations
@property
def graph(self):