aboutsummaryrefslogtreecommitdiff
path: root/logout-manager.py
diff options
context:
space:
mode:
authorB Stack <bgstack15@gmail.com>2019-06-12 07:12:47 -0400
committerB Stack <bgstack15@gmail.com>2019-06-12 07:12:47 -0400
commitc2456c4bac2c93f500e112dd998e4b781821f7c2 (patch)
tree84fb5620a44d7d3309a8f7b9fa3d54d62f7d6785 /logout-manager.py
parentWIP: add major logic (diff)
downloadlogout-manager-c2456c4bac2c93f500e112dd998e4b781821f7c2.tar.gz
logout-manager-c2456c4bac2c93f500e112dd998e4b781821f7c2.tar.bz2
logout-manager-c2456c4bac2c93f500e112dd998e4b781821f7c2.zip
add icon error handling
Diffstat (limited to 'logout-manager.py')
-rwxr-xr-xlogout-manager.py17
1 files changed, 15 insertions, 2 deletions
diff --git a/logout-manager.py b/logout-manager.py
index d1583e6..33795fd 100755
--- a/logout-manager.py
+++ b/logout-manager.py
@@ -54,8 +54,21 @@ def get_scaled_icon(icon_name, size=24, fallback_icon_name = "", icon_theme = "d
icon_info = this_theme.lookup_icon(icon_name, size, 0)
iconfilename = icon_info.get_filename()
except:
- icon_info = this_theme.lookup_icon(fallback_icon_name, size, 0)
- iconfilename = icon_info.get_filename()
+ try:
+ icon_info = this_theme.lookup_icon(fallback_icon_name, size, 0)
+ iconfilename = icon_info.get_filename()
+ except:
+ # no icon in the current theme. Try a hard-coded fallback:
+ try:
+ # if debuglev 3
+ print("Error: could not find default icon for",icon_name+", so using fallback.")
+ this_theme = Gtk.IconTheme.new()
+ this_theme.set_custom_theme("Numix-Circle")
+ icon_info = this_theme.lookup_icon(icon_name, size, 0)
+ iconfilename = icon_info.get_filename()
+ except:
+ print("Error: Could not find any icon for",icon_name)
+ return None
#print(iconfilename)
return Gtk.Image.new_from_pixbuf(Pixbuf.new_from_file_at_scale(
filename=iconfilename,
bgstack15