summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/ui
diff options
context:
space:
mode:
authorCristiana Voicu <cristiana.voicu@intel.com>2012-09-18 18:15:55 +0300
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-09-20 12:05:15 +0100
commitc0c04a5404c15b6556a29b7dad16e44f7761cafe (patch)
tree19920ee2d3c22a2916b09f0a62f2bac95cb1c662 /bitbake/lib/bb/ui
parentf77488e5650b816f8bbdd53c1da525ffa88ee6f0 (diff)
downloadpoky-c0c04a5404c15b6556a29b7dad16e44f7761cafe.tar.gz
bitbake: hob: add a top bar when building process is stopped
When a build was stopped, it wasn't obvious what to do next. Now, on the page it appers a top bar with 3 buttons: "edit image", "open log", "build new image" [YOCTO #2537] (Bitbake rev: a6afd15b7a40919313e26777b514ae44b587a0f6) Signed-off-by: Cristiana Voicu <cristiana.voicu@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/builddetailspage.py76
-rwxr-xr-xbitbake/lib/bb/ui/crumbs/builder.py28
2 files changed, 92 insertions, 12 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/builddetailspage.py b/bitbake/lib/bb/ui/crumbs/builddetailspage.py
index 8d76ade6a4..85f65b7e7f 100755
--- a/bitbake/lib/bb/ui/crumbs/builddetailspage.py
+++ b/bitbake/lib/bb/ui/crumbs/builddetailspage.py
@@ -238,7 +238,7 @@ class BuildDetailsPage (HobPage):
238 open_log_button = HobAltButton("Open log") 238 open_log_button = HobAltButton("Open log")
239 open_log_button.set_relief(gtk.RELIEF_HALF) 239 open_log_button.set_relief(gtk.RELIEF_HALF)
240 open_log_button.set_tooltip_text("Open the build's log file") 240 open_log_button.set_tooltip_text("Open the build's log file")
241 open_log_button.connect('clicked', self.failure_open_log_button_clicked_cb, log_file) 241 open_log_button.connect('clicked', self.open_log_button_clicked_cb, log_file)
242 build_fail_tab.attach(open_log_button, 14, 23, 9, 12) 242 build_fail_tab.attach(open_log_button, 14, 23, 9, 12)
243 243
244 attach_pos = (24 if log_file else 14) 244 attach_pos = (24 if log_file else 14)
@@ -250,11 +250,11 @@ class BuildDetailsPage (HobPage):
250 250
251 return build_fail_top 251 return build_fail_top
252 252
253 def show_fail_page(self, title, action_names): 253 def show_fail_page(self, title):
254 self._remove_all_widget() 254 self._remove_all_widget()
255 self.title = "Hob cannot build your %s" % title 255 self.title = "Hob cannot build your %s" % title
256 256
257 self.build_fail_bar = self.add_build_fail_top_bar(action_names, self.builder.current_logfile) 257 self.build_fail_bar = self.add_build_fail_top_bar(title, self.builder.current_logfile)
258 258
259 self.pack_start(self.group_align, expand=True, fill=True) 259 self.pack_start(self.group_align, expand=True, fill=True)
260 self.box_group_area.pack_start(self.build_fail_bar, expand=False, fill=False) 260 self.box_group_area.pack_start(self.build_fail_bar, expand=False, fill=False)
@@ -266,6 +266,63 @@ class BuildDetailsPage (HobPage):
266 self.show_all() 266 self.show_all()
267 self.back_button.hide() 267 self.back_button.hide()
268 268
269 def add_build_stop_top_bar(self, action, log_file=None):
270 color = HobColors.LIGHT_GRAY
271 build_stop_top = gtk.EventBox()
272 build_stop_top.set_size_request(-1, 200)
273 build_stop_top.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(color))
274 build_stop_top.set_flags(gtk.CAN_DEFAULT)
275 build_stop_top.grab_default()
276
277 build_stop_tab = gtk.Table(11, 46, True)
278 build_stop_top.add(build_stop_tab)
279
280 icon = gtk.Image()
281 icon_pix_buffer = gtk.gdk.pixbuf_new_from_file(hic.ICON_INFO_HOVER_FILE)
282 icon.set_from_pixbuf(icon_pix_buffer)
283 build_stop_tab.attach(icon, 1, 4, 0, 6)
284
285 label = gtk.Label()
286 label.set_alignment(0.0, 0.5)
287 label.set_markup("<span size='x-large'><b>%s</b></span>" % self.title)
288 build_stop_tab.attach(label, 4, 26, 0, 6)
289
290 action_button = HobButton("Edit %s" % action)
291 action_button.set_size_request(-1, 40)
292 action_button.set_tooltip_text("Edit the %s parameters" % action)
293 action_button.connect('clicked', self.stop_primary_action_button_clicked_cb, action)
294 build_stop_tab.attach(action_button, 4, 13, 6, 9)
295
296 if log_file:
297 open_log_button = HobAltButton("Open log")
298 open_log_button.set_relief(gtk.RELIEF_HALF)
299 open_log_button.set_tooltip_text("Open the build's log file")
300 open_log_button.connect('clicked', self.open_log_button_clicked_cb, log_file)
301 build_stop_tab.attach(open_log_button, 14, 23, 6, 9)
302
303 attach_pos = (24 if log_file else 14)
304 build_button = HobAltButton("Build new image")
305 build_button.set_size_request(-1, 40)
306 build_button.set_tooltip_text("Create a new image from scratch")
307 build_button.connect('clicked', self.new_image_button_clicked_cb)
308 build_stop_tab.attach(build_button, attach_pos, attach_pos + 9, 6, 9)
309
310 return build_stop_top, action_button
311
312 def show_stop_page(self, action):
313 self._remove_all_widget()
314 self.title = "Build stopped"
315 self.build_stop_bar, action_button = self.add_build_stop_top_bar(action, self.builder.current_logfile)
316
317 self.pack_start(self.group_align, expand=True, fill=True)
318 self.box_group_area.pack_start(self.build_stop_bar, expand=False, fill=False)
319 self.box_group_area.pack_start(self.vbox, expand=True, fill=True)
320
321 self.vbox.pack_start(self.notebook, expand=True, fill=True)
322 self.show_all()
323 self.back_button.hide()
324 return action_button
325
269 def show_page(self, step): 326 def show_page(self, step):
270 self._remove_all_widget() 327 self._remove_all_widget()
271 if step == self.builder.PACKAGE_GENERATING or step == self.builder.FAST_IMAGE_GENERATING: 328 if step == self.builder.PACKAGE_GENERATING or step == self.builder.FAST_IMAGE_GENERATING:
@@ -299,6 +356,9 @@ class BuildDetailsPage (HobPage):
299 def back_button_clicked_cb(self, button): 356 def back_button_clicked_cb(self, button):
300 self.builder.show_configuration() 357 self.builder.show_configuration()
301 358
359 def new_image_button_clicked_cb(self, button):
360 self.builder.reset()
361
302 def show_back_button(self): 362 def show_back_button(self):
303 self.back_button.show() 363 self.back_button.show()
304 364
@@ -328,7 +388,15 @@ class BuildDetailsPage (HobPage):
328 elif "Edit image configuration" in action: 388 elif "Edit image configuration" in action:
329 self.builder.show_configuration() 389 self.builder.show_configuration()
330 390
331 def failure_open_log_button_clicked_cb(self, button, log_file): 391 def stop_primary_action_button_clicked_cb(self, button, action):
392 if "recipes" in action:
393 self.builder.show_recipes()
394 elif "packages" in action:
395 self.builder.show_packages()
396 elif "image" in action:
397 self.builder.show_configuration()
398
399 def open_log_button_clicked_cb(self, button, log_file):
332 if log_file: 400 if log_file:
333 os.system("xdg-open /%s" % log_file) 401 os.system("xdg-open /%s" % log_file)
334 402
diff --git a/bitbake/lib/bb/ui/crumbs/builder.py b/bitbake/lib/bb/ui/crumbs/builder.py
index 6df1ca41bd..73d31f8e6f 100755
--- a/bitbake/lib/bb/ui/crumbs/builder.py
+++ b/bitbake/lib/bb/ui/crumbs/builder.py
@@ -927,6 +927,18 @@ class Builder(gtk.Window):
927 status = "stop" 927 status = "stop"
928 message = "Build stopped: " 928 message = "Build stopped: "
929 fraction = self.build_details_page.progress_bar.get_fraction() 929 fraction = self.build_details_page.progress_bar.get_fraction()
930 stop_to_next_edit = ""
931 if self.current_step == self.FAST_IMAGE_GENERATING:
932 stop_to_next_edit = "image configuration"
933 elif self.current_step == self.IMAGE_GENERATING:
934 if self.previous_step == self.FAST_IMAGE_GENERATING:
935 stop_to_next_edit = "image configuration"
936 else:
937 stop_to_next_edit = "packages"
938 elif self.current_step == self.PACKAGE_GENERATING:
939 stop_to_next_edit = "recipes"
940 button = self.build_details_page.show_stop_page(stop_to_next_edit.split(' ')[0])
941 self.set_default(button)
930 else: 942 else:
931 fail_to_next_edit = "" 943 fail_to_next_edit = ""
932 if self.current_step == self.FAST_IMAGE_GENERATING: 944 if self.current_step == self.FAST_IMAGE_GENERATING:
@@ -941,7 +953,7 @@ class Builder(gtk.Window):
941 elif self.current_step == self.PACKAGE_GENERATING: 953 elif self.current_step == self.PACKAGE_GENERATING:
942 fail_to_next_edit = "recipes" 954 fail_to_next_edit = "recipes"
943 fraction = 1.0 955 fraction = 1.0
944 self.build_details_page.show_fail_page(fail_to_next_edit.split(' ')[0], fail_to_next_edit) 956 self.build_details_page.show_fail_page(fail_to_next_edit.split(' ')[0])
945 status = "fail" 957 status = "fail"
946 message = "Build failed: " 958 message = "Build failed: "
947 self.build_details_page.update_progress_bar(message, fraction, status) 959 self.build_details_page.update_progress_bar(message, fraction, status)
@@ -1349,19 +1361,19 @@ class Builder(gtk.Window):
1349 HobButton.style_button(button) 1361 HobButton.style_button(button)
1350 else: 1362 else:
1351 lbl = "<b>Stop build?</b>\n\nAre you sure you want to stop this" 1363 lbl = "<b>Stop build?</b>\n\nAre you sure you want to stop this"
1352 lbl = lbl + " build?\n\n'Force Stop' will stop the build as quickly as" 1364 lbl = lbl + " build?\n\n'Stop' will stop the build as soon as all in"
1353 lbl = lbl + " possible but may well leave your build directory in an"
1354 lbl = lbl + " unusable state that requires manual steps to fix.\n\n"
1355 lbl = lbl + "'Stop' will stop the build as soon as all in"
1356 lbl = lbl + " progress build tasks are finished. However if a" 1365 lbl = lbl + " progress build tasks are finished. However if a"
1357 lbl = lbl + " lengthy compilation phase is in progress this may take" 1366 lbl = lbl + " lengthy compilation phase is in progress this may take"
1358 lbl = lbl + " some time." 1367 lbl = lbl + " some time.\n\n"
1368 lbl = lbl + "'Force Stop' will stop the build as quickly as"
1369 lbl = lbl + " possible but may well leave your build directory in an"
1370 lbl = lbl + " unusable state that requires manual steps to fix."
1359 dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_WARNING) 1371 dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_WARNING)
1360 button = dialog.add_button("Cancel", gtk.RESPONSE_CANCEL) 1372 button = dialog.add_button("Cancel", gtk.RESPONSE_CANCEL)
1361 HobAltButton.style_button(button) 1373 HobAltButton.style_button(button)
1362 button = dialog.add_button("Stop", gtk.RESPONSE_OK) 1374 button = dialog.add_button("Force stop", gtk.RESPONSE_YES)
1363 HobAltButton.style_button(button) 1375 HobAltButton.style_button(button)
1364 button = dialog.add_button("Force Stop", gtk.RESPONSE_YES) 1376 button = dialog.add_button("Stop", gtk.RESPONSE_OK)
1365 HobButton.style_button(button) 1377 HobButton.style_button(button)
1366 response = dialog.run() 1378 response = dialog.run()
1367 dialog.destroy() 1379 dialog.destroy()