Added a gobject timeout for filtering. Only filter if no additional text has been typed in the last 250ms
git-svn-id: file:///home/anna/Desktop/ocarina-legacy/mithos/ocarina@53 1daee41c-8060-4895-b1f0-2197c00d777a
This commit is contained in:
parent
860100f13a
commit
e98ebb0bec
Binary file not shown.
Before Width: | Height: | Size: 49 KiB After Width: | Height: | Size: 13 KiB |
|
@ -150,6 +150,7 @@ class List(gtk.ScrolledWindow):
|
|||
self.count = len(self.filter)
|
||||
for i in range(self.count):
|
||||
self.seconds+=self.data.library.files[self.filter[i][0]].duration
|
||||
self.gotoCurSong()
|
||||
self.makeLabel()
|
||||
self.timeText()
|
||||
|
||||
|
|
|
@ -57,6 +57,7 @@ class RightPane(gtk.VBox):
|
|||
|
||||
#self.changedTab(None,None,0)
|
||||
self.status = ""
|
||||
self.filterCount = 0
|
||||
|
||||
|
||||
def setLabels(self):
|
||||
|
@ -221,15 +222,22 @@ class RightPane(gtk.VBox):
|
|||
|
||||
|
||||
# text was typed, refilter rows
|
||||
# IDEA: refilter in half a second, if no additional text was typed
|
||||
# Arrange to filter rows in 250ms, as long as no additional text has been typed
|
||||
def textTyped(self,entry):
|
||||
search = entry.get_text().lower()
|
||||
self.filter(search)
|
||||
self.filterCount+=1
|
||||
gobject.timeout_add(250,self.filter,search)
|
||||
|
||||
|
||||
# Filter the rows of the current tab
|
||||
# Do a quickFilter on nonvisible tabs
|
||||
# Decrements self.filterCount
|
||||
def filter(self,search):
|
||||
# If filterCount is 0, no additional text has been typed
|
||||
self.filterCount -= 1
|
||||
if self.filterCount > 0:
|
||||
return
|
||||
# It is ok to filter rows
|
||||
if self.curTab == 0:
|
||||
self.playlist.filterRows(search)
|
||||
tabs = [1,2]
|
||||
|
|
Loading…
Reference in New Issue