From 60f024fdb7d162c88c832a7f88cce338708b1827 Mon Sep 17 00:00:00 2001 From: Tron Date: Sun, 14 Oct 2018 15:47:58 -0500 Subject: [PATCH] Try loading smaller variants if scaled icons are missing. pyfa-org/Pyfa/#1769 --- gui/bitmap_loader.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/gui/bitmap_loader.py b/gui/bitmap_loader.py index dd7b3cc00..f2409bc60 100644 --- a/gui/bitmap_loader.py +++ b/gui/bitmap_loader.py @@ -84,10 +84,15 @@ class BitmapLoader(object): if cls.scaling_factor is None: import gui.mainFrame cls.scaling_factor = int(gui.mainFrame.MainFrame.getInstance().GetContentScaleFactor()) - scale = cls.scaling_factor - filenameScaled = "{0}@{1}x.png".format(name, scale) - img = cls.loadImage(filenameScaled, location) + scaledNameTemplate = "{0}@{1}x.png" + img = None + scale = cls.scaling_factor + 1 + + while img is None and scale > 1: + scale -= 1 + filename = scaledNameTemplate.format(name, scale) + img = cls.loadImage(filename, location) if img is None: # can't find the scaled image, fallback to no scaling