def listALL(model): try: model.clear() for i in os.listdir(os.path.expanduser("~/.kbi/databases/")): if i.endswith(".dat"): com = sqlite.connect(os.path.expanduser("~/.kbi/databases/"+i)) cur = com.cursor() cur.execute("select name, category from code order by category, name") for (n,c) in cur: kbi_ui.insert_item(model, None, n,c,i) com.close() except IOError: print "E: listALL()"
def search(model, word): try: model.clear() for i in os.listdir(os.path.expanduser("~/.kbi/databases/")): if i.endswith(".dat"): print "Searching: "+i con = sqlite.connect(os.path.expanduser("~/.kbi/databases/"+i)) cur = con.cursor() cur.execute("select name, category from code where name like:word", locals()) for (n,c) in cur: kbi_ui.insert_item(model, None,n,c, i) con.close() except IOError: print "E: search()" sys.exit(-1)