Check that pins exist,
make visible when "hide disconnected" is active
This commit is contained in:
parent
514c26fcc7
commit
304b8df0be
@ -142,7 +142,6 @@ class Connector:
|
|||||||
hide_disconnected_pins: bool = False
|
hide_disconnected_pins: bool = False
|
||||||
autogenerate: bool = False
|
autogenerate: bool = False
|
||||||
loops: List[List[Pin]] = field(default_factory=list)
|
loops: List[List[Pin]] = field(default_factory=list)
|
||||||
loop_color: Optional[Color] = "WH"
|
|
||||||
ignore_in_bom: bool = False
|
ignore_in_bom: bool = False
|
||||||
additional_components: List[AdditionalComponent] = field(default_factory=list)
|
additional_components: List[AdditionalComponent] = field(default_factory=list)
|
||||||
|
|
||||||
@ -179,11 +178,13 @@ class Connector:
|
|||||||
self.show_pincount = self.style != 'simple' # hide pincount for simple (1 pin) connectors by default
|
self.show_pincount = self.style != 'simple' # hide pincount for simple (1 pin) connectors by default
|
||||||
|
|
||||||
for loop in self.loops:
|
for loop in self.loops:
|
||||||
# TODO: check that pins to connect actually exist
|
# check that pins to connect actually exist
|
||||||
# TODO: allow using pin labels in addition to pin numbers, just like when defining regular connections
|
if type(loop) == dict:
|
||||||
# TODO: include properties of wire used to create the loop
|
loop = list(loop.values())[0]
|
||||||
if len(loop) != 2:
|
for pin in loop:
|
||||||
raise Exception('Loops must be between exactly two pins!')
|
if not ((self.pins.count(pin) == 1) or (self.pinlabels.count == 1)):
|
||||||
|
raise Exception(f"Didn't find exactly one {self.name}:{pin} to loop into")
|
||||||
|
self.activate_pin(pin)
|
||||||
|
|
||||||
for i, item in enumerate(self.additional_components):
|
for i, item in enumerate(self.additional_components):
|
||||||
if isinstance(item, dict):
|
if isinstance(item, dict):
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user