(cls, filename, location)
| 126 | |
| 127 | @classmethod |
| 128 | def loadImage(cls, filename, location): |
| 129 | if cls.archive: |
| 130 | path = os.path.join(location, filename) |
| 131 | if os.sep != "/" and os.sep in path: |
| 132 | path = path.replace(os.sep, "/") |
| 133 | |
| 134 | try: |
| 135 | img_data = cls.archive.read(path) |
| 136 | bbuf = io.BytesIO(img_data) |
| 137 | return wx.Image(bbuf) |
| 138 | except KeyError: |
| 139 | pyfalog.warning("Missing icon file from zip: {0}".format(path)) |
| 140 | else: |
| 141 | path = os.path.join(config.pyfaPath, 'imgs' + os.sep + location + os.sep + filename) |
| 142 | |
| 143 | if os.path.exists(path): |
| 144 | return wx.Image(path) |
| 145 | else: |
| 146 | return None |
no test coverage detected