(cls, name, location)
| 88 | |
| 89 | @classmethod |
| 90 | def loadBitmap(cls, name, location): |
| 91 | if cls.scaling_factor is None: |
| 92 | cls.scaling_factor = 1 if 'wxGTK' in wx.PlatformInfo else int(wx.GetApp().GetTopWindow().GetContentScaleFactor()) |
| 93 | scale = cls.scaling_factor |
| 94 | |
| 95 | filename, img = cls.loadScaledBitmap(name, location, scale) |
| 96 | |
| 97 | while img is None and scale > 0: |
| 98 | # can't find the correctly scaled image, fallback to smaller scales |
| 99 | scale -= 1 |
| 100 | filename, img = cls.loadScaledBitmap(name, location, scale) |
| 101 | |
| 102 | if img is None: |
| 103 | pyfalog.warning("Missing icon file: {0}/{1}".format(location, filename)) |
| 104 | return None |
| 105 | |
| 106 | if scale > 1: |
| 107 | return img.Scale(round(img.GetWidth() // scale), round(img.GetHeight() // scale)).ConvertToBitmap() |
| 108 | return img.ConvertToBitmap() |
| 109 | |
| 110 | @classmethod |
| 111 | def loadScaledBitmap(cls, name, location, scale=0): |
no test coverage detected