Improved startup efficiency, don't store as much for library
git-svn-id: file:///home/anna/Desktop/ocarina-legacy/mithos/ocarina@49 1daee41c-8060-4895-b1f0-2197c00d777a
This commit is contained in:
parent
1a861585a9
commit
d0c4da25fa
|
@ -19,7 +19,7 @@ class LibList(List):
|
|||
self.populated = False
|
||||
#for file in self.data.library.files:
|
||||
# self.insert(file)
|
||||
self.count = len(self.data.library.files)
|
||||
self.count = self.data.library.count#len(self.data.library.files)
|
||||
self.makeLabel()
|
||||
self.makeRCMenu()
|
||||
|
||||
|
@ -55,6 +55,8 @@ class LibList(List):
|
|||
def filterRows(self,string):
|
||||
if self.updating == True:
|
||||
return
|
||||
if self.populated == False:
|
||||
self.visible("show")
|
||||
List.filterRows(self,string)
|
||||
|
||||
|
||||
|
@ -74,3 +76,15 @@ class LibList(List):
|
|||
def addToQueue(self,widgit,func,data):
|
||||
self.selection(self.queue.insert)
|
||||
self.queue.filterRows("")
|
||||
|
||||
|
||||
def filterQuick(self,string):
|
||||
self.count = 0
|
||||
self.seconds = 0
|
||||
self.string = string
|
||||
for i in range(self.data.library.count):
|
||||
if self.hideRows(None,i,string) == True:
|
||||
self.count+=1
|
||||
self.seconds+=self.data.library.files[i].duration
|
||||
print self.count
|
||||
self.makeLabel()
|
||||
|
|
|
@ -149,8 +149,23 @@ class List(gtk.ScrolledWindow):
|
|||
self.timeText()
|
||||
|
||||
|
||||
def filterQuick(self,list,string):
|
||||
self.count = 0
|
||||
self.seconds = 0
|
||||
self.string = string
|
||||
for i in range(len(list)):
|
||||
if self.hideRows(None,list[i],string) == True:
|
||||
self.count+=1
|
||||
self.seconds+=self.data.library.files[i].duration
|
||||
print self.count
|
||||
self.makeLabel()
|
||||
|
||||
|
||||
def hideRows(self,list,iter,string):
|
||||
if list:
|
||||
file = self.data.library.files[list[iter][0]]
|
||||
else:
|
||||
file = self.data.library.files[iter]
|
||||
if self.string == "":
|
||||
return True
|
||||
#elif len(self.string) == 1:
|
||||
|
|
|
@ -26,14 +26,20 @@ class Queue(List):
|
|||
|
||||
def insert(self,file):
|
||||
List.insert(self,file)
|
||||
self.data.curQ += [file.id]
|
||||
self.data.curQ += [file]
|
||||
|
||||
|
||||
def visible(self,func):
|
||||
List.visible(self,func)
|
||||
if (func == "show") and (self.populated == False):
|
||||
for file in self.data.curQ:
|
||||
List.insert(self,self.data.library.files[file])
|
||||
List.insert(self,file)
|
||||
self.populated = True
|
||||
self.makeLabel()
|
||||
self.timeText()
|
||||
|
||||
|
||||
def filterRows(self,string):
|
||||
if self.populated == False:
|
||||
self.visible("show")
|
||||
List.filterRows(self,string)
|
||||
|
|
|
@ -216,7 +216,14 @@ class RightPane(gtk.VBox):
|
|||
|
||||
|
||||
def filter(self,search):
|
||||
tabs = []
|
||||
if self.curTab == 0:
|
||||
self.playlist.filterRows(search)
|
||||
self.library.filterQuick(search)
|
||||
elif self.curTab == 1:
|
||||
self.queue.filterRows(search)
|
||||
else:
|
||||
self.library.filterRows(search)
|
||||
'''tabs = []
|
||||
if self.curTab == 0:
|
||||
#self.playlist.filterRows(search)
|
||||
tabs = [0,1,2]
|
||||
|
@ -233,7 +240,7 @@ class RightPane(gtk.VBox):
|
|||
elif tab == 1:
|
||||
self.queue.filterRows(search)
|
||||
else:
|
||||
self.library.filterRows(search)
|
||||
self.library.filterRows(search)'''
|
||||
|
||||
|
||||
def setStatus(self,status):
|
||||
|
|
Loading…
Reference in New Issue