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/hig.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/hig.py')
-rw-r--r-- | bitbake/lib/bb/ui/crumbs/hig.py | 37 |
1 files changed, 33 insertions, 4 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 = [] |