summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb
diff options
context:
space:
mode:
authorLiming An <limingx.l.an@intel.com>2012-04-09 22:13:33 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-04-11 00:04:44 +0100
commite1d463eb3931014427a1d108944eaa55f21880c0 (patch)
tree3204c9042ee2822db9a02bcf73967ff433558808 /bitbake/lib/bb
parenta46aafb8b27bd86d046385a569deee6b4c9b8bb6 (diff)
downloadpoky-e1d463eb3931014427a1d108944eaa55f21880c0.tar.gz
Hob: add fadeout display effection for package view include page
[YOCTO #2100] (Bitbake rev: c0c81647dc5e72fe3abb1fb3b65a978aa4b226a5) Signed-off-by: Liming An <limingx.l.an@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb')
-rw-r--r--bitbake/lib/bb/ui/crumbs/hoblistmodel.py17
-rw-r--r--bitbake/lib/bb/ui/crumbs/hobwidget.py6
-rwxr-xr-xbitbake/lib/bb/ui/crumbs/packageselectionpage.py44
-rwxr-xr-xbitbake/lib/bb/ui/crumbs/recipeselectionpage.py2
4 files changed, 59 insertions, 10 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/hoblistmodel.py b/bitbake/lib/bb/ui/crumbs/hoblistmodel.py
index 523a591620..f5e37402eb 100644
--- a/bitbake/lib/bb/ui/crumbs/hoblistmodel.py
+++ b/bitbake/lib/bb/ui/crumbs/hoblistmodel.py
@@ -428,6 +428,19 @@ class PackageListModel(gtk.TreeStore):
428 428
429 self.selection_change_notification() 429 self.selection_change_notification()
430 430
431 """
432 Resync the state of included items to a backup column before performing the fadeout visible effect
433 """
434 def resync_fadeout_column(self, model_first_iter=None):
435 it = model_first_iter
436 while it:
437 active = self.get_value(it, self.COL_INC)
438 self.set(it, self.COL_FADE_INC, active)
439 if self.iter_has_child(it):
440 self.resync_fadeout_column(self.iter_children(it))
441
442 it = self.iter_next(it)
443
431# 444#
432# RecipeListModel 445# RecipeListModel
433# 446#
@@ -509,12 +522,12 @@ class RecipeListModel(gtk.ListStore):
509 Create, if required, and return a filtered gtk.TreeModelSort 522 Create, if required, and return a filtered gtk.TreeModelSort
510 containing only the items which are items specified by filter 523 containing only the items which are items specified by filter
511 """ 524 """
512 def tree_model(self, filter, excluded_items_head=False): 525 def tree_model(self, filter, excluded_items_ahead=False):
513 model = self.filter_new() 526 model = self.filter_new()
514 model.set_visible_func(self.tree_model_filter, filter) 527 model.set_visible_func(self.tree_model_filter, filter)
515 528
516 sort = gtk.TreeModelSort(model) 529 sort = gtk.TreeModelSort(model)
517 if excluded_items_head: 530 if excluded_items_ahead:
518 sort.set_default_sort_func(self.exclude_item_sort_func) 531 sort.set_default_sort_func(self.exclude_item_sort_func)
519 else: 532 else:
520 sort.set_sort_column_id(RecipeListModel.COL_NAME, gtk.SORT_ASCENDING) 533 sort.set_sort_column_id(RecipeListModel.COL_NAME, gtk.SORT_ASCENDING)
diff --git a/bitbake/lib/bb/ui/crumbs/hobwidget.py b/bitbake/lib/bb/ui/crumbs/hobwidget.py
index c6e3bb1ae6..8c8bf9bc77 100644
--- a/bitbake/lib/bb/ui/crumbs/hobwidget.py
+++ b/bitbake/lib/bb/ui/crumbs/hobwidget.py
@@ -1072,7 +1072,11 @@ class HobCellRendererToggle(gtk.CellRendererToggle):
1072 if (not self.ctrl) or (not widget): 1072 if (not self.ctrl) or (not widget):
1073 return 1073 return
1074 if self.ctrl.is_active(): 1074 if self.ctrl.is_active():
1075 path = widget.get_path_at_pos(cell_area.x + cell_area.width/2, cell_area.y + cell_area.height/2)[0] 1075 path = widget.get_path_at_pos(cell_area.x + cell_area.width/2, cell_area.y + cell_area.height/2)
1076 # sometimes the parameters of cell_area will be a negative number,such as pull up down the scroll bar
1077 # it's over the tree container range, so the path will be bad
1078 if not path: return
1079 path = path[0]
1076 if path in self.ctrl.running_cell_areas: 1080 if path in self.ctrl.running_cell_areas:
1077 cr = window.cairo_create() 1081 cr = window.cairo_create()
1078 color = gtk.gdk.Color(HobColors.WHITE) 1082 color = gtk.gdk.Color(HobColors.WHITE)
diff --git a/bitbake/lib/bb/ui/crumbs/packageselectionpage.py b/bitbake/lib/bb/ui/crumbs/packageselectionpage.py
index fc3d4a3bbf..a46bd4234b 100755
--- a/bitbake/lib/bb/ui/crumbs/packageselectionpage.py
+++ b/bitbake/lib/bb/ui/crumbs/packageselectionpage.py
@@ -116,10 +116,10 @@ class PackageSelectionPage (HobPage):
116 tab = HobViewTable(columns) 116 tab = HobViewTable(columns)
117 filter = page['filter'] 117 filter = page['filter']
118 tab.set_model(self.package_model.tree_model(filter)) 118 tab.set_model(self.package_model.tree_model(filter))
119 tab.connect("toggled", self.table_toggled_cb) 119 tab.connect("toggled", self.table_toggled_cb, page['name'])
120 if page['name'] == "Included": 120 if page['name'] == "Included":
121 tab.connect("button-release-event", self.button_click_cb) 121 tab.connect("button-release-event", self.button_click_cb)
122 122 tab.connect("cell-fadeinout-stopped", self.after_fadeout_checkin_include)
123 label = gtk.Label(page['name']) 123 label = gtk.Label(page['name'])
124 self.ins.append_page(tab, label) 124 self.ins.append_page(tab, label)
125 self.tables.append(tab) 125 self.tables.append(tab)
@@ -187,11 +187,16 @@ class PackageSelectionPage (HobPage):
187 (selected_packages_num, selected_packages_size_str, image_total_size_str)) 187 (selected_packages_num, selected_packages_size_str, image_total_size_str))
188 self.ins.show_indicator_icon("Included", selected_packages_num) 188 self.ins.show_indicator_icon("Included", selected_packages_num)
189 189
190 def toggle_item_idle_cb(self, path): 190 def toggle_item_idle_cb(self, path, view_tree, cell, pagename):
191 if not self.package_model.path_included(path): 191 if not self.package_model.path_included(path):
192 self.package_model.include_item(item_path=path, binb="User Selected") 192 self.package_model.include_item(item_path=path, binb="User Selected")
193 else: 193 else:
194 self.package_model.exclude_item(item_path=path) 194 if pagename == "Included":
195 self.pre_fadeout_checkout_include(view_tree)
196 self.package_model.exclude_item(item_path=path)
197 self.render_fadeout(view_tree, cell)
198 else:
199 self.package_model.exclude_item(item_path=path)
195 200
196 self.refresh_selection() 201 self.refresh_selection()
197 if not self.builder.customized: 202 if not self.builder.customized:
@@ -201,9 +206,36 @@ class PackageSelectionPage (HobPage):
201 206
202 self.builder.window_sensitive(True) 207 self.builder.window_sensitive(True)
203 208
204 def table_toggled_cb(self, table, cell, view_path, toggled_columnid, view_tree): 209 def table_toggled_cb(self, table, cell, view_path, toggled_columnid, view_tree, pagename):
205 # Click to include a package 210 # Click to include a package
206 self.builder.window_sensitive(False) 211 self.builder.window_sensitive(False)
207 view_model = view_tree.get_model() 212 view_model = view_tree.get_model()
208 path = self.package_model.convert_vpath_to_path(view_model, view_path) 213 path = self.package_model.convert_vpath_to_path(view_model, view_path)
209 glib.idle_add(self.toggle_item_idle_cb, path) 214 glib.idle_add(self.toggle_item_idle_cb, path, view_tree, cell, pagename)
215
216 def pre_fadeout_checkout_include(self, tree):
217 self.package_model.resync_fadeout_column(self.package_model.get_iter_first())
218 # Check out a model which base on the column COL_FADE_INC,
219 # it's save the prev state of column COL_INC before do exclude_item
220 filter = { PackageListModel.COL_FADE_INC : [True]}
221 new_model = self.package_model.tree_model(filter)
222 tree.set_model(new_model)
223 tree.expand_all()
224
225 def get_excluded_rows(self, to_render_cells, model, it):
226 while it:
227 path = model.get_path(it)
228 prev_cell_is_active = model.get_value(it, PackageListModel.COL_FADE_INC)
229 curr_cell_is_active = model.get_value(it, PackageListModel.COL_INC)
230 if (prev_cell_is_active == True) and (curr_cell_is_active == False):
231 to_render_cells.append(path)
232 if model.iter_has_child(it):
233 self.get_excluded_rows(to_render_cells, model, model.iter_children(it))
234 it = model.iter_next(it)
235
236 return to_render_cells
237
238 def render_fadeout(self, tree, cell):
239 if (not cell) or (not tree):
240 return
241 to_render_cells = []
diff --git a/bitbake/lib/bb/ui/crumbs/recipeselectionpage.py b/bitbake/lib/bb/ui/crumbs/recipeselectionpage.py
index b2d2db9d76..46f86e6cdd 100755
--- a/bitbake/lib/bb/ui/crumbs/recipeselectionpage.py
+++ b/bitbake/lib/bb/ui/crumbs/recipeselectionpage.py
@@ -234,7 +234,7 @@ class RecipeSelectionPage (HobPage):
234 # it's save the prev state of column COL_INC before do exclude_item 234 # it's save the prev state of column COL_INC before do exclude_item
235 filter = { RecipeListModel.COL_FADE_INC : [True], 235 filter = { RecipeListModel.COL_FADE_INC : [True],
236 RecipeListModel.COL_TYPE : ['recipe', 'task'] } 236 RecipeListModel.COL_TYPE : ['recipe', 'task'] }
237 new_model = self.recipe_model.tree_model(filter, excluded_items_head=True) 237 new_model = self.recipe_model.tree_model(filter, excluded_items_ahead=True)
238 tree.set_model(new_model) 238 tree.set_model(new_model)
239 239
240 def render_fadeout(self, tree, cell): 240 def render_fadeout(self, tree, cell):