Skip to content

Commit

Permalink
framedImage.py: Just silently fail if a downloaded image fails to
Browse files Browse the repository at this point in the history
  • Loading branch information
mtwebster committed Jan 9, 2017
1 parent 0063d84 commit 935cde4
Showing 1 changed file with 10 additions and 4 deletions.
14 changes: 10 additions & 4 deletions src/widgets/framedImage.py
Expand Up @@ -67,8 +67,11 @@ def generate_image(self):
self.set_size_request(-1, self.get_theme_height())

if self.path:
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(self.path, -1, self.get_theme_height(), True)
self.set_from_pixbuf(pixbuf)
try:
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(self.path, -1, self.get_theme_height(), True)
self.set_from_pixbuf(pixbuf)
except:
self.clear_image()
self.emit("pixbuf-changed", pixbuf)

elif self.file:
Expand Down Expand Up @@ -100,8 +103,11 @@ def load_contents_async_callback(self, file, result, data=None):
def on_file_written(self, file, result, data=None):
try:
if file.replace_contents_finish(result):
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(file.get_path(), -1, self.get_theme_height(), True)
self.set_from_pixbuf(pixbuf)
try:
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_scale(file.get_path(), -1, self.get_theme_height(), True)
self.set_from_pixbuf(pixbuf)
except:
self.clear_image()
self.emit("pixbuf-changed", pixbuf)
except GLib.Error:
pass

0 comments on commit 935cde4

Please sign in to comment.