]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/commitdiff
Hob: Add the tooltips for recipe view page as request
authorLiming An <limingx.l.an@intel.com>
Mon, 9 Apr 2012 14:13:34 +0000 (22:13 +0800)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Tue, 10 Apr 2012 23:02:21 +0000 (00:02 +0100)
[YOCTO #2229]

Signed-off-by: Liming An <limingx.l.an@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
lib/bb/ui/crumbs/hobwidget.py
lib/bb/ui/crumbs/recipeselectionpage.py

index 8c8bf9bc7773f60aa993ff9fcff8944308c8431c..a42cdecf2d86452c144fd4f82f59607299829693 100644 (file)
@@ -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:
index 46f86e6cdd5d2e95467ad4ad24435d943f8314ab..6ecc7965d02f5ec009204b2e9b75325036e3da66 100755 (executable)
@@ -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