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
|
self.populated = False
|
||||||
#for file in self.data.library.files:
|
#for file in self.data.library.files:
|
||||||
# self.insert(file)
|
# self.insert(file)
|
||||||
self.count = len(self.data.library.files)
|
self.count = self.data.library.count#len(self.data.library.files)
|
||||||
self.makeLabel()
|
self.makeLabel()
|
||||||
self.makeRCMenu()
|
self.makeRCMenu()
|
||||||
|
|
||||||
|
@ -55,6 +55,8 @@ class LibList(List):
|
||||||
def filterRows(self,string):
|
def filterRows(self,string):
|
||||||
if self.updating == True:
|
if self.updating == True:
|
||||||
return
|
return
|
||||||
|
if self.populated == False:
|
||||||
|
self.visible("show")
|
||||||
List.filterRows(self,string)
|
List.filterRows(self,string)
|
||||||
|
|
||||||
|
|
||||||
|
@ -74,3 +76,15 @@ class LibList(List):
|
||||||
def addToQueue(self,widgit,func,data):
|
def addToQueue(self,widgit,func,data):
|
||||||
self.selection(self.queue.insert)
|
self.selection(self.queue.insert)
|
||||||
self.queue.filterRows("")
|
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()
|
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):
|
def hideRows(self,list,iter,string):
|
||||||
file = self.data.library.files[list[iter][0]]
|
if list:
|
||||||
|
file = self.data.library.files[list[iter][0]]
|
||||||
|
else:
|
||||||
|
file = self.data.library.files[iter]
|
||||||
if self.string == "":
|
if self.string == "":
|
||||||
return True
|
return True
|
||||||
#elif len(self.string) == 1:
|
#elif len(self.string) == 1:
|
||||||
|
|
|
@ -26,14 +26,20 @@ class Queue(List):
|
||||||
|
|
||||||
def insert(self,file):
|
def insert(self,file):
|
||||||
List.insert(self,file)
|
List.insert(self,file)
|
||||||
self.data.curQ += [file.id]
|
self.data.curQ += [file]
|
||||||
|
|
||||||
|
|
||||||
def visible(self,func):
|
def visible(self,func):
|
||||||
List.visible(self,func)
|
List.visible(self,func)
|
||||||
if (func == "show") and (self.populated == False):
|
if (func == "show") and (self.populated == False):
|
||||||
for file in self.data.curQ:
|
for file in self.data.curQ:
|
||||||
List.insert(self,self.data.library.files[file])
|
List.insert(self,file)
|
||||||
self.populated = True
|
self.populated = True
|
||||||
self.makeLabel()
|
self.makeLabel()
|
||||||
self.timeText()
|
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):
|
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:
|
if self.curTab == 0:
|
||||||
#self.playlist.filterRows(search)
|
#self.playlist.filterRows(search)
|
||||||
tabs = [0,1,2]
|
tabs = [0,1,2]
|
||||||
|
@ -233,7 +240,7 @@ class RightPane(gtk.VBox):
|
||||||
elif tab == 1:
|
elif tab == 1:
|
||||||
self.queue.filterRows(search)
|
self.queue.filterRows(search)
|
||||||
else:
|
else:
|
||||||
self.library.filterRows(search)
|
self.library.filterRows(search)'''
|
||||||
|
|
||||||
|
|
||||||
def setStatus(self,status):
|
def setStatus(self,status):
|
||||||
|
|
Loading…
Reference in New Issue