aboutsummaryrefslogtreecommitdiff
path: root/logout-manager-tcl.py
diff options
context:
space:
mode:
authorB Stack <bgstack15@gmail.com>2019-06-20 16:21:27 -0400
committerB Stack <bgstack15@gmail.com>2019-06-20 16:21:27 -0400
commitfcd7eadef9545e9f6c6758eb7a1a26deefaa5ede (patch)
treed34b99fc5e49eb7c36fc615c6461d71b943100c4 /logout-manager-tcl.py
parentWIP: handle failure to load cairo, part 1 (diff)
downloadlogout-manager-fcd7eadef9545e9f6c6758eb7a1a26deefaa5ede.tar.gz
logout-manager-fcd7eadef9545e9f6c6758eb7a1a26deefaa5ede.tar.bz2
logout-manager-fcd7eadef9545e9f6c6758eb7a1a26deefaa5ede.zip
just use an empty icon if not resolvable
Diffstat (limited to 'logout-manager-tcl.py')
-rwxr-xr-xlogout-manager-tcl.py8
1 files changed, 6 insertions, 2 deletions
diff --git a/logout-manager-tcl.py b/logout-manager-tcl.py
index 4d823d5..cc3b2fb 100755
--- a/logout-manager-tcl.py
+++ b/logout-manager-tcl.py
@@ -39,7 +39,7 @@ import lmlib
LM_USE_SVG = 0
try:
- from cairosvgf import svg2png
+ from cairosvg import svg2png
LM_USE_SVG = 1
except:
print("WARNING: Unable to import cairosvg. No svg images will be displayed.")
@@ -274,6 +274,10 @@ def photoimage_from_svg(filename = "",size = "48"):
item = svg2png(url=filename, parent_width = size, parent_height = size)
return ImageTk.PhotoImage(data=item)
+def empty_photoimage(size=24):
+ photo = Image.new("RGBA",[size,size])
+ return ImageTk.PhotoImage(image=photo)
+
def image_from_svg(filename = "",size = "48"):
# open svg
if LM_USE_SVG == 1:
@@ -311,7 +315,7 @@ def get_scaled_icon(icon_name, size = 24, icon_theme = "default", fallback_icon_
except Exception as f:
print("Error with icon file.")
print(f)
- return None
+ return empty_photoimage()
photo.thumbnail(size=[size, size])
try:
photo = ImageTk.PhotoImage(photo)
bgstack15