summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/ui
diff options
context:
space:
mode:
authorLiming An <limingx.l.an@intel.com>2012-05-21 22:41:22 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-05-23 11:33:18 +0100
commit0d210ff8e84ee75104f5b3e7a2c4722c87a84875 (patch)
tree3cab7c3ba3c715d6b52f8b9517d615948328190f /bitbake/lib/bb/ui
parent374ad22550f0610f41e127352a3efb2c62689ff0 (diff)
downloadpoky-0d210ff8e84ee75104f5b3e7a2c4722c87a84875.tar.gz
Hob: fixed the issue about bug 'running image' workflow and related view
[YOCTO #2155] (Bitbake rev: 5e14cb41e8ba26a3114ea2c8b8f83b271bc44b54) Signed-off-by: Liming An <limingx.l.an@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/ui')
-rwxr-xr-xbitbake/lib/bb/ui/crumbs/imagedetailspage.py75
1 files changed, 53 insertions, 22 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/imagedetailspage.py b/bitbake/lib/bb/ui/crumbs/imagedetailspage.py
index 1cfef80ac9..f5175445b5 100755
--- a/bitbake/lib/bb/ui/crumbs/imagedetailspage.py
+++ b/bitbake/lib/bb/ui/crumbs/imagedetailspage.py
@@ -32,23 +32,23 @@ from bb.ui.crumbs.hobpages import HobPage
32class ImageDetailsPage (HobPage): 32class ImageDetailsPage (HobPage):
33 33
34 __columns__ = [{ 34 __columns__ = [{
35 'col_name' : 'Selected',
36 'col_id' : 2,
37 'col_style': 'radio toggle',
38 'col_min' : 100,
39 'col_max' : 100
40 },{
41 'col_name' : 'Image name', 35 'col_name' : 'Image name',
42 'col_id' : 0, 36 'col_id' : 0,
43 'col_style': 'text', 37 'col_style': 'text',
44 'col_min' : 500, 38 'col_min' : 500,
45 'col_max' : 500 39 'col_max' : 500
46 }, { 40 },{
47 'col_name' : 'Image size', 41 'col_name' : 'Image size',
48 'col_id' : 1, 42 'col_id' : 1,
49 'col_style': 'text', 43 'col_style': 'text',
50 'col_min' : 100, 44 'col_min' : 100,
51 'col_max' : 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 }] 52 }]
53 53
54 class DetailBox (gtk.EventBox): 54 class DetailBox (gtk.EventBox):
@@ -201,46 +201,42 @@ class ImageDetailsPage (HobPage):
201 self.buttonlist = ["Build new image", "Run image", "Deploy image"] 201 self.buttonlist = ["Build new image", "Run image", "Deploy image"]
202 202
203 # Name 203 # Name
204 varlist = [""]
205 vallist = ["Listed generated image and package files."]
206 t = ''
207 self.image_store.clear() 204 self.image_store.clear()
208 default_toggled = False 205 default_toggled = False
209 default_image_size = 0 206 default_image_size = 0
207 num_toggled = 0
210 i = 0 208 i = 0
211 for image_name in image_names: 209 for image_name in image_names:
212 image_size = HobPage._size_to_string(os.stat(os.path.join(image_addr, image_name)).st_size) 210 image_size = HobPage._size_to_string(os.stat(os.path.join(image_addr, image_name)).st_size)
211 is_toggled = (self.test_type_runnable(image_name) and self.test_mach_runnable(image_name)) \
212 or self.test_deployable(image_name)
213
213 if not default_toggled: 214 if not default_toggled:
214 default_toggled = (self.test_type_runnable(image_name) and self.test_mach_runnable(image_name)) \ 215 default_toggled = is_toggled
215 or self.test_deployable(image_name)
216 if i == (len(image_names) - 1): 216 if i == (len(image_names) - 1):
217 default_toggled = True 217 default_toggled = True
218 self.image_store.set(self.image_store.append(), 0, image_name, 1, image_size, 2, default_toggled) 218 self.image_store.set(self.image_store.append(), 0, image_name, 1, image_size, 2, default_toggled)
219 if default_toggled: 219 if default_toggled:
220 default_image_size = image_size 220 default_image_size = image_size
221 self.create_bottom_buttons(self.buttonlist, image_name) 221 self.create_bottom_buttons(self.buttonlist, image_name)
222 if 'qemu' in image_name:
223 t = ' (Selected QEMU items to be as runnable image)'
224 else:
225 t = ' (Selected Targeted item to be deploy)'
226 else: 222 else:
227 self.image_store.set(self.image_store.append(), 0, image_name, 1, image_size, 2, False) 223 self.image_store.set(self.image_store.append(), 0, image_name, 1, image_size, 2, False)
228 i = i + 1 224 i = i + 1
225 num_toggled += is_toggled
229 226
230 if build_succeeded: 227 if build_succeeded and (num_toggled < 2):
231 varlist = ["Name: ", "Directory: ", ". "] 228 varlist = ["Name: ", "Directory: "]
232 vallist = [] 229 vallist = []
233 vallist.append(image_name.split('.')[0]) 230 vallist.append(image_name.split('.')[0])
234 vallist.append(image_addr) 231 vallist.append(image_addr)
235 vallist.append(t)
236 image_table = None 232 image_table = None
237 else: 233 else:
234 varlist = None
235 vallist = None
238 image_table = HobViewTable(self.__columns__) 236 image_table = HobViewTable(self.__columns__)
239 image_table.set_model(self.image_store) 237 image_table.set_model(self.image_store)
240 image_table.connect("row-activated", self.row_activated_cb) 238 image_table.connect("row-activated", self.row_activated_cb)
241 if default_image_size and ('qemu' in image_name): 239 image_table.connect_group_selection(self.table_selected_cb)
242 t = '\n(Selected QEMU items to be as runnable image, so you need to select prompted kernel to run)'
243 vallist[0] += t
244 240
245 view_files_button = HobAltButton("View files") 241 view_files_button = HobAltButton("View files")
246 view_files_button.connect("clicked", self.view_files_clicked_cb, image_addr) 242 view_files_button.connect("clicked", self.view_files_clicked_cb, image_addr)
@@ -328,6 +324,41 @@ class ImageDetailsPage (HobPage):
328 break 324 break
329 return deployable 325 return deployable
330 326
327 def table_selected_cb(self, selection):
328 model, paths = selection.get_selected_rows()
329 if (not model) or (not paths):
330 return
331
332 path = paths[0]
333 columnid = 2
334 iter = model.get_iter_first()
335 while iter:
336 rowpath = model.get_path(iter)
337 model[rowpath][columnid] = False
338 iter = model.iter_next(iter)
339
340 model[path][columnid] = True
341 self.refresh_package_detail_box(model[path][1])
342
343 image_name = model[path][0]
344
345 # remove
346 for button_id, button in self.button_ids.items():
347 button.disconnect(button_id)
348 self._remove_all_widget()
349 # repack
350 self.pack_start(self.details_top_buttons, expand=False, fill=False)
351 self.pack_start(self.group_align, expand=True, fill=True)
352 if self.build_result:
353 self.box_group_area.pack_start(self.build_result, expand=False, fill=False)
354 self.box_group_area.pack_start(self.image_detail, expand=True, fill=True)
355 if self.setting_detail:
356 self.box_group_area.pack_start(self.setting_detail, expand=False, fill=False)
357 self.box_group_area.pack_start(self.package_detail, expand=False, fill=False)
358 self.create_bottom_buttons(self.buttonlist, image_name)
359 self.box_group_area.pack_end(self.details_bottom_buttons, expand=False, fill=False)
360 self.show_all()
361
331 def row_activated_cb(self, table, model, path): 362 def row_activated_cb(self, table, model, path):
332 if not model: 363 if not model:
333 return 364 return