mirror of
https://github.com/lutris/lutris
synced 2024-09-19 07:41:33 +00:00
Always return a pixbuf (and of the correct size) for get_pixbuf
This commit is contained in:
parent
9f23c629f0
commit
43999c3cc8
|
@ -43,7 +43,6 @@ def get_pixbuf(image, size, fallback=None, is_installed=True):
|
|||
"""Return a pixbuf from file `image` at `size` or fallback to `fallback`"""
|
||||
width, height = size
|
||||
pixbuf = None
|
||||
|
||||
if system.path_exists(image):
|
||||
try:
|
||||
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(image, width, height)
|
||||
|
@ -53,8 +52,9 @@ def get_pixbuf(image, size, fallback=None, is_installed=True):
|
|||
if system.path_exists(fallback):
|
||||
pixbuf = GdkPixbuf.Pixbuf.new_from_file_at_size(fallback, width, height)
|
||||
if not pixbuf:
|
||||
return None
|
||||
return GdkPixbuf.Pixbuf.new(GdkPixbuf.Colorspace.RGB, True, 8, width, height)
|
||||
if is_installed:
|
||||
pixbuf = pixbuf.scale_simple(width, height, GdkPixbuf.InterpType.NEAREST)
|
||||
return pixbuf
|
||||
overlay = os.path.join(datapath.get(), "media/unavailable.png")
|
||||
transparent_pixbuf = get_overlay(overlay, size).copy()
|
||||
|
|
Loading…
Reference in a new issue