@@ -96,6 +96,7 @@ class Connector:
9696 notes : Optional [MultilineHypertext ] = None
9797 pinlabels : List [Pin ] = field (default_factory = list )
9898 pins : List [Pin ] = field (default_factory = list )
99+ pincolors : List [Color ] = field (default_factory = list )
99100 color : Optional [Color ] = None
100101 show_name : Optional [bool ] = None
101102 show_pincount : Optional [bool ] = None
@@ -119,23 +120,14 @@ def __post_init__(self) -> None:
119120 raise Exception ('Connectors with style set to simple may only have one pin' )
120121 self .pincount = 1
121122
122- if self .pincount is None :
123- if self .pinlabels :
124- self .pincount = len (self .pinlabels )
125- elif self .pins :
126- self .pincount = len (self .pins )
127- else :
128- raise Exception ('You need to specify at least one, pincount, pins or pinlabels' )
129-
130- if self .pinlabels and self .pins :
131- if len (self .pinlabels ) != len (self .pins ):
132- raise Exception ('Given pins and pinlabels size mismatch' )
123+ if not self .pincount :
124+ self .pincount = max (len (self .pins ), len (self .pinlabels ), len (self .pincolors ))
125+ if not self .pincount :
126+ raise Exception ('You need to specify at least one, pincount, pins, pinlabels, or pincolors' )
133127
134- # create default lists for pins (sequential) and pinlabels (blank ) if not specified
128+ # create default list for pins (sequential) if not specified
135129 if not self .pins :
136130 self .pins = list (range (1 , self .pincount + 1 ))
137- if not self .pinlabels :
138- self .pinlabels = ['' ] * self .pincount
139131
140132 if len (self .pins ) != len (set (self .pins )):
141133 raise Exception ('Pins are not unique' )
0 commit comments