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 | |
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')
-rw-r--r-- | bitbake/lib/bb/ui/crumbs/hig.py | 37 | ||||
-rw-r--r-- | bitbake/lib/bb/ui/crumbs/hobwidget.py | 168 | ||||
-rwxr-xr-x | bitbake/lib/bb/ui/crumbs/imagedetailspage.py | 65 | ||||
-rwxr-xr-x | bitbake/lib/bb/ui/crumbs/packageselectionpage.py | 28 | ||||
-rwxr-xr-x | bitbake/lib/bb/ui/crumbs/recipeselectionpage.py | 30 |
5 files changed, 176 insertions, 152 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/hig.py b/bitbake/lib/bb/ui/crumbs/hig.py index 89dfe03608..8f4f7cdf04 100644 --- a/bitbake/lib/bb/ui/crumbs/hig.py +++ b/bitbake/lib/bb/ui/crumbs/hig.py | |||
@@ -28,7 +28,7 @@ import re | |||
28 | import subprocess | 28 | import subprocess |
29 | import shlex | 29 | import shlex |
30 | from bb.ui.crumbs.hobcolor import HobColors | 30 | from bb.ui.crumbs.hobcolor import HobColors |
31 | from bb.ui.crumbs.hobwidget import HobWidget | 31 | from bb.ui.crumbs.hobwidget import HobWidget, HobViewTable |
32 | from bb.ui.crumbs.progressbar import HobProgressBar | 32 | from bb.ui.crumbs.progressbar import HobProgressBar |
33 | 33 | ||
34 | """ | 34 | """ |
@@ -561,6 +561,21 @@ class LayerSelectionDialog (gtk.Dialog): | |||
561 | 561 | ||
562 | class ImageSelectionDialog (gtk.Dialog): | 562 | class ImageSelectionDialog (gtk.Dialog): |
563 | 563 | ||
564 | __columns__ = [{ | ||
565 | 'col_name' : 'Image name', | ||
566 | 'col_id' : 0, | ||
567 | 'col_style': 'text', | ||
568 | 'col_min' : 400, | ||
569 | 'col_max' : 400 | ||
570 | }, { | ||
571 | 'col_name' : 'Select', | ||
572 | 'col_id' : 1, | ||
573 | 'col_style': 'radio toggle', | ||
574 | 'col_min' : 160, | ||
575 | 'col_max' : 160 | ||
576 | }] | ||
577 | |||
578 | |||
564 | def __init__(self, image_folder, image_types, title, parent, flags, buttons): | 579 | def __init__(self, image_folder, image_types, title, parent, flags, buttons): |
565 | super(ImageSelectionDialog, self).__init__(title, parent, flags, buttons) | 580 | super(ImageSelectionDialog, self).__init__(title, parent, flags, buttons) |
566 | self.connect("response", self.response_cb) | 581 | self.connect("response", self.response_cb) |
@@ -596,11 +611,25 @@ class ImageSelectionDialog (gtk.Dialog): | |||
596 | open_button.connect("clicked", self.select_path_cb, self, entry) | 611 | open_button.connect("clicked", self.select_path_cb, self, entry) |
597 | table.attach(open_button, 9, 10, 0, 1) | 612 | table.attach(open_button, 9, 10, 0, 1) |
598 | 613 | ||
599 | imgtv_widget, self.imgsel_tv = HobWidget.gen_imgtv_widget(400, 160) | 614 | self.image_table = HobViewTable(self.__columns__) |
600 | self.vbox.pack_start(imgtv_widget, expand=True, fill=True) | 615 | self.image_table.connect("toggled", self.toggled_cb) |
616 | self.vbox.pack_start(self.image_table, expand=True, fill=True) | ||
601 | 617 | ||
602 | self.show_all() | 618 | self.show_all() |
603 | 619 | ||
620 | def toggled_cb(self, table, cell, path, columnid, tree): | ||
621 | model = tree.get_model() | ||
622 | if not model: | ||
623 | return | ||
624 | iter = model.get_iter_first() | ||
625 | while iter: | ||
626 | rowpath = model.get_path(iter) | ||
627 | model[rowpath][columnid] = False | ||
628 | iter = model.iter_next(iter) | ||
629 | |||
630 | model[path][columnid] = True | ||
631 | |||
632 | |||
604 | def select_path_cb(self, action, parent, entry): | 633 | def select_path_cb(self, action, parent, entry): |
605 | dialog = gtk.FileChooserDialog("", parent, | 634 | dialog = gtk.FileChooserDialog("", parent, |
606 | gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER, | 635 | gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER, |
@@ -627,7 +656,7 @@ class ImageSelectionDialog (gtk.Dialog): | |||
627 | for image in imageset: | 656 | for image in imageset: |
628 | self.image_store.set(self.image_store.append(), 0, image, 1, False) | 657 | self.image_store.set(self.image_store.append(), 0, image, 1, False) |
629 | 658 | ||
630 | self.imgsel_tv.set_model(self.image_store) | 659 | self.image_table.set_model(self.image_store) |
631 | 660 | ||
632 | def response_cb(self, dialog, response_id): | 661 | def response_cb(self, dialog, response_id): |
633 | self.image_names = [] | 662 | self.image_names = [] |
diff --git a/bitbake/lib/bb/ui/crumbs/hobwidget.py b/bitbake/lib/bb/ui/crumbs/hobwidget.py index 890151ddd4..141c4efb1b 100644 --- a/bitbake/lib/bb/ui/crumbs/hobwidget.py +++ b/bitbake/lib/bb/ui/crumbs/hobwidget.py | |||
@@ -423,104 +423,6 @@ class HobWidget: | |||
423 | return hbox, layer_store | 423 | return hbox, layer_store |
424 | 424 | ||
425 | @classmethod | 425 | @classmethod |
426 | def _toggle_single_cb(cls, cell, select_path, treeview, toggle_column): | ||
427 | model = treeview.get_model() | ||
428 | if not model: | ||
429 | return | ||
430 | iter = model.get_iter_first() | ||
431 | while iter: | ||
432 | path = model.get_path(iter) | ||
433 | model[path][toggle_column] = False | ||
434 | iter = model.iter_next(iter) | ||
435 | |||
436 | model[select_path][toggle_column] = True | ||
437 | |||
438 | @classmethod | ||
439 | def gen_imgtv_widget(cls, col0_width, col1_width): | ||
440 | vbox = gtk.VBox(False, 10) | ||
441 | |||
442 | imgsel_tv = gtk.TreeView() | ||
443 | imgsel_tv.set_rules_hint(True) | ||
444 | imgsel_tv.set_headers_visible(False) | ||
445 | tree_selection = imgsel_tv.get_selection() | ||
446 | tree_selection.set_mode(gtk.SELECTION_SINGLE) | ||
447 | |||
448 | col0= gtk.TreeViewColumn('Image name') | ||
449 | cell0 = gtk.CellRendererText() | ||
450 | cell0.set_padding(5,2) | ||
451 | col0.pack_start(cell0, True) | ||
452 | col0.set_attributes(cell0, text=0) | ||
453 | col0.set_max_width(col0_width) | ||
454 | col0.set_min_width(col0_width) | ||
455 | imgsel_tv.append_column(col0) | ||
456 | |||
457 | col1= gtk.TreeViewColumn('Select') | ||
458 | cell1 = gtk.CellRendererToggle() | ||
459 | cell1.set_padding(5,2) | ||
460 | cell1.connect("toggled", cls._toggle_single_cb, imgsel_tv, 1) | ||
461 | col1.pack_start(cell1, True) | ||
462 | col1.set_attributes(cell1, active=1) | ||
463 | col1.set_max_width(col1_width) | ||
464 | col1.set_min_width(col1_width) | ||
465 | imgsel_tv.append_column(col1) | ||
466 | |||
467 | scroll = gtk.ScrolledWindow() | ||
468 | scroll.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC) | ||
469 | scroll.set_shadow_type(gtk.SHADOW_IN) | ||
470 | scroll.add(imgsel_tv) | ||
471 | |||
472 | vbox.pack_start(scroll, expand=True, fill=True) | ||
473 | |||
474 | return vbox, imgsel_tv | ||
475 | |||
476 | @classmethod | ||
477 | def gen_images_widget(cls, col0_width, col1_width, col2_width): | ||
478 | vbox = gtk.VBox(False, 10) | ||
479 | |||
480 | imgsel_tv = gtk.TreeView() | ||
481 | imgsel_tv.set_rules_hint(True) | ||
482 | imgsel_tv.set_headers_visible(False) | ||
483 | tree_selection = imgsel_tv.get_selection() | ||
484 | tree_selection.set_mode(gtk.SELECTION_SINGLE) | ||
485 | |||
486 | col0= gtk.TreeViewColumn('Image name') | ||
487 | cell0 = gtk.CellRendererText() | ||
488 | cell0.set_padding(5,2) | ||
489 | col0.pack_start(cell0, True) | ||
490 | col0.set_attributes(cell0, text=0) | ||
491 | col0.set_max_width(col0_width) | ||
492 | col0.set_min_width(col0_width) | ||
493 | imgsel_tv.append_column(col0) | ||
494 | |||
495 | col1= gtk.TreeViewColumn('Image size') | ||
496 | cell1 = gtk.CellRendererText() | ||
497 | cell1.set_padding(5,2) | ||
498 | col1.pack_start(cell1, True) | ||
499 | col1.set_attributes(cell1, text=1) | ||
500 | col1.set_max_width(col1_width) | ||
501 | col1.set_min_width(col1_width) | ||
502 | imgsel_tv.append_column(col1) | ||
503 | |||
504 | col2= gtk.TreeViewColumn('Select') | ||
505 | cell2 = gtk.CellRendererToggle() | ||
506 | cell2.set_padding(5,2) | ||
507 | cell2.connect("toggled", cls._toggle_single_cb, imgsel_tv, 2) | ||
508 | col2.pack_start(cell2, True) | ||
509 | col2.set_attributes(cell2, active=2) | ||
510 | col2.set_max_width(col2_width) | ||
511 | col2.set_min_width(col2_width) | ||
512 | imgsel_tv.append_column(col2) | ||
513 | |||
514 | scroll = gtk.ScrolledWindow() | ||
515 | scroll.set_policy(gtk.POLICY_NEVER, gtk.POLICY_AUTOMATIC) | ||
516 | scroll.set_shadow_type(gtk.SHADOW_IN) | ||
517 | scroll.add(imgsel_tv) | ||
518 | |||
519 | vbox.pack_start(scroll, expand=True, fill=True) | ||
520 | |||
521 | return vbox, imgsel_tv | ||
522 | |||
523 | @classmethod | ||
524 | def _on_add_item_clicked(cls, button, model): | 426 | def _on_add_item_clicked(cls, button, model): |
525 | new_item = ["##KEY##", "##VALUE##"] | 427 | new_item = ["##KEY##", "##VALUE##"] |
526 | 428 | ||
@@ -617,34 +519,59 @@ class HobViewTable (gtk.VBox): | |||
617 | """ | 519 | """ |
618 | A VBox to contain the table for different recipe views and package view | 520 | A VBox to contain the table for different recipe views and package view |
619 | """ | 521 | """ |
620 | def __init__(self, columns, reset_clicked_cb=None, toggled_cb=None): | 522 | __gsignals__ = { |
523 | "toggled" : (gobject.SIGNAL_RUN_LAST, | ||
524 | gobject.TYPE_NONE, | ||
525 | (gobject.TYPE_PYOBJECT, | ||
526 | gobject.TYPE_STRING, | ||
527 | gobject.TYPE_INT, | ||
528 | gobject.TYPE_PYOBJECT,)), | ||
529 | "changed" : (gobject.SIGNAL_RUN_LAST, | ||
530 | gobject.TYPE_NONE, | ||
531 | (gobject.TYPE_PYOBJECT, | ||
532 | gobject.TYPE_PYOBJECT,)), | ||
533 | } | ||
534 | |||
535 | def __init__(self, columns): | ||
621 | gtk.VBox.__init__(self, False, 6) | 536 | gtk.VBox.__init__(self, False, 6) |
622 | self.table_tree = gtk.TreeView() | 537 | self.table_tree = gtk.TreeView() |
623 | self.table_tree.set_headers_visible(True) | 538 | self.table_tree.set_headers_visible(True) |
624 | self.table_tree.set_headers_clickable(True) | 539 | self.table_tree.set_headers_clickable(True) |
625 | self.table_tree.set_enable_search(True) | 540 | self.table_tree.set_enable_search(True) |
626 | self.table_tree.set_search_column(0) | 541 | self.table_tree.set_rules_hint(True) |
627 | self.table_tree.get_selection().set_mode(gtk.SELECTION_SINGLE) | 542 | self.table_tree.get_selection().set_mode(gtk.SELECTION_SINGLE) |
543 | self.table_tree.get_selection().connect("changed", self.selection_changed_cb, self.table_tree) | ||
628 | 544 | ||
629 | for i in range(len(columns)): | 545 | for i in range(len(columns)): |
630 | col = gtk.TreeViewColumn(columns[i]['col_name']) | 546 | col = gtk.TreeViewColumn(columns[i]['col_name']) |
631 | col.set_clickable(True) | 547 | col.set_clickable(True) |
632 | col.set_resizable(True) | 548 | col.set_resizable(True) |
633 | col.set_sort_column_id(columns[i]['col_id']) | 549 | col.set_sort_column_id(columns[i]['col_id']) |
634 | col.set_min_width(columns[i]['col_min']) | 550 | if 'col_min' in columns[i].keys(): |
635 | col.set_max_width(columns[i]['col_max']) | 551 | col.set_min_width(columns[i]['col_min']) |
552 | if 'col_max' in columns[i].keys(): | ||
553 | col.set_max_width(columns[i]['col_max']) | ||
636 | self.table_tree.append_column(col) | 554 | self.table_tree.append_column(col) |
637 | 555 | ||
638 | if columns[i]['col_style'] == 'toggle': | 556 | if (not 'col_style' in columns[i].keys()) or columns[i]['col_style'] == 'text': |
557 | cell = gtk.CellRendererText() | ||
558 | col.pack_start(cell, True) | ||
559 | col.set_attributes(cell, text=columns[i]['col_id']) | ||
560 | elif columns[i]['col_style'] == 'check toggle': | ||
639 | cell = gtk.CellRendererToggle() | 561 | cell = gtk.CellRendererToggle() |
640 | cell.set_property('activatable', True) | 562 | cell.set_property('activatable', True) |
641 | cell.connect("toggled", toggled_cb, self.table_tree) | 563 | cell.connect("toggled", self.toggled_cb, i, self.table_tree) |
564 | self.toggle_id = i | ||
565 | col.pack_end(cell, True) | ||
566 | col.set_attributes(cell, active=columns[i]['col_id']) | ||
567 | elif columns[i]['col_style'] == 'radio toggle': | ||
568 | cell = gtk.CellRendererToggle() | ||
569 | cell.set_property('activatable', True) | ||
570 | cell.set_radio(True) | ||
571 | cell.connect("toggled", self.toggled_cb, i, self.table_tree) | ||
572 | self.toggle_id = i | ||
642 | col.pack_end(cell, True) | 573 | col.pack_end(cell, True) |
643 | col.set_attributes(cell, active=columns[i]['col_id']) | 574 | col.set_attributes(cell, active=columns[i]['col_id']) |
644 | elif columns[i]['col_style'] == 'text': | ||
645 | cell = gtk.CellRendererText() | ||
646 | col.pack_start(cell, True) | ||
647 | col.set_attributes(cell, text=columns[i]['col_id']) | ||
648 | 575 | ||
649 | scroll = gtk.ScrolledWindow() | 576 | scroll = gtk.ScrolledWindow() |
650 | scroll.set_policy(gtk.POLICY_NEVER, gtk.POLICY_ALWAYS) | 577 | scroll.set_policy(gtk.POLICY_NEVER, gtk.POLICY_ALWAYS) |
@@ -652,12 +579,27 @@ class HobViewTable (gtk.VBox): | |||
652 | scroll.add(self.table_tree) | 579 | scroll.add(self.table_tree) |
653 | self.pack_start(scroll, True, True, 0) | 580 | self.pack_start(scroll, True, True, 0) |
654 | 581 | ||
655 | hbox = gtk.HBox(False, 5) | 582 | def set_model(self, tree_model): |
656 | button = gtk.Button("Reset") | 583 | self.table_tree.set_model(tree_model) |
657 | button.connect('clicked', reset_clicked_cb) | 584 | |
658 | hbox.pack_end(button, False, False, 0) | 585 | def set_search_entry(self, search_column_id, entry): |
586 | self.table_tree.set_search_column(search_column_id) | ||
587 | self.table_tree.set_search_entry(entry) | ||
588 | |||
589 | def toggle_default(self): | ||
590 | model = self.table_tree.get_model() | ||
591 | if not model: | ||
592 | return | ||
593 | iter = model.get_iter_first() | ||
594 | if iter: | ||
595 | rowpath = model.get_path(iter) | ||
596 | model[rowpath][self.toggle_id] = True | ||
597 | |||
598 | def toggled_cb(self, cell, path, columnid, tree): | ||
599 | self.emit("toggled", cell, path, columnid, tree) | ||
659 | 600 | ||
660 | self.pack_start(hbox, False, False, 0) | 601 | def selection_changed_cb(self, selection, tree): |
602 | self.emit("changed", selection, tree) | ||
661 | 603 | ||
662 | class HobViewBar (gtk.EventBox): | 604 | class HobViewBar (gtk.EventBox): |
663 | """ | 605 | """ |
diff --git a/bitbake/lib/bb/ui/crumbs/imagedetailspage.py b/bitbake/lib/bb/ui/crumbs/imagedetailspage.py index e8419e0ee9..7f93db7ef9 100755 --- a/bitbake/lib/bb/ui/crumbs/imagedetailspage.py +++ b/bitbake/lib/bb/ui/crumbs/imagedetailspage.py | |||
@@ -23,7 +23,7 @@ | |||
23 | import gobject | 23 | import gobject |
24 | import gtk | 24 | import gtk |
25 | from bb.ui.crumbs.hobcolor import HobColors | 25 | from bb.ui.crumbs.hobcolor import HobColors |
26 | from bb.ui.crumbs.hobwidget import hic, HobWidget | 26 | from bb.ui.crumbs.hobwidget import hic, HobViewTable |
27 | from bb.ui.crumbs.hobpages import HobPage | 27 | from bb.ui.crumbs.hobpages import HobPage |
28 | 28 | ||
29 | # | 29 | # |
@@ -31,8 +31,28 @@ from bb.ui.crumbs.hobpages import HobPage | |||
31 | # | 31 | # |
32 | class ImageDetailsPage (HobPage): | 32 | class ImageDetailsPage (HobPage): |
33 | 33 | ||
34 | __columns__ = [{ | ||
35 | 'col_name' : 'Image name', | ||
36 | 'col_id' : 0, | ||
37 | 'col_style': 'text', | ||
38 | 'col_min' : 500, | ||
39 | 'col_max' : 500 | ||
40 | }, { | ||
41 | 'col_name' : 'Image size', | ||
42 | 'col_id' : 1, | ||
43 | 'col_style': 'text', | ||
44 | 'col_min' : 100, | ||
45 | 'col_max' : 100 | ||
46 | }, { | ||
47 | 'col_name' : 'Select', | ||
48 | 'col_id' : 2, | ||
49 | 'col_style': 'radio toggle', | ||
50 | 'col_min' : 100, | ||
51 | 'col_max' : 100 | ||
52 | }] | ||
53 | |||
34 | class DetailBox (gtk.EventBox): | 54 | class DetailBox (gtk.EventBox): |
35 | def __init__(self, varlist, vallist, icon = None, button = None, color = HobColors.LIGHT_GRAY): | 55 | def __init__(self, widget = None, varlist = None, vallist = None, icon = None, button = None, color = HobColors.LIGHT_GRAY): |
36 | gtk.EventBox.__init__(self) | 56 | gtk.EventBox.__init__(self) |
37 | 57 | ||
38 | # set color | 58 | # set color |
@@ -44,8 +64,11 @@ class ImageDetailsPage (HobPage): | |||
44 | self.hbox.set_border_width(15) | 64 | self.hbox.set_border_width(15) |
45 | self.add(self.hbox) | 65 | self.add(self.hbox) |
46 | 66 | ||
47 | # pack the icon and the text on the left | 67 | if widget != None: |
48 | row = len(varlist) | 68 | row = 1 |
69 | elif varlist != None and vallist != None: | ||
70 | # pack the icon and the text on the left | ||
71 | row = len(varlist) | ||
49 | self.table = gtk.Table(row, 20, True) | 72 | self.table = gtk.Table(row, 20, True) |
50 | self.table.set_size_request(100, -1) | 73 | self.table.set_size_request(100, -1) |
51 | self.hbox.pack_start(self.table, expand=True, fill=True, padding=15) | 74 | self.hbox.pack_start(self.table, expand=True, fill=True, padding=15) |
@@ -54,8 +77,11 @@ class ImageDetailsPage (HobPage): | |||
54 | if icon != None: | 77 | if icon != None: |
55 | self.table.attach(icon, colid, colid + 2, 0, 1) | 78 | self.table.attach(icon, colid, colid + 2, 0, 1) |
56 | colid = colid + 2 | 79 | colid = colid + 2 |
57 | for line in range(0, row): | 80 | if widget != None: |
58 | self.table.attach(self.text2label(varlist[line], vallist[line]), colid, 20, line, line + 1) | 81 | self.table.attach(widget, colid, 20, 0, 1) |
82 | elif varlist != None and vallist != None: | ||
83 | for line in range(0, row): | ||
84 | self.table.attach(self.text2label(varlist[line], vallist[line]), colid, 20, line, line + 1) | ||
59 | 85 | ||
60 | # pack the button on the right | 86 | # pack the button on the right |
61 | if button != None: | 87 | if button != None: |
@@ -137,7 +163,7 @@ class ImageDetailsPage (HobPage): | |||
137 | icon.set_from_pixbuf(pix_buffer) | 163 | icon.set_from_pixbuf(pix_buffer) |
138 | varlist = [""] | 164 | varlist = [""] |
139 | vallist = ["Your image is ready"] | 165 | vallist = ["Your image is ready"] |
140 | build_result = self.DetailBox(varlist=varlist, vallist=vallist, icon=icon, button=None, color=color) | 166 | build_result = self.DetailBox(varlist=varlist, vallist=vallist, icon=icon, color=color) |
141 | self.box_group_area.pack_start(build_result, expand=False, fill=False) | 167 | self.box_group_area.pack_start(build_result, expand=False, fill=False) |
142 | 168 | ||
143 | # Name | 169 | # Name |
@@ -145,9 +171,12 @@ class ImageDetailsPage (HobPage): | |||
145 | for image_name in image_names: | 171 | for image_name in image_names: |
146 | image_size = self._size_to_string(os.stat(os.path.join(image_addr, image_name)).st_size) | 172 | image_size = self._size_to_string(os.stat(os.path.join(image_addr, image_name)).st_size) |
147 | self.image_store.set(self.image_store.append(), 0, image_name, 1, image_size, 2, False) | 173 | self.image_store.set(self.image_store.append(), 0, image_name, 1, image_size, 2, False) |
148 | images_widget, treeview = HobWidget.gen_images_widget(600, 200, 100) | 174 | image_table = HobViewTable(self.__columns__) |
149 | treeview.set_model(self.image_store) | 175 | image_table.set_model(self.image_store) |
150 | self.box_group_area.pack_start(images_widget, expand=False, fill=False) | 176 | image_table.toggle_default() |
177 | image_table.connect("toggled", self.toggled_cb) | ||
178 | view_files_button = gtk.LinkButton("file://%s" % image_addr, "View files") | ||
179 | self.box_group_area.pack_start(self.DetailBox(widget=image_table, button=view_files_button), expand=True, fill=True) | ||
151 | 180 | ||
152 | # Machine, Base image and Layers | 181 | # Machine, Base image and Layers |
153 | layer_num_limit = 15 | 182 | layer_num_limit = 15 |
@@ -175,7 +204,7 @@ class ImageDetailsPage (HobPage): | |||
175 | 204 | ||
176 | edit_config_button = gtk.LinkButton("Changes settings for build", "Edit configuration") | 205 | edit_config_button = gtk.LinkButton("Changes settings for build", "Edit configuration") |
177 | edit_config_button.connect("clicked", self.edit_config_button_clicked_cb) | 206 | edit_config_button.connect("clicked", self.edit_config_button_clicked_cb) |
178 | setting_detail = self.DetailBox(varlist=varlist, vallist=vallist, icon=None, button=edit_config_button) | 207 | setting_detail = self.DetailBox(varlist=varlist, vallist=vallist, button=edit_config_button) |
179 | self.box_group_area.pack_start(setting_detail, expand=False, fill=False) | 208 | self.box_group_area.pack_start(setting_detail, expand=False, fill=False) |
180 | 209 | ||
181 | # Packages included, and Total image size | 210 | # Packages included, and Total image size |
@@ -188,7 +217,7 @@ class ImageDetailsPage (HobPage): | |||
188 | edit_packages_button.connect("clicked", self.edit_packages_button_clicked_cb) | 217 | edit_packages_button.connect("clicked", self.edit_packages_button_clicked_cb) |
189 | else: # get to this page from "My images" | 218 | else: # get to this page from "My images" |
190 | edit_packages_button = None | 219 | edit_packages_button = None |
191 | package_detail = self.DetailBox(varlist=varlist, vallist=vallist, icon=None, button=edit_packages_button) | 220 | package_detail = self.DetailBox(varlist=varlist, vallist=vallist, button=edit_packages_button) |
192 | self.box_group_area.pack_start(package_detail, expand=False, fill=False) | 221 | self.box_group_area.pack_start(package_detail, expand=False, fill=False) |
193 | if build_succeeded: | 222 | if build_succeeded: |
194 | buttonlist = ["Build new image", "Save as template", "Run image", "Deploy image"] | 223 | buttonlist = ["Build new image", "Save as template", "Run image", "Deploy image"] |
@@ -199,6 +228,18 @@ class ImageDetailsPage (HobPage): | |||
199 | 228 | ||
200 | self.show_all() | 229 | self.show_all() |
201 | 230 | ||
231 | def toggled_cb(self, table, cell, path, columnid, tree): | ||
232 | model = tree.get_model() | ||
233 | if not model: | ||
234 | return | ||
235 | iter = model.get_iter_first() | ||
236 | while iter: | ||
237 | rowpath = model.get_path(iter) | ||
238 | model[rowpath][columnid] = False | ||
239 | iter = model.iter_next(iter) | ||
240 | |||
241 | model[path][columnid] = True | ||
242 | |||
202 | def create_bottom_buttons(self, buttonlist): | 243 | def create_bottom_buttons(self, buttonlist): |
203 | # Create the buttons at the bottom | 244 | # Create the buttons at the bottom |
204 | bottom_buttons = gtk.HBox(False, 5) | 245 | bottom_buttons = gtk.HBox(False, 5) |
diff --git a/bitbake/lib/bb/ui/crumbs/packageselectionpage.py b/bitbake/lib/bb/ui/crumbs/packageselectionpage.py index 8a8ab7585e..280d480c43 100755 --- a/bitbake/lib/bb/ui/crumbs/packageselectionpage.py +++ b/bitbake/lib/bb/ui/crumbs/packageselectionpage.py | |||
@@ -51,7 +51,7 @@ class PackageSelectionPage (HobPage): | |||
51 | }, { | 51 | }, { |
52 | 'col_name' : 'Included', | 52 | 'col_name' : 'Included', |
53 | 'col_id' : PackageListModel.COL_INC, | 53 | 'col_id' : PackageListModel.COL_INC, |
54 | 'col_style': 'toggle', | 54 | 'col_style': 'check toggle', |
55 | 'col_min' : 50, | 55 | 'col_min' : 50, |
56 | 'col_max' : 50 | 56 | 'col_max' : 50 |
57 | }] | 57 | }] |
@@ -79,7 +79,7 @@ class PackageSelectionPage (HobPage): | |||
79 | }, { | 79 | }, { |
80 | 'col_name' : 'Included', | 80 | 'col_name' : 'Included', |
81 | 'col_id' : PackageListModel.COL_INC, | 81 | 'col_id' : PackageListModel.COL_INC, |
82 | 'col_style': 'toggle', | 82 | 'col_style': 'check toggle', |
83 | 'col_min' : 50, | 83 | 'col_min' : 50, |
84 | 'col_max' : 50 | 84 | 'col_max' : 50 |
85 | }] | 85 | }] |
@@ -111,9 +111,19 @@ class PackageSelectionPage (HobPage): | |||
111 | # append the tab | 111 | # append the tab |
112 | for i in range(len(self.pages)): | 112 | for i in range(len(self.pages)): |
113 | columns = self.pages[i]['columns'] | 113 | columns = self.pages[i]['columns'] |
114 | tab = HobViewTable(columns, self.reset_clicked_cb, self.table_toggled_cb) | 114 | tab = HobViewTable(columns) |
115 | filter = self.pages[i]['filter'] | 115 | filter = self.pages[i]['filter'] |
116 | tab.table_tree.set_model(self.package_model.tree_model(filter)) | 116 | tab.set_model(self.package_model.tree_model(filter)) |
117 | tab.connect("toggled", self.table_toggled_cb) | ||
118 | if self.pages[i]['name'] == "Included": | ||
119 | tab.connect("changed", self.tree_selection_cb) | ||
120 | |||
121 | reset_button = gtk.Button("Reset") | ||
122 | reset_button.connect("clicked", self.reset_clicked_cb) | ||
123 | hbox = gtk.HBox(False, 5) | ||
124 | hbox.pack_end(reset_button, expand=False, fill=False) | ||
125 | tab.pack_start(hbox, expand=False, fill=False) | ||
126 | |||
117 | label = gtk.Label(self.pages[i]['name']) | 127 | label = gtk.Label(self.pages[i]['name']) |
118 | self.ins.append_page(tab, label) | 128 | self.ins.append_page(tab, label) |
119 | self.tables.append(tab) | 129 | self.tables.append(tab) |
@@ -124,11 +134,7 @@ class PackageSelectionPage (HobPage): | |||
124 | self.grid.attach(self.topbar, 0, 1, 0, 1, gtk.FILL | gtk.EXPAND, gtk.FILL | gtk.EXPAND, 1, 1) | 134 | self.grid.attach(self.topbar, 0, 1, 0, 1, gtk.FILL | gtk.EXPAND, gtk.FILL | gtk.EXPAND, 1, 1) |
125 | # set the search entry for each table | 135 | # set the search entry for each table |
126 | for tab in self.tables: | 136 | for tab in self.tables: |
127 | tab.table_tree.set_search_entry(self.topbar.search) | 137 | tab.set_search_entry(0, self.topbar.search) |
128 | |||
129 | inctab_tree_view = self.tables[len(self.pages)-1].table_tree | ||
130 | inctab_tree_selection = inctab_tree_view.get_selection() | ||
131 | inctab_tree_selection.connect("changed", self.tree_selection_cb, inctab_tree_view) | ||
132 | 138 | ||
133 | # add all into the dialog | 139 | # add all into the dialog |
134 | self.box_group_area.add(self.grid) | 140 | self.box_group_area.add(self.grid) |
@@ -155,7 +161,7 @@ class PackageSelectionPage (HobPage): | |||
155 | self.back_button.connect("clicked", self.back_button_clicked_cb) | 161 | self.back_button.connect("clicked", self.back_button_clicked_cb) |
156 | button_box.pack_start(self.back_button, expand=False, fill=False) | 162 | button_box.pack_start(self.back_button, expand=False, fill=False) |
157 | 163 | ||
158 | def tree_selection_cb(self, tree_selection, tree_view): | 164 | def tree_selection_cb(self, table, tree_selection, tree_view): |
159 | tree_model = tree_view.get_model() | 165 | tree_model = tree_view.get_model() |
160 | path, column = tree_view.get_cursor() | 166 | path, column = tree_view.get_cursor() |
161 | if not path or column == tree_view.get_column(2): | 167 | if not path or column == tree_view.get_column(2): |
@@ -218,7 +224,7 @@ class PackageSelectionPage (HobPage): | |||
218 | 224 | ||
219 | self.builder.window_sensitive(True) | 225 | self.builder.window_sensitive(True) |
220 | 226 | ||
221 | def table_toggled_cb(self, cell, view_path, view_tree): | 227 | def table_toggled_cb(self, table, cell, view_path, toggled_columnid, view_tree): |
222 | # Click to include a package | 228 | # Click to include a package |
223 | self.builder.window_sensitive(False) | 229 | self.builder.window_sensitive(False) |
224 | view_model = view_tree.get_model() | 230 | view_model = view_tree.get_model() |
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() |