@@ -31,9 +31,11 @@ def __init__(self, file_name, config, logger, board=None):
3131 if self .board is None :
3232 self .board = pcbnew .LoadBoard (self .file_name ) # type: pcbnew.BOARD
3333 if hasattr (self .board , 'GetModules' ):
34- self .footprints = list (self .board .GetModules ()) # type: list[pcbnew.MODULE]
34+ # type: list[pcbnew.MODULE]
35+ self .footprints = list (self .board .GetModules ())
3536 else :
36- self .footprints = list (self .board .GetFootprints ()) # type: list[pcbnew.FOOTPRINT]
37+ # type: list[pcbnew.FOOTPRINT]
38+ self .footprints = list (self .board .GetFootprints ())
3739 self .font_parser = FontParser ()
3840
3941 def get_extra_field_data (self , file_name ):
@@ -273,7 +275,8 @@ def parse_text(self, d):
273275 "svgpath" : create_path (lines )
274276 }
275277 elif hasattr (d , 'GetEffectiveTextShape' ):
276- shape = d .GetEffectiveTextShape (False ) # type: pcbnew.SHAPE_COMPOUND
278+ # type: pcbnew.SHAPE_COMPOUND
279+ shape = d .GetEffectiveTextShape (False )
277280 segments = []
278281 polygons = []
279282 for s in shape .GetSubshapes ():
@@ -426,7 +429,7 @@ def get_all_drawings(self):
426429 for d in f .GraphicalItems ():
427430 drawings .append ((d .GetClass (), d ))
428431 if hasattr (f , "GetFields" ):
429- fields = f .GetFields () # type: list[pcbnew.PCB_FIELD]
432+ fields = f .GetFields () # type: list[pcbnew.PCB_FIELD]
430433 for field in fields :
431434 if field .IsReference () or field .IsValue ():
432435 continue
@@ -450,11 +453,15 @@ def parse_pad(self, pad):
450453 custom_padstack = False
451454 outer_layers = [(pcbnew .F_Cu , "F" ), (pcbnew .B_Cu , "B" )]
452455 if hasattr (pad , 'Padstack' ):
453- padstack = pad .Padstack () # type: pcbnew.PADSTACK
456+ padstack = pad .Padstack () # type: pcbnew.PADSTACK
454457 layers_set = list (padstack .LayerSet ().Seq ())
458+ if hasattr (pcbnew , "UNCONNECTED_LAYER_MODE_REMOVE_ALL" ):
459+ ULMRA = pcbnew .UNCONNECTED_LAYER_MODE_REMOVE_ALL
460+ else :
461+ ULMRA = padstack .UNCONNECTED_LAYER_MODE_REMOVE_ALL
455462 custom_padstack = (
456- padstack .Mode () != padstack .MODE_NORMAL or \
457- padstack .UnconnectedLayerMode () == padstack . UNCONNECTED_LAYER_MODE_REMOVE_ALL
463+ padstack .Mode () != padstack .MODE_NORMAL or
464+ padstack .UnconnectedLayerMode () == ULMRA
458465 )
459466 else :
460467 layers_set = list (pad .GetLayerSet ().Seq ())
0 commit comments