def __init__(self, parent, ID=-1, pos=wx.DefaultPosition, size=wx.DefaultSize, style=wx.LC_REPORT|wx.LC_NO_HEADER|wx.LC_SINGLE_SEL|wx.LC_VIRTUAL): wx.ListCtrl.__init__(self, parent, ID, style=style) listmix.ListCtrlAutoWidthMixin.__init__(self) font = self.GetFont() font.SetPointSize(API.config.fontsize) self.SetFont(font) self.InsertColumn(0, "First") self.attr1 = wx.ListItemAttr() self.attr1.SetBackgroundColour("black") font.SetPointSize(API.config.fontsize) self.attr1.SetFont(font) self.attr2 = wx.ListItemAttr() self.attr2.SetBackgroundColour("black") font.SetPointSize(API.config.fontsize - 10) self.attr2.SetFont(font) # set up image list and default icon_size = [API.config.fontsize]*2 self.lst = wx.ImageList(*icon_size) self.default_idx = self.lst.Add(wx.EmptyImage(*icon_size).ConvertToBitmap()) # index our covers self.artcache = covers.cache_covers(API.config.mp3path, icon_size) self.idx_cache = {} for key, bmp in self.artcache.items(): self.idx_cache[key] = self.lst.Add(bmp) self.SetImageList(self.lst, wx.IMAGE_LIST_SMALL) utils.setColours(self, foreground="white")
def __init__(self, parent): ListboxPlugin.__init__(self, parent) self.artcache = covers.cache_covers(API.config.mp3path, [80, 80]) # Top level lists as we hit escape self.levelorder = ( ("Albums", API.library.get_album_names), ("Artists", API.library.get_artist_names), ("Songs", API.library.get_song_names), ("Genres", API.library.get_genres), ("Playlists", API.library.get_playlists), ) # start on levelindex + 1 (songs) # start on songs because otherwise # you'll see horizontal scrollbars self.levelindex = 1 # initially populate with our list self.history = [] # get our items self.all = (("All", None, None),) title, items = self.get_next_level() self.update_titles(title) # sets up a scrolling list of items self.listbox.Bind(wx.EVT_LEFT_UP, self.on_click) self.listbox.set_items(items) self.Bind(wx.EVT_SET_FOCUS, self.on_focus) mg = MouseGestures(self, Auto=False, MouseButton=wx.MOUSE_BTN_LEFT) mg.SetGesturesVisible(True) mg.AddGesture("D", API.media.change_volume, -0.5) mg.AddGesture("U", API.media.change_volume, 0.5) mg.AddGesture("R", API.media.next) mg.AddGesture("L", API.media.previous) # self.attach_gestures(self.content, mg) API.media.attach("current", self.check_current)