# Copyright (C) 2009, Tutorius.org # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA import sys, os import gtk class TutorialStoreSearch(gtk.HBox): def __init__(self,controller): gtk.HBox.__init__(self,False, 5) self.controller = controller search_label = gtk.Label('Search :') self.search_box = gtk.Entry(400) in_label = gtk.Label('in') self.search_combobox = gtk.combo_box_new_text() self.search_button = gtk.Button('Search') self.pack_start(search_label, True, True, 5) self.pack_start(self.search_box, True, True, 5) self.pack_start(in_label, True, True, 5) self.pack_start(self.search_combobox, True, True, 5) self.pack_start(self.search_button, True, True, 5) search_label.show() self.search_box.show() in_label.show() self.search_combobox.show() self.search_button.show() self.search_button.connect("clicked",self.controller.search_store,{'keyword':self.search_box, 'category':self.search_combobox}) def set_categories(self,categories): self.search_combobox.set_active(0) while self.search_combobox.get_active_text() is not None: self.search_combobox.remove_text(0) self.search_combobox.set_active(0) for category in categories: self.search_combobox.append_text(category)