MCPcopy Index your code
hub / github.com/pyfa-org/Pyfa / loadImage

Method loadImage

gui/bitmap_loader.py:128–146  ·  view source on GitHub ↗
(cls, filename, location)

Source from the content-addressed store, hash-verified

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

Callers 1

loadScaledBitmapMethod · 0.80

Calls 1

replaceMethod · 0.80

Tested by

no test coverage detected