def CreateBitmap(self, artid, client, size): if not artid.startswith('priv'): return wx.NullBitmap artid = artid.split('/')[1:] # Split path and remove 'priv' artid = '/'.join(artid) # rejoin remaining parts fpath = appconstants.getdatapath(artid) return wx.Bitmap(fpath, wx.BITMAP_TYPE_ANY)
def FillTextCtrl(self, textctrl, fname, srcdir='appdir'): if srcdir == 'appdir': fpath = appconstants.getapppath(fname) else: fpath = appconstants.getdatapath(fname) try: f = open(fpath, 'r') except IOError: fcontent = fname + filemissing + appconstants.AppURL else: fcontent = f.read() textctrl.SetFont(self.font) textctrl.SetValue(fcontent) winDC = wx.ClientDC(textctrl) width, height = winDC.GetTextExtent('-' * 82) height *= 26 textctrl.SetMinSize(wx.Size(width, height))