From 030ba4bc71a1e7ea9a74e819949e5fb794af09f2 Mon Sep 17 00:00:00 2001 From: Shane Wang Date: Wed, 29 Feb 2012 22:14:58 +0800 Subject: Hob: make HobViewTable more general in hob and make the image selection dialog and the image details page reuse it. This patch is to make the class HobViewTable more general as a tree view in Hob. Now the recipe selection page and the package selection page are using it. And we have tree views in the image selection dialog and the image details page, which used the class methods in HobWidget to create the tree views. That is not good in OO. So, make them reuse HobViewTable to create its instances. (Bitbake rev: 3c900211e8bc0311542873480d79b347d7449f59) Signed-off-by: Shane Wang Signed-off-by: Richard Purdie --- bitbake/lib/bb/ui/crumbs/recipeselectionpage.py | 30 +++++++++++++++---------- 1 file changed, 18 insertions(+), 12 deletions(-) (limited to 'bitbake/lib/bb/ui/crumbs/recipeselectionpage.py') diff --git a/bitbake/lib/bb/ui/crumbs/recipeselectionpage.py b/bitbake/lib/bb/ui/crumbs/recipeselectionpage.py index 73b8a1e4ef..93540b2a95 100755 --- a/bitbake/lib/bb/ui/crumbs/recipeselectionpage.py +++ b/bitbake/lib/bb/ui/crumbs/recipeselectionpage.py @@ -56,7 +56,7 @@ class RecipeSelectionPage (HobPage): }, { 'col_name' : 'Included', 'col_id' : RecipeListModel.COL_INC, - 'col_style': 'toggle', + 'col_style': 'check toggle', 'col_min' : 50, 'col_max' : 50 }] @@ -78,7 +78,7 @@ class RecipeSelectionPage (HobPage): }, { 'col_name' : 'Included', 'col_id' : RecipeListModel.COL_INC, - 'col_style': 'toggle', + 'col_style': 'check toggle', 'col_min' : 50, 'col_max' : 50 }] @@ -101,7 +101,7 @@ class RecipeSelectionPage (HobPage): }, { 'col_name' : 'Included', 'col_id' : RecipeListModel.COL_INC, - 'col_style': 'toggle', + 'col_style': 'check toggle', 'col_min' : 50, 'col_max' : 50 }] @@ -135,9 +135,19 @@ class RecipeSelectionPage (HobPage): # append the tabs in order for i in range(len(self.pages)): columns = self.pages[i]['columns'] - tab = HobViewTable(columns, self.reset_clicked_cb, self.table_toggled_cb) + tab = HobViewTable(columns) filter = self.pages[i]['filter'] - tab.table_tree.set_model(self.recipe_model.tree_model(filter)) + tab.set_model(self.recipe_model.tree_model(filter)) + tab.connect("toggled", self.table_toggled_cb) + if self.pages[i]['name'] == "Included": + tab.connect("changed", self.tree_selection_cb) + + reset_button = gtk.Button("Reset") + reset_button.connect("clicked", self.reset_clicked_cb) + hbox = gtk.HBox(False, 5) + hbox.pack_end(reset_button, expand=False, fill=False) + tab.pack_start(hbox, expand=False, fill=False) + label = gtk.Label(self.pages[i]['name']) self.ins.append_page(tab, label) self.tables.append(tab) @@ -148,11 +158,7 @@ class RecipeSelectionPage (HobPage): self.grid.attach(self.topbar, 0, 1, 0, 1, gtk.FILL | gtk.EXPAND, gtk.FILL | gtk.EXPAND) # set the search entry for each table for tab in self.tables: - tab.table_tree.set_search_entry(self.topbar.search) - - inctab_tree_view = self.tables[len(self.pages)-1].table_tree - inctab_tree_selection = inctab_tree_view.get_selection() - inctab_tree_selection.connect("changed", self.tree_selection_cb, inctab_tree_view) + tab.set_search_entry(0, self.topbar.search) # add all into the window self.box_group_area.add(self.grid) @@ -179,7 +185,7 @@ class RecipeSelectionPage (HobPage): self.back_button.connect("clicked", self.back_button_clicked_cb) button_box.pack_start(self.back_button, expand=False, fill=False) - def tree_selection_cb(self, tree_selection, tree_view): + def tree_selection_cb(self, table, tree_selection, tree_view): tree_model = tree_view.get_model() path, column = tree_view.get_cursor() if not path or column == tree_view.get_column(2): @@ -213,7 +219,7 @@ class RecipeSelectionPage (HobPage): self.builder.window_sensitive(True) - def table_toggled_cb(self, cell, view_path, view_tree): + def table_toggled_cb(self, table, cell, view_path, toggled_columnid, view_tree): # Click to include a recipe self.builder.window_sensitive(False) view_model = view_tree.get_model() -- cgit v1.2.3-54-g00ecf