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>
This commit is contained in:
parent
e1d463eb39
commit
4495a73abc
|
@ -425,6 +425,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):
|
||||
|
@ -488,7 +489,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
|
||||
|
||||
|
@ -513,8 +514,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
|
||||
|
@ -683,6 +687,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):
|
||||
|
@ -767,13 +783,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:
|
||||
|
|
|
@ -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' : [{
|
||||
|
@ -66,6 +67,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',
|
||||
|
@ -97,6 +99,7 @@ class RecipeSelectionPage (HobPage):
|
|||
}]
|
||||
}, {
|
||||
'name' : 'Tasks',
|
||||
'tooltip' : 'All tasks availabel in the Yocto Project',
|
||||
'filter' : { RecipeListModel.COL_TYPE : ['task'] },
|
||||
'columns' : [{
|
||||
'col_name' : 'Task name',
|
||||
|
@ -151,12 +154,17 @@ class RecipeSelectionPage (HobPage):
|
|||
tab.connect("button-release-event", self.button_click_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
|
||||
|
|
Loading…
Reference in New Issue