Skip to content

Commit

Permalink
Prevent file not exist for background image file
Browse files Browse the repository at this point in the history
  • Loading branch information
mlouielu committed May 16, 2019
1 parent 74645dc commit 8111874
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
5 changes: 4 additions & 1 deletion guake/gsettings.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
Boston, MA 02110-1301 USA
"""
import logging
import os
import subprocess

from xml.sax.saxutils import escape as xml_escape
Expand Down Expand Up @@ -170,7 +171,9 @@ def cursor_shape_changed(self, settings, key, user_data):
def background_image_file_changed(self, settings, key, user_data):
"""Called when the background image file settings has been changed
"""
self.guake.background_image_manager.load_from_file(settings.get_string(key))
filename = settings.get_string(key)
if not filename or os.path.exists(filename):
self.guake.background_image_manager.load_from_file(settings.get_string(key))

def background_image_layout_mode_changed(self, settings, key, user_data):
"""Called when the background image layout mode settings has been changed
Expand Down
6 changes: 3 additions & 3 deletions guake/prefs.py
Original file line number Diff line number Diff line change
Expand Up @@ -1292,9 +1292,9 @@ def load_configs(self):
self.get_widget('bold_is_bright').set_active(value)

# background image file
value = self.settings.general.get_string('background-image-file')
if value:
self.get_widget('background_image_filechooser').set_filename(value)
filename = self.settings.general.get_string('background-image-file')
if os.path.exists(filename):
self.get_widget('background_image_filechooser').set_filename(filename)

# background image layout mode
value = self.settings.general.get_int('background-image-layout-mode')
Expand Down

0 comments on commit 8111874

Please sign in to comment.