summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLiming An <limingx.l.an@intel.com>2012-05-08 19:48:06 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-05-09 21:55:42 +0100
commit02cc701869bceb2d0e11fe3cf51fb0582cda01b0 (patch)
tree2ae2b62282dfc9df911c09805eb675c9d09839ff
parentac4a8885fafdc0d1e79831334ead9a8ddb6e2472 (diff)
downloadbitbake-02cc701869bceb2d0e11fe3cf51fb0582cda01b0.tar.gz
Hob: add original url show function with the tooltip hyperlink for user
When case about No browser, such as running in 'Build Appliance', user can't open the hyper link, so add this work around for user. (Checking the browser is avaiable or not is hard by different system and browser type) [YOCTO #2340] Signed-off-by: Liming An <limingx.l.an@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r--lib/bb/ui/crumbs/persistenttooltip.py19
1 files changed, 19 insertions, 0 deletions
diff --git a/lib/bb/ui/crumbs/persistenttooltip.py b/lib/bb/ui/crumbs/persistenttooltip.py
index b43d297bf..927c19429 100644
--- a/lib/bb/ui/crumbs/persistenttooltip.py
+++ b/lib/bb/ui/crumbs/persistenttooltip.py
@@ -125,11 +125,17 @@ class PersistentTooltip(gtk.Window):
style.fg[gtk.STATE_NORMAL] = gtk.gdk.color_parse(val)
self.label.set_style(style)
break # we only care for the tooltip_fg_color
+
self.label.set_markup(markup)
self.label.show()
bin.add(self.label)
hbox.pack_end(bin, True, True, 6)
+ # add the original URL display for user reference
+ if 'a href' in markup:
+ hbox.set_tooltip_text(self.get_markup_url(markup))
+ hbox.show()
+
self.connect("key-press-event", self._catch_esc_cb)
"""
@@ -165,3 +171,16 @@ class PersistentTooltip(gtk.Window):
def hide(self):
self.shown = False
gtk.Window.hide(self)
+
+ """
+ Called to get the hyperlink URL from markup text.
+ """
+ def get_markup_url(self, markup):
+ url = "http:"
+ if markup and type(markup) == str:
+ s = markup
+ if 'http:' in s:
+ import re
+ url = re.search('(http:[^,\\ "]+)', s).group(0)
+
+ return url