diff options
author | Shane Wang <shane.wang@intel.com> | 2012-02-29 22:14:58 +0800 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-03-01 15:51:30 +0000 |
commit | 030ba4bc71a1e7ea9a74e819949e5fb794af09f2 (patch) | |
tree | e3105c650c90a21546e8ccde22bc939f5df536b7 /bitbake/lib/bb/ui/crumbs/recipeselectionpage.py | |
parent | 8f07bdc0a42dd7a7c3acf5d1b13220dbc98c8017 (diff) | |
download | poky-030ba4bc71a1e7ea9a74e819949e5fb794af09f2.tar.gz |
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 <shane.wang@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/ui/crumbs/recipeselectionpage.py')
-rwxr-xr-x | bitbake/lib/bb/ui/crumbs/recipeselectionpage.py | 30 |
1 files changed, 18 insertions, 12 deletions
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): | |||
56 | }, { | 56 | }, { |
57 | 'col_name' : 'Included', | 57 | 'col_name' : 'Included', |
58 | 'col_id' : RecipeListModel.COL_INC, | 58 | 'col_id' : RecipeListModel.COL_INC, |
59 | 'col_style': 'toggle', | 59 | 'col_style': 'check toggle', |
60 | 'col_min' : 50, | 60 | 'col_min' : 50, |
61 | 'col_max' : 50 | 61 | 'col_max' : 50 |
62 | }] | 62 | }] |
@@ -78,7 +78,7 @@ class RecipeSelectionPage (HobPage): | |||
78 | }, { | 78 | }, { |
79 | 'col_name' : 'Included', | 79 | 'col_name' : 'Included', |
80 | 'col_id' : RecipeListModel.COL_INC, | 80 | 'col_id' : RecipeListModel.COL_INC, |
81 | 'col_style': 'toggle', | 81 | 'col_style': 'check toggle', |
82 | 'col_min' : 50, | 82 | 'col_min' : 50, |
83 | 'col_max' : 50 | 83 | 'col_max' : 50 |
84 | }] | 84 | }] |
@@ -101,7 +101,7 @@ class RecipeSelectionPage (HobPage): | |||
101 | }, { | 101 | }, { |
102 | 'col_name' : 'Included', | 102 | 'col_name' : 'Included', |
103 | 'col_id' : RecipeListModel.COL_INC, | 103 | 'col_id' : RecipeListModel.COL_INC, |
104 | 'col_style': 'toggle', | 104 | 'col_style': 'check toggle', |
105 | 'col_min' : 50, | 105 | 'col_min' : 50, |
106 | 'col_max' : 50 | 106 | 'col_max' : 50 |
107 | }] | 107 | }] |
@@ -135,9 +135,19 @@ class RecipeSelectionPage (HobPage): | |||
135 | # append the tabs in order | 135 | # append the tabs in order |
136 | for i in range(len(self.pages)): | 136 | for i in range(len(self.pages)): |
137 | columns = self.pages[i]['columns'] | 137 | columns = self.pages[i]['columns'] |
138 | tab = HobViewTable(columns, self.reset_clicked_cb, self.table_toggled_cb) | 138 | tab = HobViewTable(columns) |
139 | filter = self.pages[i]['filter'] | 139 | filter = self.pages[i]['filter'] |
140 | tab.table_tree.set_model(self.recipe_model.tree_model(filter)) | 140 | tab.set_model(self.recipe_model.tree_model(filter)) |
141 | tab.connect("toggled", self.table_toggled_cb) | ||
142 | if self.pages[i]['name'] == "Included": | ||
143 | tab.connect("changed", self.tree_selection_cb) | ||
144 | |||
145 | reset_button = gtk.Button("Reset") | ||
146 | reset_button.connect("clicked", self.reset_clicked_cb) | ||
147 | hbox = gtk.HBox(False, 5) | ||
148 | hbox.pack_end(reset_button, expand=False, fill=False) | ||
149 | tab.pack_start(hbox, expand=False, fill=False) | ||
150 | |||
141 | label = gtk.Label(self.pages[i]['name']) | 151 | label = gtk.Label(self.pages[i]['name']) |
142 | self.ins.append_page(tab, label) | 152 | self.ins.append_page(tab, label) |
143 | self.tables.append(tab) | 153 | self.tables.append(tab) |
@@ -148,11 +158,7 @@ class RecipeSelectionPage (HobPage): | |||
148 | self.grid.attach(self.topbar, 0, 1, 0, 1, gtk.FILL | gtk.EXPAND, gtk.FILL | gtk.EXPAND) | 158 | self.grid.attach(self.topbar, 0, 1, 0, 1, gtk.FILL | gtk.EXPAND, gtk.FILL | gtk.EXPAND) |
149 | # set the search entry for each table | 159 | # set the search entry for each table |
150 | for tab in self.tables: | 160 | for tab in self.tables: |
151 | tab.table_tree.set_search_entry(self.topbar.search) | 161 | tab.set_search_entry(0, self.topbar.search) |
152 | |||
153 | inctab_tree_view = self.tables[len(self.pages)-1].table_tree | ||
154 | inctab_tree_selection = inctab_tree_view.get_selection() | ||
155 | inctab_tree_selection.connect("changed", self.tree_selection_cb, inctab_tree_view) | ||
156 | 162 | ||
157 | # add all into the window | 163 | # add all into the window |
158 | self.box_group_area.add(self.grid) | 164 | self.box_group_area.add(self.grid) |
@@ -179,7 +185,7 @@ class RecipeSelectionPage (HobPage): | |||
179 | self.back_button.connect("clicked", self.back_button_clicked_cb) | 185 | self.back_button.connect("clicked", self.back_button_clicked_cb) |
180 | button_box.pack_start(self.back_button, expand=False, fill=False) | 186 | button_box.pack_start(self.back_button, expand=False, fill=False) |
181 | 187 | ||
182 | def tree_selection_cb(self, tree_selection, tree_view): | 188 | def tree_selection_cb(self, table, tree_selection, tree_view): |
183 | tree_model = tree_view.get_model() | 189 | tree_model = tree_view.get_model() |
184 | path, column = tree_view.get_cursor() | 190 | path, column = tree_view.get_cursor() |
185 | if not path or column == tree_view.get_column(2): | 191 | if not path or column == tree_view.get_column(2): |
@@ -213,7 +219,7 @@ class RecipeSelectionPage (HobPage): | |||
213 | 219 | ||
214 | self.builder.window_sensitive(True) | 220 | self.builder.window_sensitive(True) |
215 | 221 | ||
216 | def table_toggled_cb(self, cell, view_path, view_tree): | 222 | def table_toggled_cb(self, table, cell, view_path, toggled_columnid, view_tree): |
217 | # Click to include a recipe | 223 | # Click to include a recipe |
218 | self.builder.window_sensitive(False) | 224 | self.builder.window_sensitive(False) |
219 | view_model = view_tree.get_model() | 225 | view_model = view_tree.get_model() |