Skip to content

Commit

Permalink
Use findPath to look for an icon and fail silently if it cannot be fo…
Browse files Browse the repository at this point in the history
…und.
  • Loading branch information
mlampert committed Nov 29, 2019
1 parent e2d2983 commit 0ab8f83
Showing 1 changed file with 9 additions and 8 deletions.
17 changes: 9 additions & 8 deletions src/Mod/Path/PathScripts/PathToolBit.py
Expand Up @@ -258,14 +258,15 @@ def _setupBitShape(self, obj, path=None):

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:
Expand Down

0 comments on commit 0ab8f83

Please sign in to comment.