Rebased "HIG compliant message dialogs"
cover Rebased "HIG compliant message dialogs"
Two patches that weren't merged in 1.5.
Rebased, in case they are needed for 1.6.
Valentin Popa (2):
HOB: HIG compliant message dialogs
GUI error dialog for bitbake
bitbake/lib/bb/ui/crumbs/builder.py | 92 ++++++++++++---------- .../lib/bb/ui/crumbs/hig/advancedsettingsdialog.py | 5 +- .../lib/bb/ui/crumbs/hig/crumbsmessagedialog.py | 55 ++++--------- bitbake/lib/bb/ui/crumbs/hig/deployimagedialog.py | 12 ++- .../lib/bb/ui/crumbs/hig/layerselectiondialog.py | 11 +-- bitbake/lib/bb/ui/crumbs/hig/saveimagedialog.py | 5 +- .../lib/bb/ui/crumbs/hig/simplesettingsdialog.py | 9 +-- scripts/hob | 9 ++- scripts/show_error_dialog | 63 +++++++++++++++ 9 files changed, 158 insertions(+), 103 deletions(-) create mode 100755 scripts/show_error_dialog
Signature · 1 line
1.8.3.2
PATCH 1/2 HOB: HIG compliant message dialogs
"More" HIG compliant dialogs for HOB.
--- bitbake/lib/bb/ui/crumbs/builder.py | 92 ++++++++++++---------- .../lib/bb/ui/crumbs/hig/advancedsettingsdialog.py | 5 +- .../lib/bb/ui/crumbs/hig/crumbsmessagedialog.py | 55 ++++--------- bitbake/lib/bb/ui/crumbs/hig/deployimagedialog.py | 12 ++- .../lib/bb/ui/crumbs/hig/layerselectiondialog.py | 11 +-- bitbake/lib/bb/ui/crumbs/hig/saveimagedialog.py | 5 +- .../lib/bb/ui/crumbs/hig/simplesettingsdialog.py | 9 +-- 7 files changed, 87 insertions(+), 102 deletions(-)
bitbake/lib/bb/ui/crumbs/builder.py +49 -43
@@ -794,8 +794,8 @@ class Builder(gtk.Window): self.generate_image_async(True) def show_error_dialog(self, msg): - lbl = "<b>Hob found an error</b>\n" - dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_ERROR, msg) + lbl = "<b>Hob found an error</b>" + dialog = CrumbsMessageDialog(self, lbl, gtk.MESSAGE_ERROR, msg) button = dialog.add_button("Close", gtk.RESPONSE_OK) HobButton.style_button(button) response = dialog.run()
@@ -811,10 +811,9 @@ class Builder(gtk.Window): dialog.destroy() def show_network_error_dialog(self): - lbl = "<b>Hob cannot connect to the network</b>\n" - msg = "Please check your network connection. If you are using a proxy server, please make sure it is configured correctly." - lbl = lbl + "%s\n\n" % glib.markup_escape_text(msg) - dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_ERROR) + lbl = "<b>Hob cannot connect to the network</b>" + msg = msg + "Please check your network connection. If you are using a proxy server, please make sure it is configured correctly." + dialog = CrumbsMessageDialog(self, lbl, gtk.MESSAGE_ERROR, msg) button = dialog.add_button("Close", gtk.RESPONSE_OK) HobButton.style_button(button) button = dialog.add_button("Proxy settings", gtk.RESPONSE_CANCEL)
@@ -1037,7 +1036,7 @@ class Builder(gtk.Window): self.build_failed() def handler_no_provider_cb(self, running_build, msg): - dialog = CrumbsMessageDialog(self, glib.markup_escape_text(msg), gtk.STOCK_DIALOG_INFO) + dialog = CrumbsMessageDialog(self, glib.markup_escape_text(msg), gtk.MESSAGE_INFO) button = dialog.add_button("Close", gtk.RESPONSE_OK) HobButton.style_button(button) dialog.run()
@@ -1100,9 +1099,10 @@ class Builder(gtk.Window): def build_packages(self): _, all_recipes = self.recipe_model.get_selected_recipes() if not all_recipes: - lbl = "<b>No selections made</b>\nYou have not made any selections" - lbl = lbl + " so there isn't anything to bake at this time." - dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_INFO) + lbl = "<b>No selections made</b>" + msg = "You have not made any selections" + msg = msg + " so there isn't anything to bake at this time." + dialog = CrumbsMessageDialog(self, lbl, gtk.MESSAGE_INFO, msg) button = dialog.add_button("Close", gtk.RESPONSE_OK) HobButton.style_button(button) dialog.run()
@@ -1113,9 +1113,10 @@ class Builder(gtk.Window): def build_image(self): selected_packages = self.package_model.get_selected_packages() if not selected_packages: - lbl = "<b>No selections made</b>\nYou have not made any selections" - lbl = lbl + " so there isn't anything to bake at this time." - dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_INFO) + lbl = "<b>No selections made</b>" + msg = "You have not made any selections" + msg = msg + " so there isn't anything to bake at this time." + dialog = CrumbsMessageDialog(self, lbl, gtk.MESSAGE_INFO, msg) button = dialog.add_button("Close", gtk.RESPONSE_OK) HobButton.style_button(button) dialog.run()
@@ -1129,9 +1130,10 @@ class Builder(gtk.Window): # If no base image and no selected packages don't build anything if not (selected_packages or selected_image != self.recipe_model.__custom_image__): - lbl = "<b>No selections made</b>\nYou have not made any selections" - lbl = lbl + " so there isn't anything to bake at this time." - dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_INFO) + lbl = "<b>No selections made</b>" + msg = "You have not made any selections" + msg = msg + " so there isn't anything to bake at this time." + dialog = CrumbsMessageDialog(self, lbl, gtk.MESSAGE_INFO, msg) button = dialog.add_button("Close", gtk.RESPONSE_OK) HobButton.style_button(button) dialog.run()
@@ -1215,8 +1217,9 @@ class Builder(gtk.Window): response = dialog.run() if response == gtk.RESPONSE_YES: if not dialog.image_names: - lbl = "<b>No selections made</b>\nYou have not made any selections" - crumbs_dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_INFO) + lbl = "<b>No selections made</b>" + msg = "You have not made any selections" + crumbs_dialog = CrumbsMessageDialog(self, lbl, gtk.MESSAGE_INFO, msg) button = crumbs_dialog.add_button("Close", gtk.RESPONSE_OK) HobButton.style_button(button) crumbs_dialog.run()
@@ -1303,7 +1306,7 @@ class Builder(gtk.Window): def deploy_image(self, image_name): if not image_name: lbl = "<b>Please select an image to deploy.</b>" - dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_INFO) + dialog = CrumbsMessageDialog(self, lbl, gtk.MESSAGE_INFO) button = dialog.add_button("Close", gtk.RESPONSE_OK) HobButton.style_button(button) dialog.run()
@@ -1350,7 +1353,7 @@ class Builder(gtk.Window): def runqemu_image(self, image_name, kernel_name): if not image_name or not kernel_name: lbl = "<b>Please select an %s to launch in QEMU.</b>" % ("kernel" if image_name else "image") - dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_INFO) + dialog = CrumbsMessageDialog(self, lbl, gtk.MESSAGE_INFO) button = dialog.add_button("Close", gtk.RESPONSE_OK) HobButton.style_button(button) dialog.run()
@@ -1371,14 +1374,15 @@ class Builder(gtk.Window): cmdline += "runqemu " + kernel_path + " " + image_path + "\"\'" subprocess.Popen(shlex.split(cmdline)) else: - lbl = "<b>Path error</b>\nOne of your paths is wrong," - lbl = lbl + " please make sure the following paths exist:\n" - lbl = lbl + "image path:" + image_path + "\n" - lbl = lbl + "kernel path:" + kernel_path + "\n" - lbl = lbl + "source environment path:" + source_env_path + "\n" - lbl = lbl + "tmp path: " + tmp_path + "." - lbl = lbl + "You may be missing either xterm or vte for terminal services." - dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_ERROR) + lbl = "<b>Path error</b>" + msg = "One of your paths is wrong," + msg = msg + " please make sure the following paths exist:\n" + msg = msg + "image path:" + image_path + "\n" + msg = msg + "kernel path:" + kernel_path + "\n" + msg = msg + "source environment path:" + source_env_path + "\n" + msg = msg + "tmp path: " + tmp_path + "." + msg = msg + "You may be missing either xterm or vte for terminal services." + dialog = CrumbsMessageDialog(self, lbl, gtk.MESSAGE_ERROR, msg) button = dialog.add_button("Close", gtk.RESPONSE_OK) HobButton.style_button(button) dialog.run()
@@ -1398,26 +1402,28 @@ class Builder(gtk.Window): def stop_build(self): if self.stopping: - lbl = "<b>Force Stop build?</b>\nYou've already selected Stop once," - lbl = lbl + " would you like to 'Force Stop' the build?\n\n" - lbl = lbl + "This will stop the build as quickly as possible but may" - lbl = lbl + " well leave your build directory in an unusable state" - lbl = lbl + " that requires manual steps to fix.\n" - dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_WARNING) + lbl = "<b>Force Stop build?</b>" + msg = "You've already selected Stop once," + msg = msg + " would you like to 'Force Stop' the build?\n\n" + msg = msg + "This will stop the build as quickly as possible but may" + msg = msg + " well leave your build directory in an unusable state" + msg = msg + " that requires manual steps to fix." + dialog = CrumbsMessageDialog(self, lbl, gtk.MESSAGE_WARNING, msg) button = dialog.add_button("Cancel", gtk.RESPONSE_CANCEL) HobAltButton.style_button(button) button = dialog.add_button("Force Stop", gtk.RESPONSE_YES) HobButton.style_button(button) else: - lbl = "<b>Stop build?</b>\n\nAre you sure you want to stop this" - lbl = lbl + " build?\n\n'Stop' will stop the build as soon as all in" - lbl = lbl + " progress build tasks are finished. However if a" - lbl = lbl + " lengthy compilation phase is in progress this may take" - lbl = lbl + " some time.\n\n" - lbl = lbl + "'Force Stop' will stop the build as quickly as" - lbl = lbl + " possible but may well leave your build directory in an" - lbl = lbl + " unusable state that requires manual steps to fix." - dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_WARNING) + lbl = "<b>Stop build?</b>" + msg = "Are you sure you want to stop this" + msg = msg + " build?\n\n'Stop' will stop the build as soon as all in" + msg = msg + " progress build tasks are finished. However if a" + msg = msg + " lengthy compilation phase is in progress this may take" + msg = msg + " some time.\n\n" + msg = msg + "'Force Stop' will stop the build as quickly as" + msg = msg + " possible but may well leave your build directory in an" + msg = msg + " unusable state that requires manual steps to fix." + dialog = CrumbsMessageDialog(self, lbl, gtk.MESSAGE_WARNING, msg) button = dialog.add_button("Cancel", gtk.RESPONSE_CANCEL) HobAltButton.style_button(button) button = dialog.add_button("Force stop", gtk.RESPONSE_YES)
bitbake/lib/bb/ui/crumbs/hig/advancedsettingsdialog.py +3 -2
@@ -183,8 +183,9 @@ class AdvancedSettingsDialog (CrumbsDialog, SettingsUIHelper): self.set_save_button_state() if self.get_num_checked_image_types() == 0: # Show an error dialog - lbl = "<b>Select an image type</b>\n\nYou need to select at least one image type." - dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_WARNING) + lbl = "<b>Select an image type</b>" + msg = "You need to select at least one image type." + dialog = CrumbsMessageDialog(self, lbl, gtk.MESSAGE_WARNING, msg) button = dialog.add_button("OK", gtk.RESPONSE_OK) HobButton.style_button(button) response = dialog.run()
bitbake/lib/bb/ui/crumbs/hig/crumbsmessagedialog.py +15 -40
73 lines not on this page · raw message
bitbake/lib/bb/ui/crumbs/hig/deployimagedialog.py +8 -4
@@ -160,6 +160,7 @@ class DeployImageDialog (CrumbsDialog): def response_cb(self, dialog, response_id): if response_id == gtk.RESPONSE_YES: lbl = '' + msg = '' combo_item = self.usb_combo.get_active_text() if combo_item and combo_item != self.__dummy_usb__ and self.image_path: cmdline = bb.ui.crumbs.utils.which_terminal()
@@ -172,15 +173,18 @@ class DeployImageDialog (CrumbsDialog): if int(tmpfile.readline().strip()) == 0: lbl = "<b>Deploy image successfully.</b>" else: - lbl = "<b>Failed to deploy image.</b>\nPlease check image <b>%s</b> exists and USB device <b>%s</b> is writable." % (self.image_path, combo_item) + lbl = "<b>Failed to deploy image.</b>" + msg = "Please check image <b>%s</b> exists and USB device <b>%s</b> is writable." % (self.image_path, combo_item) tmpfile.close() else: if not self.image_path: - lbl = "<b>No selection made.</b>\nYou have not selected an image to deploy." + lbl = "<b>No selection made.</b>" + msg = "You have not selected an image to deploy." else: - lbl = "<b>No selection made.</b>\nYou have not selected a USB device." + lbl = "<b>No selection made.</b>" + msg = "You have not selected a USB device." if len(lbl): - crumbs_dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_INFO) + crumbs_dialog = CrumbsMessageDialog(self, lbl, gtk.MESSAGE_INFO, msg) button = crumbs_dialog.add_button("Close", gtk.RESPONSE_OK) HobButton.style_button(button) crumbs_dialog.run()
bitbake/lib/bb/ui/crumbs/hig/layerselectiondialog.py +6 -5
@@ -92,7 +92,8 @@ class LayerSelectionDialog (CrumbsDialog): path = dialog.get_filename() dialog.destroy() - lbl = "<b>Error</b>\nUnable to load layer <i>%s</i> because " % path + lbl = "<b>Error</b>" + msg = "Unable to load layer <i>%s</i> because " % path if response == gtk.RESPONSE_YES: import os import os.path
@@ -103,15 +104,15 @@ class LayerSelectionDialog (CrumbsDialog): it = layer_store.iter_next(it) if not path: - lbl += "it is an invalid path." + msg += "it is an invalid path." elif not os.path.exists(path+"/conf/layer.conf"): - lbl += "there is no layer.conf inside the directory." + msg += "there is no layer.conf inside the directory." elif path in layers: - lbl += "it is already in loaded layers." + msg += "it is already in loaded layers." else: layer_store.append([path]) return - dialog = CrumbsMessageDialog(parent, lbl) + dialog = CrumbsMessageDialog(parent, lbl, gtk.MESSAGE_ERROR, msg) dialog.add_button(gtk.STOCK_CLOSE, gtk.RESPONSE_OK) response = dialog.run() dialog.destroy()
bitbake/lib/bb/ui/crumbs/hig/saveimagedialog.py +2 -3
@@ -146,12 +146,11 @@ class SaveImageDialog (CrumbsDialog): self.show_invalid_input_error_dialog() def show_invalid_input_error_dialog(self): - lbl = "<b>Invalid characters in image recipe name</b>\n" + lbl = "<b>Invalid characters in image recipe name</b>" msg = "Image recipe names should be all lowercase and\n" msg += "include only alphanumeric characters. The only\n" msg += "special character you can use is the ASCII hyphen (-)." - lbl = lbl + "\n%s\n" % glib.markup_escape_text(msg) - dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_ERROR) + dialog = CrumbsMessageDialog(self, lbl, gtk.MESSAGE_ERROR, msg) button = dialog.add_button("Close", gtk.RESPONSE_OK) HobButton.style_button(button)
bitbake/lib/bb/ui/crumbs/hig/simplesettingsdialog.py +4 -5
@@ -212,13 +212,12 @@ class SimpleSettingsDialog (CrumbsDialog, SettingsUIHelper): def response_cb(self, dialog, response_id): if response_id == gtk.RESPONSE_YES: if self.proxy_checkbox.get_active(): - # Check that all proxy entries have a corresponding port + # Check that all proxy entries have a corresponding port for proxy, port in zip(self.all_proxy_addresses, self.all_proxy_ports): if proxy.get_text() and not port.get_text(): - lbl = "<b>Enter all port numbers</b>\n\n" - msg = "Proxy servers require a port number. Please make sure " - msg += "you have entered a port number for each proxy server." - dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_WARNING, msg) + lbl = "<b>Enter all port numbers</b>" + msg = "Proxy servers require a port number. Please make sure you have entered a port number for each proxy server." + dialog = CrumbsMessageDialog(self, lbl, gtk.MESSAGE_WARNING, msg) button = dialog.add_button("Close", gtk.RESPONSE_OK) HobButton.style_button(button) response = dialog.run()
Signature · 1 line
1.8.3.2
PATCH 2/2 GUI error dialog for bitbake
In reply to Valentin PopaWhen the user starts HOB, he/she expects to see some GUI.
If bitbake signals an erros before HOB starts the error will be visible only in console and hob script will terminate. This patch allows bitbake to report errors inside a GUI dialog when the user wants to use HOB.
WebHOB starts before bitbake's launch and a common solution for this problem that applies to both HOB and WebHOB is not so obvious.
--- scripts/hob | 9 ++++++- scripts/show_error_dialog | 63 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 71 insertions(+), 1 deletion(-) create mode 100755 scripts/show_error_dialog
scripts/hob +8 -1
@@ -1,6 +1,13 @@ #!/usr/bin/env bash export BB_ENV_EXTRAWHITE="DISABLE_SANITY_CHECKS $BB_ENV_EXTRAWHITE" -DISABLE_SANITY_CHECKS=1 bitbake -u hob $@ +SAVED_ERRORS="$(mktemp)" +DISABLE_SANITY_CHECKS=1 bitbake -u hob $@ > $SAVED_ERRORS ret=$? + +if (( $ret == 1 )); then #there is an error and hob didn't start + show_error_dialog $SAVED_ERRORS +fi +rm $SAVED_ERRORS + exit $ret
scripts/show_error_dialog new file +63 -0
63 lines not on this page · raw message
Signature · 1 line
1.8.3.2