kicad_netlist_reader.py: Handle gracefully the case when a library symbol is not available for a component
This commit is contained in:
parent
161b4a56fc
commit
538ab0eb3f
|
@ -372,7 +372,7 @@ class comp():
|
||||||
"""
|
"""
|
||||||
|
|
||||||
field = self.element.get("field", "name", name)
|
field = self.element.get("field", "name", name)
|
||||||
if field == "" and libraryToo:
|
if field == "" and libraryToo and self.libpart:
|
||||||
field = self.libpart.getField(name)
|
field = self.libpart.getField(name)
|
||||||
return field
|
return field
|
||||||
|
|
||||||
|
@ -394,13 +394,13 @@ class comp():
|
||||||
|
|
||||||
def getFootprint(self, libraryToo=True):
|
def getFootprint(self, libraryToo=True):
|
||||||
ret = self.element.get("footprint")
|
ret = self.element.get("footprint")
|
||||||
if ret =="" and libraryToo:
|
if ret == "" and libraryToo and self.libpart:
|
||||||
ret = self.libpart.getFootprint()
|
ret = self.libpart.getFootprint()
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
def getDatasheet(self, libraryToo=True):
|
def getDatasheet(self, libraryToo=True):
|
||||||
ret = self.element.get("datasheet")
|
ret = self.element.get("datasheet")
|
||||||
if ret == '' and libraryToo:
|
if ret == "" and libraryToo and self.libpart:
|
||||||
ret = self.libpart.getDatasheet()
|
ret = self.libpart.getDatasheet()
|
||||||
return ret
|
return ret
|
||||||
|
|
||||||
|
@ -408,6 +408,9 @@ class comp():
|
||||||
return self.element.get("tstamp")
|
return self.element.get("tstamp")
|
||||||
|
|
||||||
def getDescription(self):
|
def getDescription(self):
|
||||||
|
if not self.libpart:
|
||||||
|
return ""
|
||||||
|
|
||||||
return self.libpart.getDescription()
|
return self.libpart.getDescription()
|
||||||
|
|
||||||
|
|
||||||
|
@ -681,7 +684,12 @@ class netlist():
|
||||||
ret = c.getField(field, False)
|
ret = c.getField(field, False)
|
||||||
if ret != '':
|
if ret != '':
|
||||||
return ret
|
return ret
|
||||||
return group[0].getLibPart().getField(field)
|
|
||||||
|
libpart = group[0].getLibPart()
|
||||||
|
if not libpart:
|
||||||
|
return ''
|
||||||
|
|
||||||
|
return libpart.getField(field)
|
||||||
|
|
||||||
def getGroupFootprint(self, group):
|
def getGroupFootprint(self, group):
|
||||||
"""Return the whatever is known about the Footprint by consulting each
|
"""Return the whatever is known about the Footprint by consulting each
|
||||||
|
|
Loading…
Reference in New Issue