summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorShane Wang <shane.wang@intel.com>2012-06-02 12:54:38 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-06-08 12:13:15 +0100
commitc0b92702d367466641f88371fbcbc0fdebdbbb96 (patch)
tree88ec17b35d440500ba3203123b8e9b2c3a48c619
parent25785d8ddfccfc12af0c677cb519f133be158d1f (diff)
downloadpoky-c0b92702d367466641f88371fbcbc0fdebdbbb96.tar.gz
Hob: Interpret some special characters for label markup
Interpret some special characters for label markup, such as &, <, >, etc. Otherwise, the message dialog can't show them, and worsely, it makes the whole message blank. [Yocto #2492] (Bitbake rev: fb82f6eb5405274f702bd6d64cbe995fd4b74145) Signed-off-by: Shane Wang <shane.wang@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rwxr-xr-xbitbake/lib/bb/ui/crumbs/builder.py13
1 files changed, 11 insertions, 2 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/builder.py b/bitbake/lib/bb/ui/crumbs/builder.py
index bcce41dbb6..7861a6fbaf 100755
--- a/bitbake/lib/bb/ui/crumbs/builder.py
+++ b/bitbake/lib/bb/ui/crumbs/builder.py
@@ -374,6 +374,15 @@ class Builder(gtk.Window):
374 END_NOOP : None, 374 END_NOOP : None,
375 } 375 }
376 376
377 @classmethod
378 def interpret_markup(cls, msg):
379 msg = msg.replace('&', '&amp;')
380 msg = msg.replace('<', '&lt;')
381 msg = msg.replace('>', '&gt;')
382 msg = msg.replace('"', '&quot;')
383 msg = msg.replace("'", "&acute;")
384 return msg
385
377 def __init__(self, hobHandler, recipe_model, package_model): 386 def __init__(self, hobHandler, recipe_model, package_model):
378 super(Builder, self).__init__() 387 super(Builder, self).__init__()
379 388
@@ -729,7 +738,7 @@ class Builder(gtk.Window):
729 738
730 def show_error_dialog(self, msg): 739 def show_error_dialog(self, msg):
731 lbl = "<b>Error</b>\n" 740 lbl = "<b>Error</b>\n"
732 lbl = lbl + "%s\n\n" % msg 741 lbl = lbl + "%s\n\n" % Builder.interpret_markup(msg)
733 dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_ERROR) 742 dialog = CrumbsMessageDialog(self, lbl, gtk.STOCK_DIALOG_ERROR)
734 button = dialog.add_button("Close", gtk.RESPONSE_OK) 743 button = dialog.add_button("Close", gtk.RESPONSE_OK)
735 HobButton.style_button(button) 744 HobButton.style_button(button)
@@ -909,7 +918,7 @@ class Builder(gtk.Window):
909 self.build_failed() 918 self.build_failed()
910 919
911 def handler_no_provider_cb(self, running_build, msg): 920 def handler_no_provider_cb(self, running_build, msg):
912 dialog = CrumbsMessageDialog(self, msg, gtk.STOCK_DIALOG_INFO) 921 dialog = CrumbsMessageDialog(self, Builder.interpret_markup(msg), gtk.STOCK_DIALOG_INFO)
913 button = dialog.add_button("Close", gtk.RESPONSE_OK) 922 button = dialog.add_button("Close", gtk.RESPONSE_OK)
914 HobButton.style_button(button) 923 HobButton.style_button(button)
915 dialog.run() 924 dialog.run()