Use findPath to look for an icon and fail silently if it cannot be found.

This commit is contained in:
Markus Lampert
2019-11-01 22:40:20 -07:00
parent e2d2983c08
commit 0ab8f83ea9

View File

@@ -258,14 +258,15 @@ class ToolBit(object):
def getBitThumbnail(self, obj):
if obj.BitShape:
with open(obj.BitShape, 'rb') as fd:
zf = zipfile.ZipFile(fd)
pf = zf.open('thumbnails/Thumbnail.png', 'r')
data = pf.read()
pf.close()
return data
else:
return None
path = findShape(obj.BitShape)
if path:
with open(path, 'rb') as fd:
zf = zipfile.ZipFile(fd)
pf = zf.open('thumbnails/Thumbnail.png', 'r')
data = pf.read()
pf.close()
return data
return None
def saveToFile(self, obj, path, setFile=True):
try: