summaryrefslogtreecommitdiffstats
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
parenta46aafb8b27bd86d046385a569deee6b4c9b8bb6 (diff)
downloadpoky-e1d463eb3931014427a1d108944eaa55f21880c0.tar.gz
poky-e1d463eb3931014427a1d108944eaa55f21880c0.tar.bz2
poky-e1d463eb3931014427a1d108944eaa55f21880c0.zip
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>
-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):
self.selection_change_notification()
+ """
+ Resync the state of included items to a backup column before performing the fadeout visible effect
+ """
+ def resync_fadeout_column(self, model_first_iter=None):
+ it = model_first_iter
+ while it:
+ active = self.get_value(it, self.COL_INC)
+ self.set(it, self.COL_FADE_INC, active)
+ if self.iter_has_child(it):
+ self.resync_fadeout_column(self.iter_children(it))
+
+ it = self.iter_next(it)
+
#
# RecipeListModel
#
@@ -509,12 +522,12 @@ class RecipeListModel(gtk.ListStore):
Create, if required, and return a filtered gtk.TreeModelSort
containing only the items which are items specified by filter
"""
- def tree_model(self, filter, excluded_items_head=False):
+ def tree_model(self, filter, excluded_items_ahead=False):
model = self.filter_new()
model.set_visible_func(self.tree_model_filter, filter)
sort = gtk.TreeModelSort(model)
- if excluded_items_head:
+ if excluded_items_ahead:
sort.set_default_sort_func(self.exclude_item_sort_func)
else:
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):
if (not self.ctrl) or (not widget):
return
if self.ctrl.is_active():
- path = widget.get_path_at_pos(cell_area.x + cell_area.width/2, cell_area.y + cell_area.height/2)[0]
+ path = widget.get_path_at_pos(cell_area.x + cell_area.width/2, cell_area.y + cell_area.height/2)
+ # sometimes the parameters of cell_area will be a negative number,such as pull up down the scroll bar
+ # it's over the tree container range, so the path will be bad
+ if not path: return
+ path = path[0]
if path in self.ctrl.running_cell_areas:
cr = window.cairo_create()
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):
tab = HobViewTable(columns)
filter = page['filter']
tab.set_model(self.package_model.tree_model(filter))
- tab.connect("toggled", self.table_toggled_cb)
+ tab.connect("toggled", self.table_toggled_cb, page['name'])
if page['name'] == "Included":
tab.connect("button-release-event", self.button_click_cb)
-
+ tab.connect("cell-fadeinout-stopped", self.after_fadeout_checkin_include)
label = gtk.Label(page['name'])
self.ins.append_page(tab, label)
self.tables.append(tab)
@@ -187,11 +187,16 @@ class PackageSelectionPage (HobPage):
(selected_packages_num, selected_packages_size_str, image_total_size_str))
self.ins.show_indicator_icon("Included", selected_packages_num)
- def toggle_item_idle_cb(self, path):
+ def toggle_item_idle_cb(self, path, view_tree, cell, pagename):
if not self.package_model.path_included(path):
self.package_model.include_item(item_path=path, binb="User Selected")
else:
- self.package_model.exclude_item(item_path=path)
+ if pagename == "Included":
+ self.pre_fadeout_checkout_include(view_tree)
+ self.package_model.exclude_item(item_path=path)
+ self.render_fadeout(view_tree, cell)
+ else:
+ self.package_model.exclude_item(item_path=path)
self.refresh_selection()
if not self.builder.customized:
@@ -201,9 +206,36 @@ class PackageSelectionPage (HobPage):
self.builder.window_sensitive(True)
- def table_toggled_cb(self, table, cell, view_path, toggled_columnid, view_tree):
+ def table_toggled_cb(self, table, cell, view_path, toggled_columnid, view_tree, pagename):
# Click to include a package
self.builder.window_sensitive(False)
view_model = view_tree.get_model()
path = self.package_model.convert_vpath_to_path(view_model, view_path)
- glib.idle_add(self.toggle_item_idle_cb, path)
+ glib.idle_add(self.toggle_item_idle_cb, path, view_tree, cell, pagename)
+
+ def pre_fadeout_checkout_include(self, tree):
+ self.package_model.resync_fadeout_column(self.package_model.get_iter_first())
+ # Check out a model which base on the column COL_FADE_INC,
+ # it's save the prev state of column COL_INC before do exclude_item
+ filter = { PackageListModel.COL_FADE_INC : [True]}
+ new_model = self.package_model.tree_model(filter)
+ tree.set_model(new_model)
+ tree.expand_all()
+
+ def get_excluded_rows(self, to_render_cells, model, it):
+ while it:
+ path = model.get_path(it)
+ prev_cell_is_active = model.get_value(it, PackageListModel.COL_FADE_INC)
+ curr_cell_is_active = model.get_value(it, PackageListModel.COL_INC)
+ if (prev_cell_is_active == True) and (curr_cell_is_active == False):
+ to_render_cells.append(path)
+ if model.iter_has_child(it):
+ self.get_excluded_rows(to_render_cells, model, model.iter_children(it))
+ it = model.iter_next(it)
+
+ return to_render_cells
+
+ def render_fadeout(self, tree, cell):
+ if (not cell) or (not tree):
+ return
+ 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):
# it's save the prev state of column COL_INC before do exclude_item
filter = { RecipeListModel.COL_FADE_INC : [True],
RecipeListModel.COL_TYPE : ['recipe', 'task'] }
- new_model = self.recipe_model.tree_model(filter, excluded_items_head=True)
+ new_model = self.recipe_model.tree_model(filter, excluded_items_ahead=True)
tree.set_model(new_model)
def render_fadeout(self, tree, cell):