diff options
author | Cristian Iorga <cristian.iorga@intel.com> | 2012-09-28 18:05:53 +0300 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2012-09-28 16:42:09 +0100 |
commit | 183ffd2048a1ff864a2c32412c4f8b409ee4c3e9 (patch) | |
tree | 4c9197280b8632a73dac693475b1512f5734fdf7 /bitbake | |
parent | 1a85fc8f5b9d04fecb87ecc04ac89b52387090a1 (diff) | |
download | poky-183ffd2048a1ff864a2c32412c4f8b409ee4c3e9.tar.gz |
bitbake: hob: Error reports are done in a clearer way
For long errors (bigger than 200 letters),
the text box is scrollable and resizable
and text is selectable.
Additionaly, all message dialogs are modal.
Otherwise, a user could still interact with hob
even in an error case, leading to potential problems.
See design details in related bugs.
Fixes [YOCTO #2960], [YOCTO #2983]
(Bitbake rev: be8bf02f2b347edf5514cafc6cb6a44f71118736)
Signed-off-by: Cristian Iorga <cristian.iorga@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake')
-rwxr-xr-x | bitbake/lib/bb/ui/crumbs/builder.py | 5 | ||||
-rw-r--r-- | bitbake/lib/bb/ui/crumbs/hig.py | 59 |
2 files changed, 46 insertions, 18 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/builder.py b/bitbake/lib/bb/ui/crumbs/builder.py index e952aa8208..fd555b0e7c 100755 --- a/bitbake/lib/bb/ui/crumbs/builder.py +++ b/bitbake/lib/bb/ui/crumbs/builder.py | |||
@@ -849,9 +849,8 @@ class Builder(gtk.Window): | |||
849 | self.generate_image_async(True) | 849 | self.generate_image_async(True) |
850 | 850 | ||
851 | def show_error_dialog(self, msg): | 851 | def show_error_dialog(self, msg): |
852 | lbl = "<b>Error</b>\n" | 852 | lbl = "<b>Hob found an error</b>\n" |
853 | lbl = lbl + "%s\n\n" % glib.markup_escape_text(msg) | 853 | dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_ERROR, msg) |
854 | dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_ERROR) | ||
855 | button = dialog.add_button("Close", gtk.RESPONSE_OK) | 854 | button = dialog.add_button("Close", gtk.RESPONSE_OK) |
856 | HobButton.style_button(button) | 855 | HobButton.style_button(button) |
857 | response = dialog.run() | 856 | response = dialog.run() |
diff --git a/bitbake/lib/bb/ui/crumbs/hig.py b/bitbake/lib/bb/ui/crumbs/hig.py index bdb3702e29..3c8c1c9e8a 100644 --- a/bitbake/lib/bb/ui/crumbs/hig.py +++ b/bitbake/lib/bb/ui/crumbs/hig.py | |||
@@ -21,6 +21,7 @@ | |||
21 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | 21 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
22 | 22 | ||
23 | import glob | 23 | import glob |
24 | import glib | ||
24 | import gtk | 25 | import gtk |
25 | import gobject | 26 | import gobject |
26 | import hashlib | 27 | import hashlib |
@@ -236,18 +237,18 @@ class CrumbsMessageDialog(CrumbsDialog): | |||
236 | A GNOME HIG compliant dialog widget. | 237 | A GNOME HIG compliant dialog widget. |
237 | Add buttons with gtk.Dialog.add_button or gtk.Dialog.add_buttons | 238 | Add buttons with gtk.Dialog.add_button or gtk.Dialog.add_buttons |
238 | """ | 239 | """ |
239 | def __init__(self, parent=None, label="", icon=gtk.STOCK_INFO): | 240 | def __init__(self, parent=None, label="", icon=gtk.STOCK_INFO, msg=""): |
240 | super(CrumbsMessageDialog, self).__init__("", parent, gtk.DIALOG_DESTROY_WITH_PARENT) | 241 | super(CrumbsMessageDialog, self).__init__("", parent, gtk.DIALOG_MODAL) |
241 | 242 | ||
242 | self.set_border_width(6) | 243 | self.set_border_width(6) |
243 | self.vbox.set_property("spacing", 12) | 244 | self.vbox.set_property("spacing", 12) |
244 | self.action_area.set_property("spacing", 12) | 245 | self.action_area.set_property("spacing", 12) |
245 | self.action_area.set_property("border-width", 6) | 246 | self.action_area.set_property("border-width", 6) |
246 | 247 | ||
247 | first_row = gtk.HBox(spacing=12) | 248 | first_column = gtk.HBox(spacing=12) |
248 | first_row.set_property("border-width", 6) | 249 | first_column.set_property("border-width", 6) |
249 | first_row.show() | 250 | first_column.show() |
250 | self.vbox.add(first_row) | 251 | self.vbox.add(first_column) |
251 | 252 | ||
252 | self.icon = gtk.Image() | 253 | self.icon = gtk.Image() |
253 | # We have our own Info icon which should be used in preference of the stock icon | 254 | # We have our own Info icon which should be used in preference of the stock icon |
@@ -255,15 +256,43 @@ class CrumbsMessageDialog(CrumbsDialog): | |||
255 | self.icon.set_from_stock(self.icon_chk.check_stock_icon(icon), gtk.ICON_SIZE_DIALOG) | 256 | self.icon.set_from_stock(self.icon_chk.check_stock_icon(icon), gtk.ICON_SIZE_DIALOG) |
256 | self.icon.set_property("yalign", 0.00) | 257 | self.icon.set_property("yalign", 0.00) |
257 | self.icon.show() | 258 | self.icon.show() |
258 | first_row.add(self.icon) | 259 | first_column.pack_start(self.icon, expand=False, fill=True, padding=0) |
259 | 260 | ||
260 | self.label = gtk.Label() | 261 | if 0 <= len(msg) < 200: |
261 | self.label.set_use_markup(True) | 262 | lbl = label + "%s" % glib.markup_escape_text(msg) |
262 | self.label.set_line_wrap(True) | 263 | self.label_short = gtk.Label() |
263 | self.label.set_markup(label) | 264 | self.label_short.set_use_markup(True) |
264 | self.label.set_property("yalign", 0.00) | 265 | self.label_short.set_line_wrap(True) |
265 | self.label.show() | 266 | self.label_short.set_markup(lbl) |
266 | first_row.add(self.label) | 267 | self.label_short.set_property("yalign", 0.00) |
268 | self.label_short.show() | ||
269 | first_column.add(self.label_short) | ||
270 | else: | ||
271 | second_row = gtk.VBox(spacing=12) | ||
272 | second_row.set_property("border-width", 6) | ||
273 | self.label_long = gtk.Label() | ||
274 | self.label_long.set_use_markup(True) | ||
275 | self.label_long.set_line_wrap(True) | ||
276 | self.label_long.set_markup(label) | ||
277 | self.label_long.set_alignment(0.0, 0.0) | ||
278 | second_row.pack_start(self.label_long, expand=False, fill=False, padding=0) | ||
279 | self.label_long.show() | ||
280 | self.textWindow = gtk.ScrolledWindow() | ||
281 | self.textWindow.set_shadow_type(gtk.SHADOW_IN) | ||
282 | self.msgView = gtk.TextView() | ||
283 | self.msgView.set_editable(False) | ||
284 | self.msgView.set_wrap_mode(gtk.WRAP_WORD) | ||
285 | self.msgView.set_cursor_visible(False) | ||
286 | self.msgView.set_size_request(300, 300) | ||
287 | self.buf = gtk.TextBuffer() | ||
288 | self.buf.set_text(msg) | ||
289 | self.msgView.set_buffer(self.buf) | ||
290 | self.textWindow.add(self.msgView) | ||
291 | self.msgView.show() | ||
292 | second_row.add(self.textWindow) | ||
293 | self.textWindow.show() | ||
294 | first_column.add(second_row) | ||
295 | second_row.show() | ||
267 | 296 | ||
268 | # | 297 | # |
269 | # SimpleSettings Dialog | 298 | # SimpleSettings Dialog |