summaryrefslogtreecommitdiffstats
path: root/bitbake/lib/bb/ui/crumbs/hobwidget.py
diff options
context:
space:
mode:
Diffstat (limited to 'bitbake/lib/bb/ui/crumbs/hobwidget.py')
-rw-r--r--bitbake/lib/bb/ui/crumbs/hobwidget.py75
1 files changed, 57 insertions, 18 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/hobwidget.py b/bitbake/lib/bb/ui/crumbs/hobwidget.py
index 9a00e941e9..17d9cee138 100644
--- a/bitbake/lib/bb/ui/crumbs/hobwidget.py
+++ b/bitbake/lib/bb/ui/crumbs/hobwidget.py
@@ -88,12 +88,12 @@ class HobViewTable (gtk.VBox):
88 self.table_tree = gtk.TreeView() 88 self.table_tree = gtk.TreeView()
89 self.table_tree.set_headers_visible(True) 89 self.table_tree.set_headers_visible(True)
90 self.table_tree.set_headers_clickable(True) 90 self.table_tree.set_headers_clickable(True)
91 self.table_tree.set_enable_search(True)
92 self.table_tree.set_rules_hint(True) 91 self.table_tree.set_rules_hint(True)
93 self.table_tree.set_enable_tree_lines(True) 92 self.table_tree.set_enable_tree_lines(True)
94 self.table_tree.get_selection().set_mode(gtk.SELECTION_SINGLE) 93 self.table_tree.get_selection().set_mode(gtk.SELECTION_SINGLE)
95 self.toggle_columns = [] 94 self.toggle_columns = []
96 self.table_tree.connect("row-activated", self.row_activated_cb) 95 self.table_tree.connect("row-activated", self.row_activated_cb)
96 self.top_bar = None
97 97
98 for i, column in enumerate(columns): 98 for i, column in enumerate(columns):
99 col = gtk.TreeViewColumn(column['col_name']) 99 col = gtk.TreeViewColumn(column['col_name'])
@@ -141,10 +141,41 @@ class HobViewTable (gtk.VBox):
141 if 'col_t_id' in column.keys(): 141 if 'col_t_id' in column.keys():
142 col.add_attribute(cell, 'font', column['col_t_id']) 142 col.add_attribute(cell, 'font', column['col_t_id'])
143 143
144 scroll = gtk.ScrolledWindow() 144 self.scroll = gtk.ScrolledWindow()
145 scroll.set_policy(gtk.POLICY_NEVER, gtk.POLICY_ALWAYS) 145 self.scroll.set_policy(gtk.POLICY_NEVER, gtk.POLICY_ALWAYS)
146 scroll.add(self.table_tree) 146 self.scroll.add(self.table_tree)
147 self.pack_start(scroll, True, True, 0) 147
148 self.pack_end(self.scroll, True, True, 0)
149
150 def add_no_result_bar(self, entry):
151 color = HobColors.KHAKI
152 self.top_bar = gtk.EventBox()
153 self.top_bar.set_size_request(-1, 70)
154 self.top_bar.modify_bg(gtk.STATE_NORMAL, gtk.gdk.color_parse(color))
155 self.top_bar.set_flags(gtk.CAN_DEFAULT)
156 self.top_bar.grab_default()
157
158 no_result_tab = gtk.Table(5, 20, True)
159 self.top_bar.add(no_result_tab)
160
161 label = gtk.Label()
162 label.set_alignment(0.0, 0.5)
163 title = "No results matching your search"
164 label.set_markup("<span size='x-large'><b>%s</b></span>" % title)
165 no_result_tab.attach(label, 1, 14, 1, 4)
166
167 clear_button = HobButton("Clear search")
168 clear_button.connect('clicked', self.set_search_entry_clear_cb, entry)
169 no_result_tab.attach(clear_button, 16, 19, 1, 4)
170
171 self.pack_start(self.top_bar, False, True, 12)
172 self.top_bar.show_all()
173
174 def set_search_entry_clear_cb(self, button, search):
175 if search.get_editable() == True:
176 search.set_text("")
177 search.set_icon_sensitive(gtk.ENTRY_ICON_SECONDARY, False)
178 search.grab_focus()
148 179
149 def display_binb_cb(self, col, cell, model, it, col_id): 180 def display_binb_cb(self, col, cell, model, it, col_id):
150 binb = model.get_value(it, col_id) 181 binb = model.get_value(it, col_id)
@@ -170,10 +201,6 @@ class HobViewTable (gtk.VBox):
170 def set_model(self, tree_model): 201 def set_model(self, tree_model):
171 self.table_tree.set_model(tree_model) 202 self.table_tree.set_model(tree_model)
172 203
173 def set_search_entry(self, search_column_id, entry):
174 self.table_tree.set_search_column(search_column_id)
175 self.table_tree.set_search_entry(entry)
176
177 def toggle_default(self): 204 def toggle_default(self):
178 model = self.table_tree.get_model() 205 model = self.table_tree.get_model()
179 if not model: 206 if not model:
@@ -453,7 +480,6 @@ class HobNotebook(gtk.Notebook):
453 self.pages = [] 480 self.pages = []
454 481
455 self.search = None 482 self.search = None
456 self.search_name = ""
457 483
458 self.connect("switch-page", self.page_changed_cb) 484 self.connect("switch-page", self.page_changed_cb)
459 485
@@ -466,6 +492,9 @@ class HobNotebook(gtk.Notebook):
466 else: 492 else:
467 lbl.set_active(False) 493 lbl.set_active(False)
468 494
495 if self.search:
496 self.reset_entry(self.search, page_num)
497
469 def append_page(self, child, tab_label, tab_tooltip=None): 498 def append_page(self, child, tab_label, tab_tooltip=None):
470 label = HobTabLabel(tab_label) 499 label = HobTabLabel(tab_label)
471 if tab_tooltip: 500 if tab_tooltip:
@@ -474,16 +503,22 @@ class HobNotebook(gtk.Notebook):
474 self.pages.append(label) 503 self.pages.append(label)
475 gtk.Notebook.append_page(self, child, label) 504 gtk.Notebook.append_page(self, child, label)
476 505
477 def set_entry(self, name="Search:"): 506 def set_entry(self, names, tips):
478 self.search = gtk.Entry() 507 self.search = gtk.Entry()
479 self.search_name = name 508 self.search_names = names
509 self.search_tips = tips
480 style = self.search.get_style() 510 style = self.search.get_style()
481 style.text[gtk.STATE_NORMAL] = self.get_colormap().alloc_color(HobColors.GRAY, False, False) 511 style.text[gtk.STATE_NORMAL] = self.get_colormap().alloc_color(HobColors.GRAY, False, False)
482 self.search.set_style(style) 512 self.search.set_style(style)
483 self.search.set_text(name) 513 self.search.set_text(names[0])
514 self.search.set_tooltip_text(self.search_tips[0])
515 self.search.props.has_tooltip = True
516
484 self.search.set_editable(False) 517 self.search.set_editable(False)
485 self.search.set_icon_from_stock(gtk.ENTRY_ICON_SECONDARY, gtk.STOCK_CLEAR) 518 self.search.set_icon_from_stock(gtk.ENTRY_ICON_SECONDARY, gtk.STOCK_CLEAR)
519 self.search.set_icon_sensitive(gtk.ENTRY_ICON_SECONDARY, False)
486 self.search.connect("icon-release", self.set_search_entry_clear_cb) 520 self.search.connect("icon-release", self.set_search_entry_clear_cb)
521 self.search.set_width_chars(30)
487 self.search.show() 522 self.search.show()
488 523
489 self.search.connect("focus-in-event", self.set_search_entry_editable_cb) 524 self.search.connect("focus-in-event", self.set_search_entry_editable_cb)
@@ -507,19 +542,23 @@ class HobNotebook(gtk.Notebook):
507 style.text[gtk.STATE_NORMAL] = self.get_colormap().alloc_color(HobColors.BLACK, False, False) 542 style.text[gtk.STATE_NORMAL] = self.get_colormap().alloc_color(HobColors.BLACK, False, False)
508 search.set_style(style) 543 search.set_style(style)
509 544
510 def reset_entry(self, entry): 545 def set_search_entry_reset_cb(self, search, event):
546 page_num = self.get_current_page()
547 self.reset_entry(search, page_num)
548
549 def reset_entry(self, entry, page_num):
511 style = entry.get_style() 550 style = entry.get_style()
512 style.text[gtk.STATE_NORMAL] = self.get_colormap().alloc_color(HobColors.GRAY, False, False) 551 style.text[gtk.STATE_NORMAL] = self.get_colormap().alloc_color(HobColors.GRAY, False, False)
513 entry.set_style(style) 552 entry.set_style(style)
514 entry.set_text(self.search_name) 553 entry.set_text(self.search_names[page_num])
554 entry.set_tooltip_text(self.search_tips[page_num])
515 entry.set_editable(False) 555 entry.set_editable(False)
516 556 entry.set_icon_sensitive(gtk.ENTRY_ICON_SECONDARY, False)
517 def set_search_entry_reset_cb(self, search, event):
518 self.reset_entry(search)
519 557
520 def set_search_entry_clear_cb(self, search, icon_pos, event): 558 def set_search_entry_clear_cb(self, search, icon_pos, event):
521 if search.get_editable() == True: 559 if search.get_editable() == True:
522 search.set_text("") 560 search.set_text("")
561 search.set_icon_sensitive(gtk.ENTRY_ICON_SECONDARY, False)
523 562
524 def set_page(self, title): 563 def set_page(self, title):
525 for child in self.pages: 564 for child in self.pages: