from list import List class Queue(List): def __init__(self,data,funcs): List.__init__(self,data,"Queue",funcs) self.data = data self.count = len(self.data.curQ) self.makeLabel() # Returns true if we had a song to load, false otherwise def getNext(self): # Populate the queue if self.populated == False: self.populate() # No songs in queue, return false if len(self.list) == 0: return False # Queue ignores random settings and filtering, just takes next song self.data.curSong = self.list[0][0] # Remove file from queue and tree for i in range(len(self.data.curQ)): if self.data.curQ[i].id == self.data.curSong: self.data.curQ.pop(i) break self.remove(self.list.get_iter_root()) # Load song and update the label self.filterQuick(self.string) self.loadSong(self.data.library.files[self.data.curSong]) return True # Inselt a song into the queue # Updates the visible treeview and the self.data.curQ array def insert(self,file): if self.populated == False: self.populate() List.insert(self,file) self.data.curQ += [file] # Shows and hides the treeview, populates if empty def visible(self,func): List.visible(self,func) if (func == "show") and (self.populated == False): self.populate() # Populate the list def populate(self): for file in self.data.curQ: List.insert(self,file) List.populate(self) # Filters things quicker because it does not have to show/hide rows # This is only called for offscreen tabs def filterQuick(self,string): List.filterQuick(self,self.data.curQ,string)