Merge branch 'hd-images' into release/v2.5.0
@@ -45,6 +45,8 @@ class BitmapLoader(object):
|
||||
dont_use_cached_bitmaps = False
|
||||
max_cached_bitmaps = 500
|
||||
|
||||
scaling_factor = None
|
||||
|
||||
@classmethod
|
||||
def getStaticBitmap(cls, name, parent, location):
|
||||
static = wx.StaticBitmap(parent)
|
||||
@@ -54,9 +56,7 @@ class BitmapLoader(object):
|
||||
@classmethod
|
||||
def getBitmap(cls, name, location):
|
||||
if cls.dont_use_cached_bitmaps:
|
||||
img = cls.getImage(name, location)
|
||||
if img is not None:
|
||||
return img.ConvertToBitmap()
|
||||
return cls.loadBitmap(name, location)
|
||||
|
||||
path = "%s%s" % (name, location)
|
||||
|
||||
@@ -64,11 +64,7 @@ class BitmapLoader(object):
|
||||
cls.cached_bitmaps.popitem(False)
|
||||
|
||||
if path not in cls.cached_bitmaps:
|
||||
img = cls.getImage(name, location)
|
||||
if img is not None:
|
||||
bmp = img.ConvertToBitmap()
|
||||
else:
|
||||
bmp = None
|
||||
bmp = cls.loadBitmap(name, location)
|
||||
cls.cached_bitmaps[path] = bmp
|
||||
else:
|
||||
bmp = cls.cached_bitmaps[path]
|
||||
@@ -77,8 +73,34 @@ class BitmapLoader(object):
|
||||
|
||||
@classmethod
|
||||
def getImage(cls, name, location):
|
||||
filename = "{0}.png".format(name)
|
||||
return cls.getBitmap(name, location).ConvertToImage()
|
||||
|
||||
@classmethod
|
||||
def loadBitmap(cls, name, location):
|
||||
if cls.scaling_factor is None:
|
||||
import gui.mainFrame
|
||||
cls.scaling_factor = int(gui.mainFrame.MainFrame.getInstance().GetContentScaleFactor())
|
||||
scale = cls.scaling_factor
|
||||
print(cls.scaling_factor)
|
||||
filenameScaled = "{0}@{1}x.png".format(name, scale)
|
||||
img = cls.loadImage(filenameScaled, location)
|
||||
|
||||
if img is None:
|
||||
# can't find the scaled image, fallback to no scaling
|
||||
filename = "{0}.png".format(name)
|
||||
img = cls.loadImage(filename, location)
|
||||
scale = 1
|
||||
|
||||
if img is None:
|
||||
return None
|
||||
|
||||
bmp: wx.Bitmap = img.ConvertToBitmap()
|
||||
if scale > 1:
|
||||
bmp.SetSize((int(bmp.GetWidth()/scale), int(bmp.GetHeight()/scale)))
|
||||
return bmp
|
||||
|
||||
@classmethod
|
||||
def loadImage(cls, filename, location):
|
||||
if cls.archive:
|
||||
path = os.path.join(location, filename)
|
||||
if os.sep != "/" and os.sep in path:
|
||||
|
||||
|
Before Width: | Height: | Size: 452 B After Width: | Height: | Size: 452 B |
BIN
imgs/icons/0@2x.png
Normal file
|
After Width: | Height: | Size: 1.1 KiB |
|
Before Width: | Height: | Size: 703 B After Width: | Height: | Size: 703 B |
BIN
imgs/icons/10012@2x.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 699 B After Width: | Height: | Size: 699 B |
BIN
imgs/icons/10013@2x.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 677 B After Width: | Height: | Size: 677 B |
BIN
imgs/icons/10014@2x.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 701 B After Width: | Height: | Size: 701 B |
BIN
imgs/icons/10015@2x.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 725 B After Width: | Height: | Size: 725 B |
BIN
imgs/icons/10016@2x.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 814 B After Width: | Height: | Size: 814 B |
BIN
imgs/icons/10017@2x.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 781 B After Width: | Height: | Size: 781 B |
BIN
imgs/icons/10018@2x.png
Normal file
|
After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 761 B After Width: | Height: | Size: 761 B |
BIN
imgs/icons/10019@2x.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 915 B After Width: | Height: | Size: 915 B |
BIN
imgs/icons/10020@2x.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 898 B After Width: | Height: | Size: 898 B |
BIN
imgs/icons/10021@2x.png
Normal file
|
After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 894 B After Width: | Height: | Size: 894 B |
BIN
imgs/icons/10022@2x.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 837 B After Width: | Height: | Size: 837 B |
BIN
imgs/icons/10023@2x.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 938 B After Width: | Height: | Size: 938 B |
BIN
imgs/icons/10024@2x.png
Normal file
|
After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 944 B After Width: | Height: | Size: 944 B |
BIN
imgs/icons/10025@2x.png
Normal file
|
After Width: | Height: | Size: 2.8 KiB |
|
Before Width: | Height: | Size: 927 B After Width: | Height: | Size: 927 B |
BIN
imgs/icons/10026@2x.png
Normal file
|
After Width: | Height: | Size: 2.7 KiB |
|
Before Width: | Height: | Size: 962 B After Width: | Height: | Size: 962 B |
BIN
imgs/icons/10027@2x.png
Normal file
|
After Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 696 B After Width: | Height: | Size: 696 B |
BIN
imgs/icons/10028@2x.png
Normal file
|
After Width: | Height: | Size: 1.8 KiB |
|
Before Width: | Height: | Size: 955 B After Width: | Height: | Size: 955 B |
BIN
imgs/icons/10029@2x.png
Normal file
|
After Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 835 B After Width: | Height: | Size: 835 B |
BIN
imgs/icons/10030@2x.png
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 947 B After Width: | Height: | Size: 947 B |
BIN
imgs/icons/10031@2x.png
Normal file
|
After Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 814 B After Width: | Height: | Size: 814 B |
BIN
imgs/icons/10032@2x.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 894 B After Width: | Height: | Size: 894 B |
BIN
imgs/icons/10033@2x.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 1022 B After Width: | Height: | Size: 1022 B |
BIN
imgs/icons/10034@2x.png
Normal file
|
After Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 1.0 KiB After Width: | Height: | Size: 1.0 KiB |
BIN
imgs/icons/10035@2x.png
Normal file
|
After Width: | Height: | Size: 3.4 KiB |
|
Before Width: | Height: | Size: 937 B After Width: | Height: | Size: 937 B |
BIN
imgs/icons/10036@2x.png
Normal file
|
After Width: | Height: | Size: 3.0 KiB |
|
Before Width: | Height: | Size: 814 B After Width: | Height: | Size: 814 B |
BIN
imgs/icons/10037@2x.png
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 744 B After Width: | Height: | Size: 744 B |
BIN
imgs/icons/10038@2x.png
Normal file
|
After Width: | Height: | Size: 2.0 KiB |
|
Before Width: | Height: | Size: 967 B After Width: | Height: | Size: 967 B |
BIN
imgs/icons/10039@2x.png
Normal file
|
After Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 1002 B After Width: | Height: | Size: 1002 B |
BIN
imgs/icons/10040@2x.png
Normal file
|
After Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 1007 B After Width: | Height: | Size: 1007 B |
BIN
imgs/icons/10041@2x.png
Normal file
|
After Width: | Height: | Size: 3.2 KiB |
|
Before Width: | Height: | Size: 863 B After Width: | Height: | Size: 863 B |
BIN
imgs/icons/10042@2x.png
Normal file
|
After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 774 B After Width: | Height: | Size: 774 B |
BIN
imgs/icons/10043@2x.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 773 B After Width: | Height: | Size: 773 B |
BIN
imgs/icons/10044@2x.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 931 B After Width: | Height: | Size: 931 B |
BIN
imgs/icons/10045@2x.png
Normal file
|
After Width: | Height: | Size: 2.9 KiB |
|
Before Width: | Height: | Size: 831 B After Width: | Height: | Size: 831 B |
BIN
imgs/icons/10046@2x.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 772 B After Width: | Height: | Size: 772 B |
BIN
imgs/icons/10047@2x.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 894 B After Width: | Height: | Size: 894 B |
BIN
imgs/icons/10048@2x.png
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 862 B After Width: | Height: | Size: 862 B |
BIN
imgs/icons/10049@2x.png
Normal file
|
After Width: | Height: | Size: 2.4 KiB |
|
Before Width: | Height: | Size: 800 B After Width: | Height: | Size: 800 B |
BIN
imgs/icons/1004@2x.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 801 B After Width: | Height: | Size: 801 B |
BIN
imgs/icons/10050@2x.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 867 B After Width: | Height: | Size: 867 B |
BIN
imgs/icons/10051@2x.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 907 B After Width: | Height: | Size: 907 B |
BIN
imgs/icons/10052@2x.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 830 B After Width: | Height: | Size: 830 B |
BIN
imgs/icons/10053@2x.png
Normal file
|
After Width: | Height: | Size: 2.6 KiB |
|
Before Width: | Height: | Size: 753 B After Width: | Height: | Size: 753 B |
BIN
imgs/icons/10054@2x.png
Normal file
|
After Width: | Height: | Size: 2.3 KiB |
|
Before Width: | Height: | Size: 759 B After Width: | Height: | Size: 759 B |
BIN
imgs/icons/10055@2x.png
Normal file
|
After Width: | Height: | Size: 2.1 KiB |
|
Before Width: | Height: | Size: 853 B After Width: | Height: | Size: 853 B |
BIN
imgs/icons/10056@2x.png
Normal file
|
After Width: | Height: | Size: 2.5 KiB |
|
Before Width: | Height: | Size: 802 B After Width: | Height: | Size: 802 B |
BIN
imgs/icons/10057@2x.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 774 B After Width: | Height: | Size: 774 B |
BIN
imgs/icons/10058@2x.png
Normal file
|
After Width: | Height: | Size: 2.2 KiB |
|
Before Width: | Height: | Size: 658 B After Width: | Height: | Size: 658 B |