ocarina/ocarina/components/entry.py

24 lines
461 B
Python

# Bryan Schumaker (10/4/2010)
import ocarina
timeout = ocarina.gobject.timeout_add
gtk = ocarina.gtk
body = ocarina.body
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:
body.cur_page_filter(text)