Skip to contentSkip to conversation

HOB: HIG compliant message dialogs

PATCH In review Valentin Popa 2 participants 6 messages Sep 25, 2013 – Sep 27, 2013

lore
Share & tools
lore
#0 lore raw

PATCH 1/2 HOB: HIG compliant message dialogs

"More" HIG compliant dialogs for HOB.

---
 bitbake/lib/bb/ui/crumbs/builder.py                | 99 ++++++++++++----------
 .../lib/bb/ui/crumbs/hig/advancedsettingsdialog.py |  5 +-
 .../lib/bb/ui/crumbs/hig/crumbsmessagedialog.py    | 56 ++++--------
 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   |  4 +-
 7 files changed, 90 insertions(+), 102 deletions(-)
bitbake/lib/bb/ui/crumbs/builder.py +53 -46
index 86fdbfe..433ff11 100755
@@ -793,8 +793,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()
@@ -810,10 +810,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)
@@ -1036,7 +1035,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()
@@ -1099,9 +1098,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()
@@ -1112,9 +1112,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()
@@ -1128,9 +1129,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()
@@ -1214,8 +1216,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()
@@ -1302,7 +1305,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()
@@ -1349,7 +1352,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()
@@ -1370,14 +1373,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()
@@ -1386,9 +1390,10 @@ class Builder(gtk.Window):
     def show_packages(self, ask=True):
         _, selected_recipes = self.recipe_model.get_selected_recipes()
         if selected_recipes and ask:
-            lbl = "<b>Package list may be incomplete!</b>\nDo you want to build selected recipes"
-            lbl = lbl + " to get a full list or just view the existing packages?"
-            dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_INFO)
+            lbl = "<b>Package list may be incomplete!</b>"
+            msg = "Do you want to build selected recipes"
+            msg = msg + " to get a full list or just view the existing packages?"
+            dialog = CrumbsMessageDialog(self, lbl, gtk.MESSAGE_INFO, msg)
             button = dialog.add_button("View packages", gtk.RESPONSE_NO)
             HobAltButton.style_button(button)
             button = dialog.add_button("Build packages", gtk.RESPONSE_YES)
@@ -1414,26 +1419,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
index 86a65ae..5b449cd 100644
@@ -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 +16 -40

74 lines not on this page · raw message

bitbake/lib/bb/ui/crumbs/hig/deployimagedialog.py +8 -4
index bc1efbb..f64fbd6 100644
@@ -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
index 783ee73..1d100c5 100644
@@ -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
index e940cee..4195f70 100644
@@ -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 +2 -2
index de924b1..5229a3d 100644
@@ -214,9 +214,9 @@ class SimpleSettingsDialog (CrumbsDialog, SettingsUIHelper):
             # 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"
+                    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.STOCK_DIALOG_WARNING, msg)
+                    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.1.2
#1 lore raw

PATCH 2/2 GUI error dialog for bitbake

When 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.

---
 bitbake/lib/bb/ui/show_error_dialog | 62 +++++++++++++++++++++++++++++++++++++
 scripts/hob                         |  9 +++++-
 2 files changed, 70 insertions(+), 1 deletion(-)
 create mode 100755 bitbake/lib/bb/ui/show_error_dialog
bitbake/lib/bb/ui/show_error_dialog new file +62 -0
new file mode 100755
index 0000000..09d0c5c
@@ -0,0 +1,62 @@
+#!/usr/bin/env python
+#
+# BitBake graphical error reporting dialog used by hob script
+#
+# Copyright (C) 2013        Intel Corporation
+#
+# Authored by Valentin Popa <[email protected]>
+# Authored by Andrei Dinu <[email protected]>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+import sys
+import os
+requirements = "FATAL: Gtk+ 2.20.0 or higher & PyGtk 2.21.0 or higher is required"
+try:
+    import gtk
+    import pygtk
+    pygtk.require('2.0') # to be certain we don't have gtk+ 1.x !?!
+    gtkver = gtk.gtk_version
+    pygtkver = gtk.pygtk_version
+    if gtkver  < (2, 20, 0) or pygtkver < (2, 21, 0):
+        sys.exit("%s,\nYou have Gtk+ %s and PyGtk %s." % (requirements,
+                ".".join(map(str, gtkver)),
+                ".".join(map(str, pygtkver))))
+except ImportError as exc:
+    sys.exit("%s (%s)." % (requirements, str(exc)))
+
+try:
+    import crumbs
+except RuntimeError as exc:
+    sys.exit(str(exc))
+sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.dirname(__file__))))
+
+from crumbs.hig.crumbsmessagedialog import CrumbsMessageDialog
+from crumbs.hobwidget import HobButton
+
+class HobError(gtk.Window):
+
+    def __init__(self, error_log_file):
+        message = open(error_log_file).readlines()
+        label = "<b>Hob found an error</b>"
+        dialog = CrumbsMessageDialog(self, label, gtk.MESSAGE_ERROR, "".join(message))
+        button = dialog.add_button("Close", gtk.RESPONSE_OK)
+        HobButton.style_button(button)
+        button.connect("clicked", lambda w:sys.exit())
+        dialog.run()
+        dialog.destroy()
+
+if __name__ == "__main__":
+    HobError(sys.argv[1])
+
scripts/hob +8 -1
index 8d33ab1..bbb2366 100755
@@ -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 $@
+ERROR_LOG=$BUILDDIR/tmp/log/saved_errors.log
+DISABLE_SANITY_CHECKS=1 bitbake -u hob $@ > $ERROR_LOG
 
 ret=$?
+
+if (( $ret == 1 )); then #there is an error and hob didn't start
+    $BUILDDIR/../bitbake/lib/bb/ui/show_error_dialog $ERROR_LOG
+    rm $ERROR_LOG
+fi
+
 exit $ret
Signature · 1 line
1.8.1.2
#2 lore raw

Re: [PATCH 2/2] GUI error dialog for bitbake

Hi Valentin,

I have some comments on this patch:

Quoted 8 lines · Valentin Popa

When 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.

Quoted 4 lines
---
  bitbake/lib/bb/ui/show_error_dialog | 62 

+++++++++++++++++++++++++++++++++++++

The new file doesn't have the extension .py

Quoted 82 lines

scripts/hob | 9 +++++-

  2 files changed, 70 insertions(+), 1 deletion(-)

create mode 100755 bitbake/lib/bb/ui/show_error_dialog

bitbake/lib/bb/ui/show_error_dialog new file +19 -0
new file mode 100755
index 0000000..09d0c5c
@@ -0,0 +1,62 @@
+#!/usr/bin/env python
+#
+# BitBake graphical error reporting dialog used by hob script
+#
+# Copyright (C) 2013        Intel Corporation
+#
+# Authored by Valentin Popa <[email protected]>
+# Authored by Andrei Dinu <[email protected]>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License 

along
+# with this program; if not, write to the Free Software Foundation, Inc.,

bitbake/lib/bb/ui/show_error_dialog new file +5 -0
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+import sys
+import os
+requirements = "FATAL: Gtk+ 2.20.0 or higher & PyGtk 2.21.0 or higher 

is required"

bitbake/lib/bb/ui/show_error_dialog new file +18 -0
+try:
+    import gtk
+    import pygtk
+    pygtk.require('2.0') # to be certain we don't have gtk+ 1.x !?!
+    gtkver = gtk.gtk_version
+    pygtkver = gtk.pygtk_version
+    if gtkver  < (2, 20, 0) or pygtkver < (2, 21, 0):
+        sys.exit("%s,\nYou have Gtk+ %s and PyGtk %s." % (requirements,
+                ".".join(map(str, gtkver)),
+                ".".join(map(str, pygtkver))))
+except ImportError as exc:
+    sys.exit("%s (%s)." % (requirements, str(exc)))
+
+try:
+    import crumbs
+except RuntimeError as exc:
+    sys.exit(str(exc))
+sys.path.insert(0, 

os.path.dirname(os.path.dirname(os.path.dirname(__file__))))

bitbake/lib/bb/ui/show_error_dialog new file +10 -0
+
+from crumbs.hig.crumbsmessagedialog import CrumbsMessageDialog
+from crumbs.hobwidget import HobButton
+
+class HobError(gtk.Window):
+
+    def __init__(self, error_log_file):
+        message = open(error_log_file).readlines()
+        label = "<b>Hob found an error</b>"
+        dialog = CrumbsMessageDialog(self, label, gtk.MESSAGE_ERROR, 

"".join(message))

bitbake/lib/bb/ui/show_error_dialog new file +9 -0
+        button = dialog.add_button("Close", gtk.RESPONSE_OK)
+        HobButton.style_button(button)
+        button.connect("clicked", lambda w:sys.exit())
+        dialog.run()
+        dialog.destroy()
+
+if __name__ == "__main__":
+    HobError(sys.argv[1])
+
scripts/hob +0 -0
index 8d33ab1..bbb2366 100755

scripts/hob line 3

Quoted 4 lines
scripts/hob +1 -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 $@
+ERROR_LOG=$BUILDDIR/tmp/log/saved_errors.log

Instead of $BUILDDIR/tmp you should use $TMPDIR

scripts/hob line 9

Quoted 5 lines
scripts/hob +4 -0
+DISABLE_SANITY_CHECKS=1 bitbake -u hob $@ > $ERROR_LOG
    ret=$?
+
+if (( $ret == 1 )); then #there is an error and hob didn't start
+    $BUILDDIR/../bitbake/lib/bb/ui/show_error_dialog $ERROR_LOG

The path to show_error_dialog is hardcoded. For example, my poky directory is somewhere else.

scripts/hob line 13

Quoted 4 lines
scripts/hob +3 -0
+    rm $ERROR_LOG
+fi
+
  exit $ret

Cristiana

#3 lore raw

Re: [PATCH 2/2] GUI error dialog for bitbake

Quoted 97 lines · cristiana.voicu

Hi Valentin,

I have some comments on this patch:

Quoted 8 lines · Valentin Popa

When 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.

Quoted 4 lines
---
  bitbake/lib/bb/ui/show_error_dialog | 62 

+++++++++++++++++++++++++++++++++++++

The new file doesn't have the extension .py

Quoted 79 lines

scripts/hob | 9 +++++-

  2 files changed, 70 insertions(+), 1 deletion(-)

create mode 100755 bitbake/lib/bb/ui/show_error_dialog

bitbake/lib/bb/ui/show_error_dialog new file +19 -0
new file mode 100755
index 0000000..09d0c5c
@@ -0,0 +1,62 @@
+#!/usr/bin/env python
+#
+# BitBake graphical error reporting dialog used by hob script
+#
+# Copyright (C) 2013        Intel Corporation
+#
+# Authored by Valentin Popa <[email protected]>
+# Authored by Andrei Dinu <[email protected]>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License version 2 as
+# published by the Free Software Foundation.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License 

along
+# with this program; if not, write to the Free Software Foundation, Inc.,

bitbake/lib/bb/ui/show_error_dialog new file +5 -0
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+import sys
+import os
+requirements = "FATAL: Gtk+ 2.20.0 or higher & PyGtk 2.21.0 or 

higher is required"

bitbake/lib/bb/ui/show_error_dialog new file +18 -0
+try:
+    import gtk
+    import pygtk
+    pygtk.require('2.0') # to be certain we don't have gtk+ 1.x !?!
+    gtkver = gtk.gtk_version
+    pygtkver = gtk.pygtk_version
+    if gtkver  < (2, 20, 0) or pygtkver < (2, 21, 0):
+        sys.exit("%s,\nYou have Gtk+ %s and PyGtk %s." % (requirements,
+                ".".join(map(str, gtkver)),
+                ".".join(map(str, pygtkver))))
+except ImportError as exc:
+    sys.exit("%s (%s)." % (requirements, str(exc)))
+
+try:
+    import crumbs
+except RuntimeError as exc:
+    sys.exit(str(exc))
+sys.path.insert(0, 

os.path.dirname(os.path.dirname(os.path.dirname(__file__))))

bitbake/lib/bb/ui/show_error_dialog new file +10 -0
+
+from crumbs.hig.crumbsmessagedialog import CrumbsMessageDialog
+from crumbs.hobwidget import HobButton
+
+class HobError(gtk.Window):
+
+    def __init__(self, error_log_file):
+        message = open(error_log_file).readlines()
+        label = "<b>Hob found an error</b>"
+        dialog = CrumbsMessageDialog(self, label, gtk.MESSAGE_ERROR, 

"".join(message))

bitbake/lib/bb/ui/show_error_dialog new file +9 -0
+        button = dialog.add_button("Close", gtk.RESPONSE_OK)
+        HobButton.style_button(button)
+        button.connect("clicked", lambda w:sys.exit())
+        dialog.run()
+        dialog.destroy()
+
+if __name__ == "__main__":
+    HobError(sys.argv[1])
+
scripts/hob +0 -0
index 8d33ab1..bbb2366 100755
Quoted 8 lines

scripts/hob line 3

Quoted 7 lines
scripts/hob +1 -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 $@
+ERROR_LOG=$BUILDDIR/tmp/log/saved_errors.log

Instead of $BUILDDIR/tmp you should use $TMPDIR

I'll try to store the error log in /tmp (using mktemp, as Laurentiu
suggested)

Quoted 6 lines

scripts/hob line 9

Quoted 5 lines
scripts/hob +4 -0
+DISABLE_SANITY_CHECKS=1 bitbake -u hob $@ > $ERROR_LOG
    ret=$?
+
+if (( $ret == 1 )); then #there is an error and hob didn't start
+    $BUILDDIR/../bitbake/lib/bb/ui/show_error_dialog $ERROR_LOG

The path to show_error_dialog is hardcoded. For example, my poky directory is somewhere else.

I'll move show_error_dialog in scripts. Thank you for the comments.

Quoted 5 lines

scripts/hob line 13

Quoted 4 lines
scripts/hob +3 -0
+    rm $ERROR_LOG
+fi
+
  exit $ret

Cristiana

#4 lore raw
In reply to Valentin Popa
Quoted 395 lines · Valentin Popa

"More" HIG compliant dialogs for HOB.

---
  bitbake/lib/bb/ui/crumbs/builder.py                | 99 ++++++++++++----------
  .../lib/bb/ui/crumbs/hig/advancedsettingsdialog.py |  5 +-
  .../lib/bb/ui/crumbs/hig/crumbsmessagedialog.py    | 56 ++++--------
  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   |  4 +-
  7 files changed, 90 insertions(+), 102 deletions(-)
bitbake/lib/bb/ui/crumbs/builder.py +53 -46
index 86fdbfe..433ff11 100755
@@ -793,8 +793,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()
@@ -810,10 +810,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)
@@ -1036,7 +1035,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()
@@ -1099,9 +1098,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()
@@ -1112,9 +1112,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()
@@ -1128,9 +1129,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()
@@ -1214,8 +1216,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()
@@ -1302,7 +1305,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()
@@ -1349,7 +1352,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()
@@ -1370,14 +1373,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()
@@ -1386,9 +1390,10 @@ class Builder(gtk.Window):
      def show_packages(self, ask=True):
          _, selected_recipes = self.recipe_model.get_selected_recipes()
          if selected_recipes and ask:
-            lbl = "<b>Package list may be incomplete!</b>\nDo you want to build selected recipes"
-            lbl = lbl + " to get a full list or just view the existing packages?"
-            dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_INFO)
+            lbl = "<b>Package list may be incomplete!</b>"
+            msg = "Do you want to build selected recipes"
+            msg = msg + " to get a full list or just view the existing packages?"
+            dialog = CrumbsMessageDialog(self, lbl, gtk.MESSAGE_INFO, msg)
              button = dialog.add_button("View packages", gtk.RESPONSE_NO)
              HobAltButton.style_button(button)
              button = dialog.add_button("Build packages", gtk.RESPONSE_YES)
@@ -1414,26 +1419,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
index 86a65ae..5b449cd 100644
@@ -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 +16 -40
index 097ce7b..b9a32ae 100644
@@ -31,51 +31,28 @@ BitBake GUI's
  In summary: spacing = 12px, border-width = 6px
  """
 
-class CrumbsMessageDialog(CrumbsDialog):
+class CrumbsMessageDialog(gtk.MessageDialog):
      """
      A GNOME HIG compliant dialog widget.
      Add buttons with gtk.Dialog.add_button or gtk.Dialog.add_buttons
      """
-    def __init__(self, parent=None, label="", icon=gtk.STOCK_INFO, msg=""):
-        super(CrumbsMessageDialog, self).__init__("", parent, gtk.DIALOG_MODAL)
+    def __init__(self, parent = None, label="", dialog_type = gtk.MESSAGE_QUESTION, msg=""):
+        super(CrumbsMessageDialog, self).__init__(None,
+                                                  gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
+                                                  dialog_type,
+                                                  gtk.BUTTONS_NONE,
+                                                  None)
 
-        self.set_border_width(6)
-        self.vbox.set_property("spacing", 12)
-        self.action_area.set_property("spacing", 12)
-        self.action_area.set_property("border-width", 6)
+        self.set_skip_taskbar_hint(False)
 
-        first_column = gtk.HBox(spacing=12)
-        first_column.set_property("border-width", 6)
-        first_column.show()
-        self.vbox.add(first_column)
-
-        self.icon = gtk.Image()
-        # We have our own Info icon which should be used in preference of the stock icon
-        self.icon_chk = HobIconChecker()
-        self.icon.set_from_stock(self.icon_chk.check_stock_icon(icon), gtk.ICON_SIZE_DIALOG)
-        self.icon.set_property("yalign", 0.00)
-        self.icon.show()
-        first_column.pack_start(self.icon, expand=False, fill=True, padding=0)
+        self.set_markup(label)
 
-        if 0 <= len(msg) < 200:
-            lbl = label + "%s" % glib.markup_escape_text(msg)
-            self.label_short = gtk.Label()
-            self.label_short.set_use_markup(True)
-            self.label_short.set_line_wrap(True)
-            self.label_short.set_markup(lbl)
-            self.label_short.set_property("yalign", 0.00)
-            self.label_short.show()
-            first_column.add(self.label_short)
+        if 0 <= len(msg) < 300:
+            self.format_secondary_markup(msg)
          else:
-            second_row = gtk.VBox(spacing=12)
-            second_row.set_property("border-width", 6)
-            self.label_long = gtk.Label()
-            self.label_long.set_use_markup(True)
-            self.label_long.set_line_wrap(True)
-            self.label_long.set_markup(label)
-            self.label_long.set_alignment(0.0, 0.0)
-            second_row.pack_start(self.label_long, expand=False, fill=False, padding=0)
-            self.label_long.show()
+            vbox = self.get_message_area()
+            vbox.set_border_width(1)
+            vbox.set_property("spacing", 12)
              self.textWindow = gtk.ScrolledWindow()
              self.textWindow.set_shadow_type(gtk.SHADOW_IN)
              self.textWindow.set_policy(gtk.POLICY_AUTOMATIC, gtk.POLICY_AUTOMATIC)
@@ -89,7 +66,6 @@ class CrumbsMessageDialog(CrumbsDialog):
              self.msgView.set_buffer(self.buf)
              self.textWindow.add(self.msgView)
              self.msgView.show()
-            second_row.add(self.textWindow)
+            vbox.add(self.textWindow)
              self.textWindow.show()
-            first_column.add(second_row)
-            second_row.show()
+
bitbake/lib/bb/ui/crumbs/hig/deployimagedialog.py +8 -4
index bc1efbb..f64fbd6 100644
@@ -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
index 783ee73..1d100c5 100644
@@ -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
index e940cee..4195f70 100644
@@ -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 +0 -0
index de924b1..5229a3d 100644
@@ -214,9 +214,9 @@ class SimpleSettingsDialog (CrumbsDialog, SettingsUIHelper):
              # Check that all proxy entries have a corresponding port

bitbake/lib/bb/ui/crumbs/hig/simplesettingsdialog.py class SimpleSettingsDialog (CrumbsDialog, SettingsUIHelper): · line 222

Quoted 10 lines
bitbake/lib/bb/ui/crumbs/hig/simplesettingsdialog.py +2 -2
              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"
+                    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.STOCK_DIALOG_WARNING, msg)
+                    dialog = CrumbsMessageDialog(self, lbl, gtk.MESSAGE_WARNING, msg)
                      button = dialog.add_button("Close", gtk.RESPONSE_OK)
                      HobButton.style_button(button)
                      response = dialog.run()

Hi Valentin,
Using gtk.STOCK_DIALOG_.. stuff, Hob looks as per design. I tested your patch, but, for example, when you stop a build the message shown uses an error image (not a warning one) and all the widgets are placed different. It looks better without it. Please send a contrib branch to Belen, to know her opinion, because it hase a big impact on design. Thanks,
Cristiana

#5 lore raw
Quoted 490 lines · cristiana.voicu
Quoted 489 lines · Valentin Popa

"More" HIG compliant dialogs for HOB.

---
  bitbake/lib/bb/ui/crumbs/builder.py                | 99 
++++++++++++----------
  .../lib/bb/ui/crumbs/hig/advancedsettingsdialog.py |  5 +-
  .../lib/bb/ui/crumbs/hig/crumbsmessagedialog.py    | 56 ++++--------
  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   |  4 +-
  7 files changed, 90 insertions(+), 102 deletions(-)
bitbake/lib/bb/ui/crumbs/builder.py +2 -4
index 86fdbfe..433ff11 100755
@@ -793,8 +793,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()
@@ -810,10 +810,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."

bitbake/lib/bb/ui/crumbs/builder.py +2 -2
-        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)

bitbake/lib/bb/ui/crumbs/builder.py +1 -1
@@ -1036,7 +1035,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()

bitbake/lib/bb/ui/crumbs/builder.py +0 -1
@@ -1099,9 +1098,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)

bitbake/lib/bb/ui/crumbs/builder.py +3 -0
+            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()

bitbake/lib/bb/ui/crumbs/builder.py +0 -1
@@ -1112,9 +1112,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)

bitbake/lib/bb/ui/crumbs/builder.py +3 -0
+            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()

bitbake/lib/bb/ui/crumbs/builder.py +0 -0
@@ -1128,9 +1129,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)

bitbake/lib/bb/ui/crumbs/builder.py +3 -0
+            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()

bitbake/lib/bb/ui/crumbs/builder.py +0 -1
@@ -1214,8 +1216,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)

bitbake/lib/bb/ui/crumbs/builder.py +3 -0
+                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()

bitbake/lib/bb/ui/crumbs/builder.py +1 -1
@@ -1302,7 +1305,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()

bitbake/lib/bb/ui/crumbs/builder.py +1 -1
@@ -1349,7 +1352,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()

bitbake/lib/bb/ui/crumbs/builder.py +1 -2
@@ -1370,14 +1373,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"

bitbake/lib/bb/ui/crumbs/builder.py +1 -5
-            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)

bitbake/lib/bb/ui/crumbs/builder.py +3 -0
+            lbl = "<b>Path error</b>"
+            msg = "One of your paths is wrong,"
+            msg = msg + " please make sure the following paths 

exist:\n"

bitbake/lib/bb/ui/crumbs/builder.py +6 -0
+            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()

bitbake/lib/bb/ui/crumbs/builder.py +0 -1
@@ -1386,9 +1390,10 @@ class Builder(gtk.Window):
      def show_packages(self, ask=True):
          _, selected_recipes = self.recipe_model.get_selected_recipes()
          if selected_recipes and ask:
-            lbl = "<b>Package list may be incomplete!</b>\nDo you 

want to build selected recipes"
- lbl = lbl + " to get a full list or just view the
existing packages?"
- dialog = CrumbsMessageDialog(self, lbl,
gtk.STOCK_DIALOG_INFO)

bitbake/lib/bb/ui/crumbs/builder.py +3 -0
+            lbl = "<b>Package list may be incomplete!</b>"
+            msg = "Do you want to build selected recipes"
+            msg = msg + " to get a full list or just view the 

existing packages?"
+ dialog = CrumbsMessageDialog(self, lbl,
gtk.MESSAGE_INFO, msg)
button = dialog.add_button("View packages",
gtk.RESPONSE_NO)
HobAltButton.style_button(button) button = dialog.add_button("Build packages",
gtk.RESPONSE_YES)

bitbake/lib/bb/ui/crumbs/builder.py +0 -1
@@ -1414,26 +1419,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"

bitbake/lib/bb/ui/crumbs/builder.py +0 -2
-            lbl = lbl + " that requires manual steps to fix.\n"
-            dialog = CrumbsMessageDialog(self, lbl, 

gtk.STOCK_DIALOG_WARNING)

bitbake/lib/bb/ui/crumbs/builder.py +3 -0
+            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"

bitbake/lib/bb/ui/crumbs/builder.py +2 -0
+            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"

bitbake/lib/bb/ui/crumbs/builder.py +0 -2
-            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)

bitbake/lib/bb/ui/crumbs/builder.py +3 -0
+            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"

bitbake/lib/bb/ui/crumbs/builder.py +2 -0
+            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 +0 -0
index 86a65ae..5b449cd 100644
@@ -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)

bitbake/lib/bb/ui/crumbs/hig/advancedsettingsdialog.py +3 -0
+            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 +1 -1
index 097ce7b..b9a32ae 100644
@@ -31,51 +31,28 @@ BitBake GUI's
  In summary: spacing = 12px, border-width = 6px
  """
  -class CrumbsMessageDialog(CrumbsDialog):
+class CrumbsMessageDialog(gtk.MessageDialog):
      """
      A GNOME HIG compliant dialog widget.
      Add buttons with gtk.Dialog.add_button or gtk.Dialog.add_buttons
      """
-    def __init__(self, parent=None, label="", icon=gtk.STOCK_INFO, 

msg=""):
- super(CrumbsMessageDialog, self).__init__("", parent,
gtk.DIALOG_MODAL)
+ def __init__(self, parent = None, label="", dialog_type =
gtk.MESSAGE_QUESTION, msg=""):

bitbake/lib/bb/ui/crumbs/hig/crumbsmessagedialog.py +6 -9
+        super(CrumbsMessageDialog, self).__init__(None,
+ gtk.DIALOG_MODAL | gtk.DIALOG_DESTROY_WITH_PARENT,
+                                                  dialog_type,
+ gtk.BUTTONS_NONE,
+                                                  None)
  -        self.set_border_width(6)
-        self.vbox.set_property("spacing", 12)
-        self.action_area.set_property("spacing", 12)
-        self.action_area.set_property("border-width", 6)
+        self.set_skip_taskbar_hint(False)
  -        first_column = gtk.HBox(spacing=12)
-        first_column.set_property("border-width", 6)
-        first_column.show()
-        self.vbox.add(first_column)
-
-        self.icon = gtk.Image()
-        # We have our own Info icon which should be used in 

preference of the stock icon
- self.icon_chk = HobIconChecker()
- self.icon.set_from_stock(self.icon_chk.check_stock_icon(icon), gtk.ICON_SIZE_DIALOG)

bitbake/lib/bb/ui/crumbs/hig/crumbsmessagedialog.py +0 -3
-        self.icon.set_property("yalign", 0.00)
-        self.icon.show()
-        first_column.pack_start(self.icon, expand=False, fill=True, 

padding=0)

bitbake/lib/bb/ui/crumbs/hig/crumbsmessagedialog.py +3 -16
+        self.set_markup(label)
          -        if 0 <= len(msg) < 200:
-            lbl = label + "%s" % glib.markup_escape_text(msg)
-            self.label_short = gtk.Label()
-            self.label_short.set_use_markup(True)
-            self.label_short.set_line_wrap(True)
-            self.label_short.set_markup(lbl)
-            self.label_short.set_property("yalign", 0.00)
-            self.label_short.show()
-            first_column.add(self.label_short)
+        if 0 <= len(msg) < 300:
+            self.format_secondary_markup(msg)
          else:
-            second_row = gtk.VBox(spacing=12)
-            second_row.set_property("border-width", 6)
-            self.label_long = gtk.Label()
-            self.label_long.set_use_markup(True)
-            self.label_long.set_line_wrap(True)
-            self.label_long.set_markup(label)
-            self.label_long.set_alignment(0.0, 0.0)
-            second_row.pack_start(self.label_long, expand=False, 

fill=False, padding=0)

bitbake/lib/bb/ui/crumbs/hig/crumbsmessagedialog.py +3 -1
-            self.label_long.show()
+            vbox = self.get_message_area()
+            vbox.set_border_width(1)
+            vbox.set_property("spacing", 12)
              self.textWindow = gtk.ScrolledWindow()
              self.textWindow.set_shadow_type(gtk.SHADOW_IN)
              self.textWindow.set_policy(gtk.POLICY_AUTOMATIC, 

gtk.POLICY_AUTOMATIC)

bitbake/lib/bb/ui/crumbs/hig/crumbsmessagedialog.py +2 -3
@@ -89,7 +66,6 @@ class CrumbsMessageDialog(CrumbsDialog):
              self.msgView.set_buffer(self.buf)
              self.textWindow.add(self.msgView)
              self.msgView.show()
-            second_row.add(self.textWindow)
+            vbox.add(self.textWindow)
              self.textWindow.show()
-            first_column.add(second_row)
-            second_row.show()
+
bitbake/lib/bb/ui/crumbs/hig/deployimagedialog.py +1 -0
index bc1efbb..f64fbd6 100644
@@ -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()

bitbake/lib/bb/ui/crumbs/hig/deployimagedialog.py +2 -2
@@ -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."

bitbake/lib/bb/ui/crumbs/hig/deployimagedialog.py +2 -1
+                    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."

bitbake/lib/bb/ui/crumbs/hig/deployimagedialog.py +2 -1
+                    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 +0 -0
index 783ee73..1d100c5 100644
@@ -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

bitbake/lib/bb/ui/crumbs/hig/layerselectiondialog.py +6 -4
+        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 +1 -1
index e940cee..4195f70 100644
@@ -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 

(-)."

bitbake/lib/bb/ui/crumbs/hig/saveimagedialog.py +1 -2
-        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)
  diff --git a/bitbake/lib/bb/ui/crumbs/hig/simplesettingsdialog.py 

b/bitbake/lib/bb/ui/crumbs/hig/simplesettingsdialog.py index de924b1..5229a3d 100644

bitbake/lib/bb/ui/crumbs/hig/simplesettingsdialog.py +0 -0
@@ -214,9 +214,9 @@ class SimpleSettingsDialog (CrumbsDialog, 

SettingsUIHelper):
# 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():

bitbake/lib/bb/ui/crumbs/hig/simplesettingsdialog.py +1 -1
-                    lbl = "<b>Enter all port numbers</b>\n\n"
+                    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.STOCK_DIALOG_WARNING, msg)
+ dialog = CrumbsMessageDialog(self, lbl,
gtk.MESSAGE_WARNING, msg)

Quoted 8 lines
Quoted 4 lines

button = dialog.add_button("Close",
gtk.RESPONSE_OK)
HobButton.style_button(button) response = dialog.run()

Hi Valentin,
Using gtk.STOCK_DIALOG_.. stuff, Hob looks as per design. I tested your patch, but, for example, when you stop a build the message shown uses an error image (not a warning one) and all the widgets are placed different. It looks better without it. Please send a contrib branch to Belen, to know her opinion, because it hase a big impact on design. Thanks,
Cristiana

Hi Cristiana,
I know it's different but is more Gnome HIG compliant. Belen has already reviewed and approved the design.