40 lines
907 B
Python
40 lines
907 B
Python
#! /usr/bin/python
|
|
|
|
# To change this template, choose Tools | Templates
|
|
# and open the template in the editor.
|
|
|
|
__author__="bjschuma"
|
|
__date__ ="$Mar 21, 2010 8:56:41 PM$"
|
|
|
|
import gtk
|
|
import guibuilder
|
|
import ocarina
|
|
import gobject
|
|
|
|
|
|
class EntryFilter(gtk.Entry):
|
|
def __init__(self):
|
|
gtk.Entry.__init__(self)
|
|
self.modify_text(gtk.STATE_ACTIVE,gtk.gdk.Color(0,0,0))
|
|
self.modify_base(gtk.STATE_ACTIVE,gtk.gdk.Color(65535,65535,65535))
|
|
self.connect("changed",self.textTyped)
|
|
self.filterCount = 0;
|
|
self.show()
|
|
|
|
|
|
def textTyped(self,entry):
|
|
ocarina.vars["$filterText"] = entry.get_text().lower()
|
|
self.filterCount += 1
|
|
gobject.timeout_add(100,self.filter)
|
|
|
|
|
|
def filter(self):
|
|
self.filterCount -= 1
|
|
if self.filterCount > 0:
|
|
return
|
|
ocarina.events.start("ocarina-filter-start")
|
|
|
|
|
|
def make_entryfilter(attrs=None):return EntryFilter()
|
|
guibuilder.parts["entryfilter"] = make_entryfilter
|