summaryrefslogtreecommitdiffstats
path: root/bitbake
diff options
context:
space:
mode:
authorShane Wang <shane.wang@intel.com>2012-02-29 22:15:23 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-03-01 15:51:35 +0000
commitd76e62fdd8363b430df03a79c73d16c99e0aab57 (patch)
tree14cdc96874f6f3d4b7fe85f5c413a2553333f706 /bitbake
parent24883b4fc72432f9d12df7682dfd4207a719060b (diff)
downloadpoky-d76e62fdd8363b430df03a79c73d16c99e0aab57.tar.gz
Hob: fix a bug that the image size is shown incorrectly in the image details page.
Originally, the image size shows the last item in the image tree view in the image details page. That is not correct. We need to show the size of the image which the user chooses. (Bitbake rev: 01c18a24252b35959a4cc01088678f93cb2f95e5) Signed-off-by: Shane Wang <shane.wang@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rw-r--r--bitbake/lib/bb/ui/crumbs/hig.py2
-rwxr-xr-xbitbake/lib/bb/ui/crumbs/imagedetailspage.py32
2 files changed, 25 insertions, 9 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/hig.py b/bitbake/lib/bb/ui/crumbs/hig.py
index 9b96d8de4d..c5bd27a057 100644
--- a/bitbake/lib/bb/ui/crumbs/hig.py
+++ b/bitbake/lib/bb/ui/crumbs/hig.py
@@ -1035,6 +1035,7 @@ class ImageSelectionDialog (CrumbsDialog):
1035 table.attach(open_button, 9, 10, 0, 1) 1035 table.attach(open_button, 9, 10, 0, 1)
1036 1036
1037 self.image_table = HobViewTable(self.__columns__) 1037 self.image_table = HobViewTable(self.__columns__)
1038 self.image_table.set_size_request(-1, 300)
1038 self.image_table.connect("toggled", self.toggled_cb) 1039 self.image_table.connect("toggled", self.toggled_cb)
1039 self.vbox.pack_start(self.image_table, expand=True, fill=True) 1040 self.vbox.pack_start(self.image_table, expand=True, fill=True)
1040 1041
@@ -1052,7 +1053,6 @@ class ImageSelectionDialog (CrumbsDialog):
1052 1053
1053 model[path][columnid] = True 1054 model[path][columnid] = True
1054 1055
1055
1056 def select_path_cb(self, action, parent, entry): 1056 def select_path_cb(self, action, parent, entry):
1057 dialog = gtk.FileChooserDialog("", parent, 1057 dialog = gtk.FileChooserDialog("", parent,
1058 gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER, 1058 gtk.FILE_CHOOSER_ACTION_SELECT_FOLDER,
diff --git a/bitbake/lib/bb/ui/crumbs/imagedetailspage.py b/bitbake/lib/bb/ui/crumbs/imagedetailspage.py
index 7f93db7ef9..833c149dbd 100755
--- a/bitbake/lib/bb/ui/crumbs/imagedetailspage.py
+++ b/bitbake/lib/bb/ui/crumbs/imagedetailspage.py
@@ -74,6 +74,7 @@ class ImageDetailsPage (HobPage):
74 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)
75 75
76 colid = 0 76 colid = 0
77 self.line_widgets = {}
77 if icon != None: 78 if icon != None:
78 self.table.attach(icon, colid, colid + 2, 0, 1) 79 self.table.attach(icon, colid, colid + 2, 0, 1)
79 colid = colid + 2 80 colid = colid + 2
@@ -81,20 +82,31 @@ class ImageDetailsPage (HobPage):
81 self.table.attach(widget, colid, 20, 0, 1) 82 self.table.attach(widget, colid, 20, 0, 1)
82 elif varlist != None and vallist != None: 83 elif varlist != None and vallist != None:
83 for line in range(0, row): 84 for line in range(0, row):
84 self.table.attach(self.text2label(varlist[line], vallist[line]), colid, 20, line, line + 1) 85 self.line_widgets[varlist[line]] = self.text2label(varlist[line], vallist[line])
86 self.table.attach(self.line_widgets[varlist[line]], colid, 20, line, line + 1)
85 87
86 # pack the button on the right 88 # pack the button on the right
87 if button != None: 89 if button != None:
88 self.hbox.pack_end(button, expand=False, fill=False) 90 self.hbox.pack_end(button, expand=False, fill=False)
89 91
92 def update_line_widgets(self, variable, value):
93 if len(self.line_widgets) == 0:
94 return
95 if not isinstance(self.line_widgets[variable], gtk.Label):
96 return
97 self.line_widgets[variable].set_markup(self.format_line(variable, value))
98
99 def format_line(self, variable, value):
100 markup = "<span weight=\'bold\'>%s</span>" % variable
101 markup += "<span weight=\'normal\' foreground=\'#1c1c1c\' font_desc=\'14px\'>%s</span>" % value
102 return markup
103
90 def text2label(self, variable, value): 104 def text2label(self, variable, value):
91 # append the name:value to the left box 105 # append the name:value to the left box
92 # such as "Name: hob-core-minimal-variant-2011-12-15-beagleboard" 106 # such as "Name: hob-core-minimal-variant-2011-12-15-beagleboard"
93 markup = "<span weight=\'bold\'>%s</span>" % variable
94 markup += "<span weight=\'normal\' foreground=\'#1c1c1c\' font_desc=\'14px\'>%s</span>" % value
95 label = gtk.Label() 107 label = gtk.Label()
96 label.set_alignment(0.0, 0.5) 108 label.set_alignment(0.0, 0.5)
97 label.set_markup(markup) 109 label.set_markup(self.format_line(variable, value))
98 return label 110 return label
99 111
100 def __init__(self, builder): 112 def __init__(self, builder):
@@ -141,8 +153,6 @@ class ImageDetailsPage (HobPage):
141 image_addr = self.builder.parameters.image_addr 153 image_addr = self.builder.parameters.image_addr
142 image_names = self.builder.parameters.image_names 154 image_names = self.builder.parameters.image_names
143 if build_succeeded: 155 if build_succeeded:
144 image_addr = self.builder.parameters.image_addr
145 image_names = self.builder.parameters.image_names
146 machine = self.builder.configuration.curr_mach 156 machine = self.builder.configuration.curr_mach
147 base_image = self.builder.recipe_model.get_selected_image() 157 base_image = self.builder.recipe_model.get_selected_image()
148 layers = self.builder.configuration.layers 158 layers = self.builder.configuration.layers
@@ -174,6 +184,7 @@ class ImageDetailsPage (HobPage):
174 image_table = HobViewTable(self.__columns__) 184 image_table = HobViewTable(self.__columns__)
175 image_table.set_model(self.image_store) 185 image_table.set_model(self.image_store)
176 image_table.toggle_default() 186 image_table.toggle_default()
187 image_size = self._size_to_string(os.stat(os.path.join(image_addr, image_names[0])).st_size)
177 image_table.connect("toggled", self.toggled_cb) 188 image_table.connect("toggled", self.toggled_cb)
178 view_files_button = gtk.LinkButton("file://%s" % image_addr, "View files") 189 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) 190 self.box_group_area.pack_start(self.DetailBox(widget=image_table, button=view_files_button), expand=True, fill=True)
@@ -217,8 +228,9 @@ class ImageDetailsPage (HobPage):
217 edit_packages_button.connect("clicked", self.edit_packages_button_clicked_cb) 228 edit_packages_button.connect("clicked", self.edit_packages_button_clicked_cb)
218 else: # get to this page from "My images" 229 else: # get to this page from "My images"
219 edit_packages_button = None 230 edit_packages_button = None
220 package_detail = self.DetailBox(varlist=varlist, vallist=vallist, button=edit_packages_button) 231 self.package_detail = self.DetailBox(varlist=varlist, vallist=vallist, button=edit_packages_button)
221 self.box_group_area.pack_start(package_detail, expand=False, fill=False) 232 self.box_group_area.pack_start(self.package_detail, expand=False, fill=False)
233
222 if build_succeeded: 234 if build_succeeded:
223 buttonlist = ["Build new image", "Save as template", "Run image", "Deploy image"] 235 buttonlist = ["Build new image", "Save as template", "Run image", "Deploy image"]
224 else: # get to this page from "My images" 236 else: # get to this page from "My images"
@@ -228,6 +240,9 @@ class ImageDetailsPage (HobPage):
228 240
229 self.show_all() 241 self.show_all()
230 242
243 def refresh_package_detail_box(self, image_size):
244 self.package_detail.update_line_widgets("Total image size: ", image_size)
245
231 def toggled_cb(self, table, cell, path, columnid, tree): 246 def toggled_cb(self, table, cell, path, columnid, tree):
232 model = tree.get_model() 247 model = tree.get_model()
233 if not model: 248 if not model:
@@ -239,6 +254,7 @@ class ImageDetailsPage (HobPage):
239 iter = model.iter_next(iter) 254 iter = model.iter_next(iter)
240 255
241 model[path][columnid] = True 256 model[path][columnid] = True
257 self.refresh_package_detail_box(model[path][1])
242 258
243 def create_bottom_buttons(self, buttonlist): 259 def create_bottom_buttons(self, buttonlist):
244 # Create the buttons at the bottom 260 # Create the buttons at the bottom