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):
34
34
35
35
return ExtraFieldData (data [0 ], data [1 ])
36
36
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
+
37
46
def parse_extra_data_from_pcb (self ):
38
47
field_set = set ()
39
48
by_ref = {}
49
+ by_index = {}
40
50
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
43
54
ref = f .GetReference ()
44
55
ref_fields = by_ref .setdefault (ref , {})
45
56
46
57
for k , v in props .items ():
47
58
field_set .add (k )
48
59
ref_fields [k ] = v
49
60
50
- by_index = {
51
- i : f .GetProperties () for (i , f ) in enumerate (self .footprints )
52
- }
53
-
54
61
return ExtraFieldData (list (field_set ), by_ref , by_index )
55
62
56
63
def latest_extra_data (self , extra_dirs = None ):
You can’t perform that action at this time.
0 commit comments