[bitbake-devel] [PATCH 04/20] Hob: Add the tooltips for recipe view page as request
Shane Wang
shane.wang at intel.com
Sun Apr 8 10:21:07 UTC 2012
From: Liming An <limingx.l.an at intel.com>
[YOCTO #2229]
Signed-off-by: Liming An <limingx.l.an at intel.com>
---
bitbake/lib/bb/ui/crumbs/hobwidget.py | 22 ++++++++++++++++++++--
bitbake/lib/bb/ui/crumbs/recipeselectionpage.py | 8 ++++++++
2 files changed, 28 insertions(+), 2 deletions(-)
diff --git a/bitbake/lib/bb/ui/crumbs/hobwidget.py b/bitbake/lib/bb/ui/crumbs/hobwidget.py
index 21836f7..b79edce 100644
--- a/bitbake/lib/bb/ui/crumbs/hobwidget.py
+++ b/bitbake/lib/bb/ui/crumbs/hobwidget.py
@@ -410,6 +410,7 @@ class HobTabBar(gtk.DrawingArea):
self.connect("expose-event", self.on_draw)
self.connect("button-press-event", self.button_pressed_cb)
self.connect("button-release-event", self.button_released_cb)
+ self.connect("query-tooltip", self.query_tooltip_cb)
self.show_all()
def button_released_cb(self, widget, event):
@@ -473,7 +474,7 @@ class HobTabBar(gtk.DrawingArea):
child["g"] = color.green
child["b"] = color.blue
- def append_tab_child(self, title, page):
+ def append_tab_child(self, title, page, tooltip=""):
num = len(self.children) + 1
self.tab_width = self.tab_width * len(self.children) / num
@@ -498,8 +499,11 @@ class HobTabBar(gtk.DrawingArea):
"title" : title,
"indicator_show" : False,
"indicator_number" : 0,
+ "tooltip_markup" : tooltip,
}
self.children.append(new_one)
+ if tooltip and (not self.props.has_tooltip):
+ self.props.has_tooltip = True
# set the default current child
if not self.current_child:
self.current_child = new_one
@@ -668,6 +672,18 @@ class HobTabBar(gtk.DrawingArea):
return gtk.gdk.Rectangle(x, y, w, h)
+ def query_tooltip_cb(self, widget, x, y, keyboardtip, tooltip):
+ if keyboardtip or (not tooltip):
+ return False
+ # check which tab be clicked
+ for child in self.children:
+ if (child["x"] < x) and (x < child["x"] + self.tab_width) \
+ and (child["y"] < y) and (y < child["y"] + self.tab_height):
+ tooltip.set_markup(child["tooltip_markup"])
+ return True
+
+ return False
+
class HobNotebook(gtk.VBox):
def __init__(self):
@@ -752,13 +768,15 @@ class HobNotebook(gtk.VBox):
if not notebook:
return
title = notebook.get_tab_label_text(notebook_child)
+ label = notebook.get_tab_label(notebook_child)
+ tooltip_markup = label.get_tooltip_markup()
if not title:
return
for child in self.tabbar.children:
if child["title"] == title:
child["toggled_page"] = page
return
- self.tabbar.append_tab_child(title, page)
+ self.tabbar.append_tab_child(title, page, tooltip_markup)
def page_removed_cb(self, notebook, notebook_child, page, title=""):
for child in self.tabbar.children:
diff --git a/bitbake/lib/bb/ui/crumbs/recipeselectionpage.py b/bitbake/lib/bb/ui/crumbs/recipeselectionpage.py
index a2f7982..ea32fb0 100755
--- a/bitbake/lib/bb/ui/crumbs/recipeselectionpage.py
+++ b/bitbake/lib/bb/ui/crumbs/recipeselectionpage.py
@@ -34,6 +34,7 @@ class RecipeSelectionPage (HobPage):
pages = [
{
'name' : 'Included',
+ 'tooltip' : 'The recipes currently included for your image',
'filter' : { RecipeListModel.COL_INC : [True],
RecipeListModel.COL_TYPE : ['recipe', 'task'] },
'columns' : [{
@@ -57,6 +58,7 @@ class RecipeSelectionPage (HobPage):
}]
}, {
'name' : 'All recipes',
+ 'tooltip' : 'All recipes available in the Yocto Project',
'filter' : { RecipeListModel.COL_TYPE : ['recipe'] },
'columns' : [{
'col_name' : 'Recipe name',
@@ -85,6 +87,7 @@ class RecipeSelectionPage (HobPage):
}]
}, {
'name' : 'Tasks',
+ 'tooltip' : 'All tasks availabel in the Yocto Project',
'filter' : { RecipeListModel.COL_TYPE : ['task'] },
'columns' : [{
'col_name' : 'Task name',
@@ -137,12 +140,17 @@ class RecipeSelectionPage (HobPage):
tab.connect("row-activated", self.tree_row_activated_cb)
tab.connect("cell-fadeinout-stopped", self.after_fadeout_checkin_include)
label = gtk.Label(page['name'])
+ label.set_selectable(False)
+ label.set_tooltip_text(page['tooltip'])
self.ins.append_page(tab, label)
self.tables.append(tab)
self.ins.set_entry("Search recipes:")
# set the search entry for each table
for tab in self.tables:
+ search_tip = "Enter a recipe's or task's name to find it"
+ self.ins.search.set_tooltip_text(search_tip)
+ self.ins.search.props.has_tooltip = True
tab.set_search_entry(0, self.ins.search)
# add all into the window
--
1.7.6
More information about the bitbake-devel
mailing list