Skip to content

Commit

Permalink
Fix compatibility with nightly
Browse files Browse the repository at this point in the history
  • Loading branch information
qu1ck committed Jul 20, 2023
1 parent a31399a commit e70b8b6
Showing 1 changed file with 13 additions and 6 deletions.
19 changes: 13 additions & 6 deletions InteractiveHtmlBom/ecad/kicad.py
Expand Up @@ -34,23 +34,30 @@ def get_extra_field_data(self, file_name):

return ExtraFieldData(data[0], data[1])

@staticmethod
def get_footprint_fields(f):
# type: (pcbnew.FOOTPRINT) -> dict
if hasattr(f, "GetProperties"):
return f.GetProperties()
if hasattr(f, "GetFields"):
return f.GetFieldsShownText()
return {}

def parse_extra_data_from_pcb(self):
field_set = set()
by_ref = {}
by_index = {}

for f in self.footprints: # type: pcbnew.FOOTPRINT
props = f.GetProperties()
for (i, f) in enumerate(self.footprints):
props = self.get_footprint_fields(f)
by_index[i] = props
ref = f.GetReference()
ref_fields = by_ref.setdefault(ref, {})

for k, v in props.items():
field_set.add(k)
ref_fields[k] = v

by_index = {
i: f.GetProperties() for (i, f) in enumerate(self.footprints)
}

return ExtraFieldData(list(field_set), by_ref, by_index)

def latest_extra_data(self, extra_dirs=None):
Expand Down

0 comments on commit e70b8b6

Please sign in to comment.