83 lines
1.8 KiB
Python
83 lines
1.8 KiB
Python
import gtk
|
|
import gobject
|
|
import thread
|
|
from list import List
|
|
from menuItem import MenuItem
|
|
|
|
class LibList(List):
|
|
def __init__(self,data,playlist,queue,nextFunc,labelFunc,plause):
|
|
List.__init__(self,data,"Library",nextFunc,labelFunc,plause)
|
|
self.plist = playlist
|
|
self.queue = queue
|
|
self.pbar = gtk.ProgressBar()
|
|
|
|
self.pbaralign = gtk.Alignment(0,0,0,0)
|
|
self.pbaralign.add(self.pbar)
|
|
self.pbaralign.show()
|
|
self.updating = False
|
|
|
|
self.populated = False
|
|
#for file in self.data.library.files:
|
|
# self.insert(file)
|
|
self.count = self.data.library.count#len(self.data.library.files)
|
|
self.makeLabel()
|
|
self.makeRCMenu()
|
|
|
|
|
|
def updates(self):
|
|
self.pbar.show()
|
|
self.updating = True
|
|
gobject.timeout_add(500,self.updateLibview)
|
|
|
|
|
|
def visible(self,func):
|
|
List.visible(self,func)
|
|
if (func == "show") and (self.populated == False):
|
|
for file in self.data.library.files:
|
|
List.insert(self,file)
|
|
self.populated = True
|
|
self.makeLabel()
|
|
self.timeText()
|
|
|
|
def stopUpdates(self):
|
|
self.updating = False
|
|
self.pbar.hide()
|
|
self.data.dump()
|
|
|
|
|
|
def updateLibview(self):
|
|
self.pbar.pulse()
|
|
self.makeLabel()
|
|
self.timeText()
|
|
return self.updating
|
|
|
|
|
|
def filterRows(self,string):
|
|
if self.updating == True:
|
|
return
|
|
if self.populated == False:
|
|
self.visible("show")
|
|
List.filterRows(self,string)
|
|
|
|
|
|
def makeRCMenu(self):
|
|
List.makeRCMenu(self)
|
|
toQ = MenuItem("Add to queue",self.addToQueue,None,None,None)
|
|
self.rcmenu.prepend(toQ)
|
|
toPlist = MenuItem("Add to playlist",self.addToPlist,None,None,None)
|
|
self.rcmenu.prepend(toPlist)
|
|
|
|
|
|
def addToPlist(self,widgit,func,data):
|
|
self.selection(self.plist.insert)
|
|
self.plist.filterRows("")
|
|
|
|
|
|
def addToQueue(self,widgit,func,data):
|
|
self.selection(self.queue.insert)
|
|
self.queue.filterRows("")
|
|
|
|
|
|
def filterQuick(self,string):
|
|
List.filterQuick(self,self.data.library.files,string)
|