summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/ui/crumbs/hobwidget.py
diff options
context:
space:
mode:
authorLiming An <limingx.l.an@intel.com>2012-04-09 22:13:34 +0800
committerRichard Purdie <richard.purdie@linuxfoundation.org>2012-04-11 00:04:44 +0100
commit4495a73abc5ad30bd973691b4b3ed0988468377a (patch)
tree78b951212542de6701ec4e39cf477d71d4c74653 /bitbake/lib/bb/ui/crumbs/hobwidget.py
parente1d463eb3931014427a1d108944eaa55f21880c0 (diff)
downloadpoky-4495a73abc5ad30bd973691b4b3ed0988468377a.tar.gz
Hob: Add the tooltips for recipe view page as request
[YOCTO #2229] (Bitbake rev: 37c969164a6ef9adcaa743a3909102b005a55163) Signed-off-by: Liming An <limingx.l.an@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'bitbake/lib/bb/ui/crumbs/hobwidget.py')
-rw-r--r--bitbake/lib/bb/ui/crumbs/hobwidget.py22
1 files changed, 20 insertions, 2 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/hobwidget.py b/bitbake/lib/bb/ui/crumbs/hobwidget.py
index 8c8bf9bc77..a42cdecf2d 100644
--- a/bitbake/lib/bb/ui/crumbs/hobwidget.py
+++ b/bitbake/lib/bb/ui/crumbs/hobwidget.py
@@ -425,6 +425,7 @@ class HobTabBar(gtk.DrawingArea):
425 self.connect("expose-event", self.on_draw) 425 self.connect("expose-event", self.on_draw)
426 self.connect("button-press-event", self.button_pressed_cb) 426 self.connect("button-press-event", self.button_pressed_cb)
427 self.connect("button-release-event", self.button_released_cb) 427 self.connect("button-release-event", self.button_released_cb)
428 self.connect("query-tooltip", self.query_tooltip_cb)
428 self.show_all() 429 self.show_all()
429 430
430 def button_released_cb(self, widget, event): 431 def button_released_cb(self, widget, event):
@@ -488,7 +489,7 @@ class HobTabBar(gtk.DrawingArea):
488 child["g"] = color.green 489 child["g"] = color.green
489 child["b"] = color.blue 490 child["b"] = color.blue
490 491
491 def append_tab_child(self, title, page): 492 def append_tab_child(self, title, page, tooltip=""):
492 num = len(self.children) + 1 493 num = len(self.children) + 1
493 self.tab_width = self.tab_width * len(self.children) / num 494 self.tab_width = self.tab_width * len(self.children) / num
494 495
@@ -513,8 +514,11 @@ class HobTabBar(gtk.DrawingArea):
513 "title" : title, 514 "title" : title,
514 "indicator_show" : False, 515 "indicator_show" : False,
515 "indicator_number" : 0, 516 "indicator_number" : 0,
517 "tooltip_markup" : tooltip,
516 } 518 }
517 self.children.append(new_one) 519 self.children.append(new_one)
520 if tooltip and (not self.props.has_tooltip):
521 self.props.has_tooltip = True
518 # set the default current child 522 # set the default current child
519 if not self.current_child: 523 if not self.current_child:
520 self.current_child = new_one 524 self.current_child = new_one
@@ -683,6 +687,18 @@ class HobTabBar(gtk.DrawingArea):
683 687
684 return gtk.gdk.Rectangle(x, y, w, h) 688 return gtk.gdk.Rectangle(x, y, w, h)
685 689
690 def query_tooltip_cb(self, widget, x, y, keyboardtip, tooltip):
691 if keyboardtip or (not tooltip):
692 return False
693 # check which tab be clicked
694 for child in self.children:
695 if (child["x"] < x) and (x < child["x"] + self.tab_width) \
696 and (child["y"] < y) and (y < child["y"] + self.tab_height):
697 tooltip.set_markup(child["tooltip_markup"])
698 return True
699
700 return False
701
686class HobNotebook(gtk.VBox): 702class HobNotebook(gtk.VBox):
687 703
688 def __init__(self): 704 def __init__(self):
@@ -767,13 +783,15 @@ class HobNotebook(gtk.VBox):
767 if not notebook: 783 if not notebook:
768 return 784 return
769 title = notebook.get_tab_label_text(notebook_child) 785 title = notebook.get_tab_label_text(notebook_child)
786 label = notebook.get_tab_label(notebook_child)
787 tooltip_markup = label.get_tooltip_markup()
770 if not title: 788 if not title:
771 return 789 return
772 for child in self.tabbar.children: 790 for child in self.tabbar.children:
773 if child["title"] == title: 791 if child["title"] == title:
774 child["toggled_page"] = page 792 child["toggled_page"] = page
775 return 793 return
776 self.tabbar.append_tab_child(title, page) 794 self.tabbar.append_tab_child(title, page, tooltip_markup)
777 795
778 def page_removed_cb(self, notebook, notebook_child, page, title=""): 796 def page_removed_cb(self, notebook, notebook_child, page, title=""):
779 for child in self.tabbar.children: 797 for child in self.tabbar.children: