Web   ·   Wiki   ·   Activities   ·   Blog   ·   Lists   ·   Chat   ·   Meeting   ·   Bugs   ·   Git   ·   Translate   ·   Archive   ·   People   ·   Donate
summaryrefslogtreecommitdiffstats
path: root/Workshop.activity/TutorialStoreSearch.py
blob: 4303a0726986c8427c659fad7c9c6128fa1e5421 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
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)