def GetImage(self, name): from i18n import getImage import cStringIO f = getImage(name) raw = wx.ImageFromStream(cStringIO.StringIO(f.read())).Copy() return wx.BitmapFromImage(raw)
def _getRelImagePath(imgName): f = i18n.getImage(imgName) if f is None: return "" n = f.name if isinstance(n, unicode): n = n.encode(sys.getfilesystemencoding()) #We want a relative directory so #remove CHANDLERHOME from path p = n.split(Globals.chandlerDirectory)[1] #We still want a relative path so strip of the leading #directory path separator if p[0] == os.path.sep: p = p[1:] return unicode(p, sys.getfilesystemencoding())