File tree Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Expand file tree Collapse file tree 1 file changed +13
-6
lines changed Original file line number Diff line number Diff line change @@ -34,23 +34,30 @@ def get_extra_field_data(self, file_name):
3434
3535 return ExtraFieldData (data [0 ], data [1 ])
3636
37+ @staticmethod
38+ def get_footprint_fields (f ):
39+ # type: (pcbnew.FOOTPRINT) -> dict
40+ if hasattr (f , "GetProperties" ):
41+ return f .GetProperties ()
42+ if hasattr (f , "GetFields" ):
43+ return f .GetFieldsShownText ()
44+ return {}
45+
3746 def parse_extra_data_from_pcb (self ):
3847 field_set = set ()
3948 by_ref = {}
49+ by_index = {}
4050
41- for f in self .footprints : # type: pcbnew.FOOTPRINT
42- props = f .GetProperties ()
51+ for (i , f ) in enumerate (self .footprints ):
52+ props = self .get_footprint_fields (f )
53+ by_index [i ] = props
4354 ref = f .GetReference ()
4455 ref_fields = by_ref .setdefault (ref , {})
4556
4657 for k , v in props .items ():
4758 field_set .add (k )
4859 ref_fields [k ] = v
4960
50- by_index = {
51- i : f .GetProperties () for (i , f ) in enumerate (self .footprints )
52- }
53-
5461 return ExtraFieldData (list (field_set ), by_ref , by_index )
5562
5663 def latest_extra_data (self , extra_dirs = None ):
You can’t perform that action at this time.
0 commit comments