summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/ui/crumbs/recipeselectionpage.py
diff options
context:
space:
mode:
authorCristiana Voicu <cristiana.voicu@intel.com>2013-03-20 14:35:06 +0200
committerRichard Purdie <richard.purdie@linuxfoundation.org>2013-03-22 16:54:39 +0000
commit860f826753cab81b1d1d9b2ecafa630a96676d9e (patch)
tree6f5da66864b05ded2f96c76ce9299a3386fa9c1f /bitbake/lib/bb/ui/crumbs/recipeselectionpage.py
parentab7d8bd172f61e14266a020bd6633d33d79e3d8f (diff)
downloadpoky-860f826753cab81b1d1d9b2ecafa630a96676d9e.tar.gz
bitbake: hob: implementation of search functionality in Hob
Implemented the search functionality for recipes and packages using filters on the listmodel. I have used the design which can be found in bugzilla. [YOCTO #3529] (Bitbake rev: b77166ad7b8571895f73a84f7789d93fbd4f6d04) Signed-off-by: Cristiana Voicu <cristiana.voicu@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/ui/crumbs/recipeselectionpage.py')
-rwxr-xr-xbitbake/lib/bb/ui/crumbs/recipeselectionpage.py67
1 files changed, 47 insertions, 20 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/recipeselectionpage.py b/bitbake/lib/bb/ui/crumbs/recipeselectionpage.py
index 636762e40c..aa0cd60c3f 100755
--- a/bitbake/lib/bb/ui/crumbs/recipeselectionpage.py
+++ b/bitbake/lib/bb/ui/crumbs/recipeselectionpage.py
@@ -33,11 +33,13 @@ from bb.ui.crumbs.hobpages import HobPage
33class RecipeSelectionPage (HobPage): 33class RecipeSelectionPage (HobPage):
34 pages = [ 34 pages = [
35 { 35 {
36 'name' : 'Included recipes', 36 'name' : 'Included recipes',
37 'tooltip' : 'The recipes currently included for your image', 37 'tooltip' : 'The recipes currently included for your image',
38 'filter' : { RecipeListModel.COL_INC : [True], 38 'filter' : { RecipeListModel.COL_INC : [True],
39 RecipeListModel.COL_TYPE : ['recipe', 'packagegroup'] }, 39 RecipeListModel.COL_TYPE : ['recipe', 'packagegroup'] },
40 'columns' : [{ 40 'search' : 'Search recipes by name',
41 'searchtip' : 'Enter a recipe name to find it',
42 'columns' : [{
41 'col_name' : 'Recipe name', 43 'col_name' : 'Recipe name',
42 'col_id' : RecipeListModel.COL_NAME, 44 'col_id' : RecipeListModel.COL_NAME,
43 'col_style': 'text', 45 'col_style': 'text',
@@ -66,10 +68,12 @@ class RecipeSelectionPage (HobPage):
66 'col_max' : 100 68 'col_max' : 100
67 }] 69 }]
68 }, { 70 }, {
69 'name' : 'All recipes', 71 'name' : 'All recipes',
70 'tooltip' : 'All recipes in your configured layers', 72 'tooltip' : 'All recipes in your configured layers',
71 'filter' : { RecipeListModel.COL_TYPE : ['recipe'] }, 73 'filter' : { RecipeListModel.COL_TYPE : ['recipe'] },
72 'columns' : [{ 74 'search' : 'Search recipes by name',
75 'searchtip' : 'Enter a recipe name to find it',
76 'columns' : [{
73 'col_name' : 'Recipe name', 77 'col_name' : 'Recipe name',
74 'col_id' : RecipeListModel.COL_NAME, 78 'col_id' : RecipeListModel.COL_NAME,
75 'col_style': 'text', 79 'col_style': 'text',
@@ -98,10 +102,12 @@ class RecipeSelectionPage (HobPage):
98 'col_max' : 100 102 'col_max' : 100
99 }] 103 }]
100 }, { 104 }, {
101 'name' : 'Package Groups', 105 'name' : 'Package Groups',
102 'tooltip' : 'All package groups in your configured layers', 106 'tooltip' : 'All package groups in your configured layers',
103 'filter' : { RecipeListModel.COL_TYPE : ['packagegroup'] }, 107 'filter' : { RecipeListModel.COL_TYPE : ['packagegroup'] },
104 'columns' : [{ 108 'search' : 'Search package groups by name',
109 'searchtip' : 'Enter a package group name to find it',
110 'columns' : [{
105 'col_name' : 'Package group name', 111 'col_name' : 'Package group name',
106 'col_id' : RecipeListModel.COL_NAME, 112 'col_id' : RecipeListModel.COL_NAME,
107 'col_style': 'text', 113 'col_style': 'text',
@@ -142,12 +148,18 @@ class RecipeSelectionPage (HobPage):
142 # set visible members 148 # set visible members
143 self.ins = HobNotebook() 149 self.ins = HobNotebook()
144 self.tables = [] # we need modify table when the dialog is shown 150 self.tables = [] # we need modify table when the dialog is shown
151
152 search_names = []
153 search_tips = []
145 # append the tabs in order 154 # append the tabs in order
146 for page in self.pages: 155 for page in self.pages:
147 columns = page['columns'] 156 columns = page['columns']
148 tab = HobViewTable(columns) 157 tab = HobViewTable(columns)
158 search_names.append(page['search'])
159 search_tips.append(page['searchtip'])
149 filter = page['filter'] 160 filter = page['filter']
150 tab.set_model(self.recipe_model.tree_model(filter)) 161 sort_model = self.recipe_model.tree_model(filter)
162 tab.set_model(sort_model)
151 tab.connect("toggled", self.table_toggled_cb, page['name']) 163 tab.connect("toggled", self.table_toggled_cb, page['name'])
152 if page['name'] == "Included recipes": 164 if page['name'] == "Included recipes":
153 tab.connect("button-release-event", self.button_click_cb) 165 tab.connect("button-release-event", self.button_click_cb)
@@ -161,13 +173,8 @@ class RecipeSelectionPage (HobPage):
161 self.ins.append_page(tab, page['name'], page['tooltip']) 173 self.ins.append_page(tab, page['name'], page['tooltip'])
162 self.tables.append(tab) 174 self.tables.append(tab)
163 175
164 self.ins.set_entry("Search recipes:") 176 self.ins.set_entry(search_names, search_tips)
165 # set the search entry for each table 177 self.ins.search.connect("changed", self.search_entry_changed)
166 for tab in self.tables:
167 search_tip = "Enter a recipe's or task's name to find it"
168 self.ins.search.set_tooltip_text(search_tip)
169 self.ins.search.props.has_tooltip = True
170 tab.set_search_entry(0, self.ins.search)
171 178
172 # add all into the window 179 # add all into the window
173 self.box_group_area.pack_start(self.ins, expand=True, fill=True) 180 self.box_group_area.pack_start(self.ins, expand=True, fill=True)
@@ -187,6 +194,26 @@ class RecipeSelectionPage (HobPage):
187 self.back_button.connect("clicked", self.back_button_clicked_cb) 194 self.back_button.connect("clicked", self.back_button_clicked_cb)
188 button_box.pack_end(self.back_button, expand=False, fill=False) 195 button_box.pack_end(self.back_button, expand=False, fill=False)
189 196
197 def search_entry_changed(self, entry):
198 current_tab = self.ins.get_current_page()
199 filter = self.pages[current_tab]['filter']
200 text = entry.get_text()
201 filter[RecipeListModel.COL_NAME] = text
202 self.tables[current_tab].set_model(self.recipe_model.tree_model(filter, search_data=text))
203 if self.recipe_model.filtered_nb == 0:
204 if not self.ins.get_nth_page(current_tab).top_bar:
205 self.ins.get_nth_page(current_tab).add_no_result_bar(entry)
206 self.ins.get_nth_page(current_tab).top_bar.show()
207 self.ins.get_nth_page(current_tab).scroll.hide()
208 else:
209 if self.ins.get_nth_page(current_tab).top_bar:
210 self.ins.get_nth_page(current_tab).top_bar.hide()
211 self.ins.get_nth_page(current_tab).scroll.show()
212 if entry.get_text() == '':
213 entry.set_icon_sensitive(gtk.ENTRY_ICON_SECONDARY, False)
214 else:
215 entry.set_icon_sensitive(gtk.ENTRY_ICON_SECONDARY, True)
216
190 def button_click_cb(self, widget, event): 217 def button_click_cb(self, widget, event):
191 path, col = widget.table_tree.get_cursor() 218 path, col = widget.table_tree.get_cursor()
192 tree_model = widget.table_tree.get_model() 219 tree_model = widget.table_tree.get_model()