Fixed get_components.

This commit is contained in:
Salvador E. Tropea 2021-02-04 16:25:59 -03:00
parent 437f922341
commit 536fa4708a
1 changed files with 6 additions and 3 deletions

View File

@ -1476,9 +1476,12 @@ class Schematic(object):
files.update(sch.sheet.get_files()) files.update(sch.sheet.get_files())
return list(files) return list(files)
def get_components(self): def get_components(self, exclude_power=True):
""" A list of all the components. Power excluded. """ """ A list of all the components. """
components = [c for c in self.components if not c.is_power] if exclude_power:
components = [c for c in self.components if not c.is_power]
else:
components = [c for c in self.components]
for sch in self.sheets: for sch in self.sheets:
components.extend(sch.sheet.get_components(exclude_power)) components.extend(sch.sheet.get_components(exclude_power))
components.sort(key=lambda g: g.ref) components.sort(key=lambda g: g.ref)