6c6477b677
I have implemented simple filtering over the library. This will return a set of visible songs based on the search pattern.
24 lines
452 B
Python
24 lines
452 B
Python
# Bryan Schumaker (10/4/2010)
|
|
|
|
import ocarina
|
|
timeout = ocarina.gobject.timeout_add
|
|
gtk = ocarina.gtk
|
|
|
|
tabs = ocarina.tabs
|
|
|
|
class FilterEntry(gtk.Entry):
|
|
def __init__(self):
|
|
gtk.Entry.__init__(self)
|
|
self.connect("changed", self.changed)
|
|
self.show()
|
|
self.count = 0
|
|
|
|
def changed(self, entry):
|
|
self.count += 1
|
|
timeout(200, self.filter, entry.get_text())
|
|
|
|
def filter(self, text):
|
|
self.count -= 1
|
|
if self.count == 0:
|
|
tabs.filter(text)
|