summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/ui/crumbs/hig.py
diff options
context:
space:
mode:
authorDongxiao Xu <dongxiao.xu@intel.com>2012-03-20 15:49:44 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-03-22 14:40:39 +0000
commit5b98b26d75262c9d0a27616be2a1eacfde93f1dd (patch)
treeb5cc123cb479d9b6761c9e4c14cea9d89c8c5ec5 /bitbake/lib/bb/ui/crumbs/hig.py
parent8683fa2d6302f37c12730ba872da778873939037 (diff)
downloadpoky-5b98b26d75262c9d0a27616be2a1eacfde93f1dd.tar.gz
Hob: change package classes selection GUI
This commit change the GUI for package classes selection in advanced setting dialog, which conforms with UI team's design. (From Poky rev: 7bbcabdb71d76cdb2ec1de15618d1e47f1149a21) (Bitbake rev: 4ebce01dde18e67e01ff7c4736c229a3364c04b0) Signed-off-by: Dongxiao Xu <dongxiao.xu@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/ui/crumbs/hig.py')
-rw-r--r--bitbake/lib/bb/ui/crumbs/hig.py181
1 files changed, 45 insertions, 136 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/hig.py b/bitbake/lib/bb/ui/crumbs/hig.py
index bd27375ea5..e675f39bd4 100644
--- a/bitbake/lib/bb/ui/crumbs/hig.py
+++ b/bitbake/lib/bb/ui/crumbs/hig.py
@@ -191,146 +191,58 @@ class AdvancedSettingDialog (CrumbsDialog):
191 hbox.show_all() 191 hbox.show_all()
192 return hbox, entry 192 return hbox, entry
193 193
194 def pkgfmt_widget_sort_func(self, model, iter1, iter2, data): 194 def rootfs_combo_changed_cb(self, rootfs_combo, all_package_format, check_hbox):
195 val1 = model.get_value(iter1, 0) 195 combo_item = self.rootfs_combo.get_active_text()
196 val2 = model.get_value(iter2, 0) 196 for child in check_hbox.get_children():
197 inc1 = model.get_value(iter1, 2) 197 if isinstance(child, gtk.CheckButton):
198 inc2 = model.get_value(iter2, 2) 198 check_hbox.remove(child)
199 if inc1 != inc2: 199 for format in all_package_format:
200 return inc2 - inc1 200 if format != combo_item:
201 else: 201 check_button = gtk.CheckButton(format)
202 return val1 - val2 202 check_hbox.pack_start(check_button, expand=False, fill=False)
203 203 check_hbox.show_all()
204 def pkgfmt_widget_tree_selection_changed_cb(self, tree_selection, button1, button2):
205 (model, it) = tree_selection.get_selected()
206 inc = model.get_value(it, 2)
207 if inc:
208 button1.set_sensitive(True)
209 button2.set_sensitive(True)
210 else:
211 button1.set_sensitive(False)
212 button2.set_sensitive(False)
213
214 def pkgfmt_widget_up_clicked_cb(self, button, tree_selection):
215 (model, it) = tree_selection.get_selected()
216 if not it:
217 return
218 path = model.get_path(it)
219 if path[0] <= 0:
220 return
221
222 pre_it = model.get_iter_first()
223 if not pre_it:
224 return
225 else:
226 while model.iter_next(pre_it) :
227 if model.get_value(model.iter_next(pre_it), 1) != model.get_value(it, 1):
228 pre_it = model.iter_next(pre_it)
229 else:
230 break
231
232 cur_index = model.get_value(it, 0)
233 pre_index = cur_index
234 if pre_it:
235 model.set(pre_it, 0, pre_index)
236 cur_index = cur_index - 1
237 model.set(it, 0, cur_index)
238
239 def pkgfmt_widget_down_clicked_cb(self, button, tree_selection):
240 (model, it) = tree_selection.get_selected()
241 if not it:
242 return
243 next_it = model.iter_next(it)
244 if not next_it:
245 return
246 cur_index = model.get_value(it, 0)
247 next_index = cur_index
248 model.set(next_it, 0, next_index)
249 cur_index = cur_index + 1
250 model.set(it, 0, cur_index)
251
252 def pkgfmt_widget_toggle_cb(self, cell, path, model, column):
253 it = model.get_iter(path)
254 val = model.get_value(it, column)
255 val = not val
256 model.set(it, column, val)
257 204
258 def gen_pkgfmt_widget(self, curr_package_format, all_package_format, tooltip=""): 205 def gen_pkgfmt_widget(self, curr_package_format, all_package_format, tooltip=""):
259 pkgfmt_hbox = gtk.HBox(False, 12) 206 pkgfmt_hbox = gtk.HBox(False, 24)
260 207
261 pkgfmt_store = gtk.ListStore(int, str, gobject.TYPE_BOOLEAN) 208 rootfs_vbox = gtk.VBox(False, 6)
262 for format in curr_package_format.split(): 209 pkgfmt_hbox.pack_start(rootfs_vbox, expand=False, fill=False)
263 pkgfmt_store.set(pkgfmt_store.append(), 1, format, 2, True)
264 for format in all_package_format:
265 if format not in curr_package_format:
266 pkgfmt_store.set(pkgfmt_store.append(), 1, format, 2, False)
267 pkgfmt_tree = gtk.TreeView(pkgfmt_store)
268 pkgfmt_tree.set_headers_clickable(True)
269 pkgfmt_tree.set_headers_visible(False)
270 tree_selection = pkgfmt_tree.get_selection()
271 tree_selection.set_mode(gtk.SELECTION_SINGLE)
272 210
273 col = gtk.TreeViewColumn('NO') 211 label = self.gen_label_widget("Root file system package format")
274 col.set_sort_column_id(0) 212 rootfs_vbox.pack_start(label, expand=False, fill=False)
275 col.set_sort_order(gtk.SORT_ASCENDING)
276 col.set_clickable(False)
277 col1 = gtk.TreeViewColumn('TYPE')
278 col1.set_min_width(130)
279 col1.set_max_width(140)
280 col2 = gtk.TreeViewColumn('INCLUDED')
281 col2.set_min_width(60)
282 col2.set_max_width(70)
283 pkgfmt_tree.append_column(col1)
284 pkgfmt_tree.append_column(col2)
285 cell = gtk.CellRendererText()
286 cell1 = gtk.CellRendererText()
287 cell1.set_property('width-chars', 10)
288 cell2 = gtk.CellRendererToggle()
289 cell2.set_property('activatable', True)
290 cell2.connect("toggled", self.pkgfmt_widget_toggle_cb, pkgfmt_store, 2)
291 col.pack_start(cell, True)
292 col1.pack_start(cell1, True)
293 col2.pack_end(cell2, True)
294 col.set_attributes(cell, text=0)
295 col1.set_attributes(cell1, text=1)
296 col2.set_attributes(cell2, active=2)
297 213
298 pkgfmt_store.set_sort_func(0, self.pkgfmt_widget_sort_func, None) 214 rootfs_format = ""
299 pkgfmt_store.set_sort_column_id(0, gtk.SORT_ASCENDING) 215 if curr_package_format:
216 rootfs_format = curr_package_format.split()[0]
300 217
301 scroll = gtk.ScrolledWindow() 218 tooltip = "Package format that is used to generate rootfs"
302 scroll.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC) 219 rootfs_format_widget, rootfs_combo = self.gen_combo_widget(rootfs_format, all_package_format, tooltip)
303 scroll.set_shadow_type(gtk.SHADOW_IN) 220 rootfs_vbox.pack_start(rootfs_format_widget, expand=False, fill=False)
304 scroll.add(pkgfmt_tree)
305 scroll.set_size_request(200,60)
306 pkgfmt_hbox.pack_start(scroll, False, False, 0)
307 221
308 vbox = gtk.VBox(False, 6) 222 extra_vbox = gtk.VBox(False, 6)
309 pkgfmt_hbox.pack_start(vbox, False, False, 15) 223 pkgfmt_hbox.pack_start(extra_vbox, expand=False, fill=False)
310 224
311 up = gtk.Button() 225 label = self.gen_label_widget("Additional package formats")
312 image = gtk.Image() 226 extra_vbox.pack_start(label, expand=False, fill=False)
313 image.set_from_stock(gtk.STOCK_GO_UP, gtk.ICON_SIZE_MENU)
314 up.set_image(image)
315 up.set_size_request(50,30)
316 up.connect("clicked", self.pkgfmt_widget_up_clicked_cb, tree_selection)
317 vbox.pack_start(up, False, False, 5)
318 227
319 down = gtk.Button() 228 check_hbox = gtk.HBox(False, 12)
320 image = gtk.Image() 229 extra_vbox.pack_start(check_hbox, expand=False, fill=False)
321 image.set_from_stock(gtk.STOCK_GO_DOWN, gtk.ICON_SIZE_MENU) 230 for format in all_package_format:
322 down.set_image(image) 231 if format != rootfs_format:
323 down.set_size_request(50,30) 232 check_button = gtk.CheckButton(format)
324 down.connect("clicked", self.pkgfmt_widget_down_clicked_cb, tree_selection) 233 is_active = (format in curr_package_format.split())
325 vbox.pack_start(down, False, False, 5) 234 check_button.set_active(is_active)
326 tree_selection.connect("changed", self.pkgfmt_widget_tree_selection_changed_cb, up, down) 235 check_hbox.pack_start(check_button, expand=False, fill=False)
327 236
237 tooltip = "Extra package formats to build"
328 info = HobInfoButton(tooltip, self) 238 info = HobInfoButton(tooltip, self)
329 pkgfmt_hbox.pack_start(info, expand=False, fill=False) 239 check_hbox.pack_end(info, expand=False, fill=False)
240
241 rootfs_combo.connect("changed", self.rootfs_combo_changed_cb, all_package_format, check_hbox)
330 242
331 pkgfmt_hbox.show_all() 243 pkgfmt_hbox.show_all()
332 244
333 return pkgfmt_hbox, pkgfmt_store 245 return pkgfmt_hbox, rootfs_combo, check_hbox
334 246
335 def editable_settings_cell_edited(self, cell, path_string, new_text, model): 247 def editable_settings_cell_edited(self, cell, path_string, new_text, model):
336 it = model.get_iter_from_string(path_string) 248 it = model.get_iter_from_string(path_string)
@@ -431,7 +343,6 @@ class AdvancedSettingDialog (CrumbsDialog):
431 self.max_threads = max_threads 343 self.max_threads = max_threads
432 344
433 # class members for internal use 345 # class members for internal use
434 self.pkgfmt_store = None
435 self.distro_combo = None 346 self.distro_combo = None
436 self.dldir_text = None 347 self.dldir_text = None
437 self.sstatedir_text = None 348 self.sstatedir_text = None
@@ -509,7 +420,7 @@ class AdvancedSettingDialog (CrumbsDialog):
509 label = self.gen_label_widget("<span weight=\"bold\">Packaging Format:</span>") 420 label = self.gen_label_widget("<span weight=\"bold\">Packaging Format:</span>")
510 tooltip = "Select package formats that will be used. " 421 tooltip = "Select package formats that will be used. "
511 tooltip += "The first format will be used for final image" 422 tooltip += "The first format will be used for final image"
512 pkgfmt_widget, self.pkgfmt_store = self.gen_pkgfmt_widget(self.configuration.curr_package_format, self.all_package_formats, tooltip) 423 pkgfmt_widget, self.rootfs_combo, self.check_hbox = self.gen_pkgfmt_widget(self.configuration.curr_package_format, self.all_package_formats, tooltip)
513 sub_vbox.pack_start(label, expand=False, fill=False) 424 sub_vbox.pack_start(label, expand=False, fill=False)
514 sub_vbox.pack_start(pkgfmt_widget, expand=False, fill=False) 425 sub_vbox.pack_start(pkgfmt_widget, expand=False, fill=False)
515 426
@@ -621,14 +532,12 @@ class AdvancedSettingDialog (CrumbsDialog):
621 def response_cb(self, dialog, response_id): 532 def response_cb(self, dialog, response_id):
622 self.variables = {} 533 self.variables = {}
623 534
624 self.configuration.curr_package_format = "" 535 package_format = []
625 it = self.pkgfmt_store.get_iter_first() 536 package_format.append(self.rootfs_combo.get_active_text())
626 while it: 537 for child in self.check_hbox:
627 value = self.pkgfmt_store.get_value(it, 2) 538 if isinstance(child, gtk.CheckButton) and child.get_active():
628 if value: 539 package_format.append(child.get_label())
629 self.configuration.curr_package_format += (self.pkgfmt_store.get_value(it, 1) + " ") 540 self.configuration.curr_package_format = " ".join(package_format)
630 it = self.pkgfmt_store.iter_next(it)
631 self.configuration.curr_package_format = self.configuration.curr_package_format.strip()
632 self.variables["PACKAGE_FORMAT"] = self.configuration.curr_package_format 541 self.variables["PACKAGE_FORMAT"] = self.configuration.curr_package_format
633 542
634 self.configuration.curr_distro = self.distro_combo.get_active_text() 543 self.configuration.curr_distro = self.distro_combo.get_active_text()