guard against missing image files in themes

Fixes: https://launchpad.net/bugs/1071170
This commit is contained in:
Tim Bentley 2012-11-16 19:15:36 +00:00
parent 5646183803
commit fb558935ca

View File

@ -126,7 +126,9 @@ class Image(object):
self.priority = Priority.Normal self.priority = Priority.Normal
self.source = source self.source = source
self.background = background self.background = background
self.timestamp = os.stat(path).st_mtime self.timestamp = 0
if os.path.exists(path):
self.timestamp = os.stat(path).st_mtime
self.secondary_priority = Image.secondary_priority self.secondary_priority = Image.secondary_priority
Image.secondary_priority += 1 Image.secondary_priority += 1
@ -296,9 +298,11 @@ class ImageManager(QtCore.QObject):
# Check if the there are any images with the same path and check if the # Check if the there are any images with the same path and check if the
# timestamp has changed. # timestamp has changed.
for image in self._cache.values(): for image in self._cache.values():
if image.path == path and image.timestamp != os.stat(path).st_mtime: if os.path.exists(path):
image.timestamp = os.stat(path).st_mtime if image.path == path and \
self._resetImage(image) image.timestamp != os.stat(path).st_mtime:
image.timestamp = os.stat(path).st_mtime
self._resetImage(image)
# We want only one thread. # We want only one thread.
if not self.imageThread.isRunning(): if not self.imageThread.isRunning():
self.imageThread.start() self.imageThread.start()