summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--bitbake/lib/bb/ui/crumbs/hig/imageselectiondialog.py2
-rw-r--r--bitbake/lib/bb/ui/crumbs/hoblistmodel.py107
-rw-r--r--bitbake/lib/bb/ui/crumbs/hobwidget.py16
-rwxr-xr-xbitbake/lib/bb/ui/crumbs/packageselectionpage.py11
-rwxr-xr-xbitbake/lib/bb/ui/crumbs/recipeselectionpage.py14
5 files changed, 116 insertions, 34 deletions
diff --git a/bitbake/lib/bb/ui/crumbs/hig/imageselectiondialog.py b/bitbake/lib/bb/ui/crumbs/hig/imageselectiondialog.py
index 17f6bffe00..21216adc97 100644
--- a/bitbake/lib/bb/ui/crumbs/hig/imageselectiondialog.py
+++ b/bitbake/lib/bb/ui/crumbs/hig/imageselectiondialog.py
@@ -84,7 +84,7 @@ class ImageSelectionDialog (CrumbsDialog):
84 open_button.connect("clicked", self.select_path_cb, self, entry) 84 open_button.connect("clicked", self.select_path_cb, self, entry)
85 table.attach(open_button, 9, 10, 0, 1) 85 table.attach(open_button, 9, 10, 0, 1)
86 86
87 self.image_table = HobViewTable(self.__columns__) 87 self.image_table = HobViewTable(self.__columns__, "Images")
88 self.image_table.set_size_request(-1, 300) 88 self.image_table.set_size_request(-1, 300)
89 self.image_table.connect("toggled", self.toggled_cb) 89 self.image_table.connect("toggled", self.toggled_cb)
90 self.image_table.connect_group_selection(self.table_selected_cb) 90 self.image_table.connect_group_selection(self.table_selected_cb)
diff --git a/bitbake/lib/bb/ui/crumbs/hoblistmodel.py b/bitbake/lib/bb/ui/crumbs/hoblistmodel.py
index 0bd9734f48..547c1cade9 100644
--- a/bitbake/lib/bb/ui/crumbs/hoblistmodel.py
+++ b/bitbake/lib/bb/ui/crumbs/hoblistmodel.py
@@ -103,25 +103,55 @@ class PackageListModel(gtk.ListStore):
103 Create, if required, and return a filtered gtk.TreeModelSort 103 Create, if required, and return a filtered gtk.TreeModelSort
104 containing only the items specified by filter 104 containing only the items specified by filter
105 """ 105 """
106 def tree_model(self, filter, excluded_items_ahead=False, included_items_ahead=True, search_data=None): 106 def tree_model(self, filter, excluded_items_ahead=False, included_items_ahead=False, search_data=None, initial=False):
107 model = self.filter_new() 107 model = self.filter_new()
108 self.filtered_nb = 0 108 self.filtered_nb = 0
109 model.set_visible_func(self.tree_model_filter, filter) 109 model.set_visible_func(self.tree_model_filter, filter)
110 110
111 sort = gtk.TreeModelSort(model) 111 sort = gtk.TreeModelSort(model)
112 if initial:
113 sort.set_sort_column_id(PackageListModel.COL_NAME, gtk.SORT_ASCENDING)
114 sort.set_default_sort_func(None)
115
112 if excluded_items_ahead: 116 if excluded_items_ahead:
113 sort.set_default_sort_func(self.exclude_item_sort_func, search_data) 117 sort.set_default_sort_func(self.exclude_item_sort_func, search_data)
114 elif included_items_ahead: 118 elif included_items_ahead:
115 sort.set_default_sort_func(self.include_item_sort_func, search_data) 119 sort.set_default_sort_func(self.include_item_sort_func, search_data)
116 else: 120 else:
117 sort.set_sort_column_id(RecipeListModel.COL_NAME, gtk.SORT_ASCENDING) 121 if search_data and search_data!='Search recipes by name' and search_data!='Search package groups by name':
118 sort.set_default_sort_func(None) 122 sort.set_default_sort_func(self.sort_func, search_data)
123 else:
124 sort.set_sort_column_id(PackageListModel.COL_NAME, gtk.SORT_ASCENDING)
125 sort.set_default_sort_func(None)
126
127 sort.set_sort_func(PackageListModel.COL_INC, self.sort_column, PackageListModel.COL_INC)
128 sort.set_sort_func(PackageListModel.COL_SIZE, self.sort_column, PackageListModel.COL_SIZE)
129 sort.set_sort_func(PackageListModel.COL_BINB, self.sort_column, PackageListModel.COL_BINB)
130 sort.set_sort_func(PackageListModel.COL_RCP, self.sort_column, PackageListModel.COL_RCP)
119 return sort 131 return sort
120 132
133 def sort_column(self, model, row1, row2, col):
134 value1 = model.get_value(row1, col)
135 value2 = model.get_value(row2, col)
136 if col==PackageListModel.COL_SIZE:
137 value1 = HobPage._string_to_size(value1)
138 value2 = HobPage._string_to_size(value2)
139
140 cmp_res = cmp(value1, value2)
141 if cmp_res!=0:
142 if col==PackageListModel.COL_INC:
143 return -cmp_res
144 else:
145 return cmp_res
146 else:
147 name1 = model.get_value(row1, PackageListModel.COL_NAME)
148 name2 = model.get_value(row2, PackageListModel.COL_NAME)
149 return cmp(name1,name2)
150
121 def exclude_item_sort_func(self, model, iter1, iter2, user_data=None): 151 def exclude_item_sort_func(self, model, iter1, iter2, user_data=None):
122 if user_data: 152 if user_data:
123 val1 = model.get_value(iter1, RecipeListModel.COL_NAME) 153 val1 = model.get_value(iter1, PackageListModel.COL_NAME)
124 val2 = model.get_value(iter2, RecipeListModel.COL_NAME) 154 val2 = model.get_value(iter2, PackageListModel.COL_NAME)
125 if val1.startswith(user_data) and not val2.startswith(user_data): 155 if val1.startswith(user_data) and not val2.startswith(user_data):
126 return -1 156 return -1
127 elif not val1.startswith(user_data) and val2.startswith(user_data): 157 elif not val1.startswith(user_data) and val2.startswith(user_data):
@@ -129,14 +159,14 @@ class PackageListModel(gtk.ListStore):
129 else: 159 else:
130 return 0 160 return 0
131 else: 161 else:
132 val1 = model.get_value(iter1, RecipeListModel.COL_FADE_INC) 162 val1 = model.get_value(iter1, PackageListModel.COL_FADE_INC)
133 val2 = model.get_value(iter2, RecipeListModel.COL_INC) 163 val2 = model.get_value(iter2, PackageListModel.COL_INC)
134 return ((val1 == True) and (val2 == False)) 164 return ((val1 == True) and (val2 == False))
135 165
136 def include_item_sort_func(self, model, iter1, iter2, user_data=None): 166 def include_item_sort_func(self, model, iter1, iter2, user_data=None):
137 if user_data: 167 if user_data:
138 val1 = model.get_value(iter1, RecipeListModel.COL_NAME) 168 val1 = model.get_value(iter1, PackageListModel.COL_NAME)
139 val2 = model.get_value(iter2, RecipeListModel.COL_NAME) 169 val2 = model.get_value(iter2, PackageListModel.COL_NAME)
140 if val1.startswith(user_data) and not val2.startswith(user_data): 170 if val1.startswith(user_data) and not val2.startswith(user_data):
141 return -1 171 return -1
142 elif not val1.startswith(user_data) and val2.startswith(user_data): 172 elif not val1.startswith(user_data) and val2.startswith(user_data):
@@ -144,10 +174,20 @@ class PackageListModel(gtk.ListStore):
144 else: 174 else:
145 return 0 175 return 0
146 else: 176 else:
147 val1 = model.get_value(iter1, RecipeListModel.COL_INC) 177 val1 = model.get_value(iter1, PackageListModel.COL_INC)
148 val2 = model.get_value(iter2, RecipeListModel.COL_INC) 178 val2 = model.get_value(iter2, PackageListModel.COL_INC)
149 return ((val1 == False) and (val2 == True)) 179 return ((val1 == False) and (val2 == True))
150 180
181 def sort_func(self, model, iter1, iter2, user_data):
182 val1 = model.get_value(iter1, PackageListModel.COL_NAME)
183 val2 = model.get_value(iter2, PackageListModel.COL_NAME)
184 if val1.startswith(user_data) and not val2.startswith(user_data):
185 return -1
186 elif not val1.startswith(user_data) and val2.startswith(user_data):
187 return 1
188 else:
189 return 0
190
151 def convert_vpath_to_path(self, view_model, view_path): 191 def convert_vpath_to_path(self, view_model, view_path):
152 # view_model is the model sorted 192 # view_model is the model sorted
153 # get the path of the model filtered 193 # get the path of the model filtered
@@ -162,7 +202,7 @@ class PackageListModel(gtk.ListStore):
162 it = view_model.get_iter_first() 202 it = view_model.get_iter_first()
163 while it: 203 while it:
164 name = self.find_item_for_path(path) 204 name = self.find_item_for_path(path)
165 view_name = view_model.get_value(it, RecipeListModel.COL_NAME) 205 view_name = view_model.get_value(it, PackageListModel.COL_NAME)
166 if view_name == name: 206 if view_name == name:
167 view_path = view_model.get_path(it) 207 view_path = view_model.get_path(it)
168 return view_path 208 return view_path
@@ -213,7 +253,6 @@ class PackageListModel(gtk.ListStore):
213 253
214 # pkgsize is in KB 254 # pkgsize is in KB
215 size = HobPage._size_to_string(HobPage._string_to_size(pkgsize + ' KB')) 255 size = HobPage._size_to_string(HobPage._string_to_size(pkgsize + ' KB'))
216
217 self.set(self.append(), self.COL_NAME, pkg, self.COL_VER, pkgv, 256 self.set(self.append(), self.COL_NAME, pkg, self.COL_VER, pkgv,
218 self.COL_REV, pkgr, self.COL_RNM, pkg_rename, 257 self.COL_REV, pkgr, self.COL_RNM, pkg_rename,
219 self.COL_SEC, section, self.COL_SUM, summary, 258 self.COL_SEC, section, self.COL_SUM, summary,
@@ -520,25 +559,61 @@ class RecipeListModel(gtk.ListStore):
520 val2 = model.get_value(iter2, RecipeListModel.COL_INC) 559 val2 = model.get_value(iter2, RecipeListModel.COL_INC)
521 return ((val1 == False) and (val2 == True)) 560 return ((val1 == False) and (val2 == True))
522 561
562 def sort_func(self, model, iter1, iter2, user_data):
563 val1 = model.get_value(iter1, RecipeListModel.COL_NAME)
564 val2 = model.get_value(iter2, RecipeListModel.COL_NAME)
565 if val1.startswith(user_data) and not val2.startswith(user_data):
566 return -1
567 elif not val1.startswith(user_data) and val2.startswith(user_data):
568 return 1
569 else:
570 return 0
571
523 """ 572 """
524 Create, if required, and return a filtered gtk.TreeModelSort 573 Create, if required, and return a filtered gtk.TreeModelSort
525 containing only the items specified by filter 574 containing only the items specified by filter
526 """ 575 """
527 def tree_model(self, filter, excluded_items_ahead=False, included_items_ahead=True, search_data=None): 576 def tree_model(self, filter, excluded_items_ahead=False, included_items_ahead=False, search_data=None, initial=False):
528 model = self.filter_new() 577 model = self.filter_new()
529 self.filtered_nb = 0 578 self.filtered_nb = 0
530 model.set_visible_func(self.tree_model_filter, filter) 579 model.set_visible_func(self.tree_model_filter, filter)
531 580
532 sort = gtk.TreeModelSort(model) 581 sort = gtk.TreeModelSort(model)
582 if initial:
583 sort.set_sort_column_id(RecipeListModel.COL_NAME, gtk.SORT_ASCENDING)
584 sort.set_default_sort_func(None)
585
533 if excluded_items_ahead: 586 if excluded_items_ahead:
534 sort.set_default_sort_func(self.exclude_item_sort_func, search_data) 587 sort.set_default_sort_func(self.exclude_item_sort_func, search_data)
535 elif included_items_ahead: 588 elif included_items_ahead:
536 sort.set_default_sort_func(self.include_item_sort_func, search_data) 589 sort.set_default_sort_func(self.include_item_sort_func, search_data)
537 else: 590 else:
538 sort.set_sort_column_id(RecipeListModel.COL_NAME, gtk.SORT_ASCENDING) 591 if search_data and search_data!='Search recipes by name' and search_data!='Search package groups by name':
539 sort.set_default_sort_func(None) 592 sort.set_default_sort_func(self.sort_func, search_data)
593 else:
594 sort.set_sort_column_id(RecipeListModel.COL_NAME, gtk.SORT_ASCENDING)
595 sort.set_default_sort_func(None)
596
597 sort.set_sort_func(RecipeListModel.COL_INC, self.sort_column, RecipeListModel.COL_INC)
598 sort.set_sort_func(RecipeListModel.COL_GROUP, self.sort_column, RecipeListModel.COL_GROUP)
599 sort.set_sort_func(RecipeListModel.COL_BINB, self.sort_column, RecipeListModel.COL_BINB)
600 sort.set_sort_func(RecipeListModel.COL_LIC, self.sort_column, RecipeListModel.COL_LIC)
540 return sort 601 return sort
541 602
603 def sort_column(self, model, row1, row2, col):
604 value1 = model.get_value(row1, col)
605 value2 = model.get_value(row2, col)
606 cmp_res = cmp(value1, value2)
607 if cmp_res!=0:
608 if col==RecipeListModel.COL_INC:
609 return -cmp_res
610 else:
611 return cmp_res
612 else:
613 name1 = model.get_value(row1, RecipeListModel.COL_NAME)
614 name2 = model.get_value(row2, RecipeListModel.COL_NAME)
615 return cmp(name1,name2)
616
542 def convert_vpath_to_path(self, view_model, view_path): 617 def convert_vpath_to_path(self, view_model, view_path):
543 filtered_model_path = view_model.convert_path_to_child_path(view_path) 618 filtered_model_path = view_model.convert_path_to_child_path(view_path)
544 filtered_model = view_model.get_model() 619 filtered_model = view_model.get_model()
diff --git a/bitbake/lib/bb/ui/crumbs/hobwidget.py b/bitbake/lib/bb/ui/crumbs/hobwidget.py
index f482a26f6a..3707d6160d 100644
--- a/bitbake/lib/bb/ui/crumbs/hobwidget.py
+++ b/bitbake/lib/bb/ui/crumbs/hobwidget.py
@@ -83,7 +83,7 @@ class HobViewTable (gtk.VBox):
83 gobject.TYPE_PYOBJECT,)), 83 gobject.TYPE_PYOBJECT,)),
84 } 84 }
85 85
86 def __init__(self, columns): 86 def __init__(self, columns, name):
87 gtk.VBox.__init__(self, False, 6) 87 gtk.VBox.__init__(self, False, 6)
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)
@@ -94,12 +94,18 @@ class HobViewTable (gtk.VBox):
94 self.toggle_columns = [] 94 self.toggle_columns = []
95 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 96 self.top_bar = None
97 self.tab_name = name
97 98
98 for i, column in enumerate(columns): 99 for i, column in enumerate(columns):
99 col = gtk.TreeViewColumn(column['col_name']) 100 col_name = column['col_name']
101 col = gtk.TreeViewColumn(col_name)
100 col.set_clickable(True) 102 col.set_clickable(True)
101 col.set_resizable(True) 103 col.set_resizable(True)
102 col.set_sort_column_id(column['col_id']) 104 if self.tab_name.startswith('Included'):
105 if col_name!='Included':
106 col.set_sort_column_id(column['col_id'])
107 else:
108 col.set_sort_column_id(column['col_id'])
103 if 'col_min' in column.keys(): 109 if 'col_min' in column.keys():
104 col.set_min_width(column['col_min']) 110 col.set_min_width(column['col_min'])
105 if 'col_max' in column.keys(): 111 if 'col_max' in column.keys():
@@ -122,7 +128,7 @@ class HobViewTable (gtk.VBox):
122 self.toggle_id = i 128 self.toggle_id = i
123 col.pack_end(cell, True) 129 col.pack_end(cell, True)
124 col.set_attributes(cell, active=column['col_id']) 130 col.set_attributes(cell, active=column['col_id'])
125 self.toggle_columns.append(column['col_name']) 131 self.toggle_columns.append(col_name)
126 if 'col_group' in column.keys(): 132 if 'col_group' in column.keys():
127 col.set_cell_data_func(cell, self.set_group_number_cb) 133 col.set_cell_data_func(cell, self.set_group_number_cb)
128 elif column['col_style'] == 'radio toggle': 134 elif column['col_style'] == 'radio toggle':
@@ -133,7 +139,7 @@ class HobViewTable (gtk.VBox):
133 self.toggle_id = i 139 self.toggle_id = i
134 col.pack_end(cell, True) 140 col.pack_end(cell, True)
135 col.set_attributes(cell, active=column['col_id']) 141 col.set_attributes(cell, active=column['col_id'])
136 self.toggle_columns.append(column['col_name']) 142 self.toggle_columns.append(col_name)
137 elif column['col_style'] == 'binb': 143 elif column['col_style'] == 'binb':
138 cell = gtk.CellRendererText() 144 cell = gtk.CellRendererText()
139 col.pack_start(cell, True) 145 col.pack_start(cell, True)
diff --git a/bitbake/lib/bb/ui/crumbs/packageselectionpage.py b/bitbake/lib/bb/ui/crumbs/packageselectionpage.py
index fb9afcb3cf..66cb7ff633 100755
--- a/bitbake/lib/bb/ui/crumbs/packageselectionpage.py
+++ b/bitbake/lib/bb/ui/crumbs/packageselectionpage.py
@@ -142,17 +142,18 @@ class PackageSelectionPage (HobPage):
142 # append the tab 142 # append the tab
143 for page in self.pages: 143 for page in self.pages:
144 columns = page['columns'] 144 columns = page['columns']
145 tab = HobViewTable(columns) 145 name = page['name']
146 tab = HobViewTable(columns, name)
146 search_names.append(page['search']) 147 search_names.append(page['search'])
147 search_tips.append(page['searchtip']) 148 search_tips.append(page['searchtip'])
148 filter = page['filter'] 149 filter = page['filter']
149 sort_model = self.package_model.tree_model(filter) 150 sort_model = self.package_model.tree_model(filter, initial=True)
150 tab.set_model(sort_model) 151 tab.set_model(sort_model)
151 tab.connect("toggled", self.table_toggled_cb, page['name']) 152 tab.connect("toggled", self.table_toggled_cb, name)
152 if page['name'] == "Included packages": 153 if name == "Included packages":
153 tab.connect("button-release-event", self.button_click_cb) 154 tab.connect("button-release-event", self.button_click_cb)
154 tab.connect("cell-fadeinout-stopped", self.after_fadeout_checkin_include) 155 tab.connect("cell-fadeinout-stopped", self.after_fadeout_checkin_include)
155 if page['name'] == "All packages": 156 if name == "All packages":
156 tab.connect("button-release-event", self.button_click_cb) 157 tab.connect("button-release-event", self.button_click_cb)
157 tab.connect("cell-fadeinout-stopped", self.after_fadeout_checkin_include) 158 tab.connect("cell-fadeinout-stopped", self.after_fadeout_checkin_include)
158 self.ins.append_page(tab, page['name'], page['tooltip']) 159 self.ins.append_page(tab, page['name'], page['tooltip'])
diff --git a/bitbake/lib/bb/ui/crumbs/recipeselectionpage.py b/bitbake/lib/bb/ui/crumbs/recipeselectionpage.py
index d1e5b69401..8573b81ea8 100755
--- a/bitbake/lib/bb/ui/crumbs/recipeselectionpage.py
+++ b/bitbake/lib/bb/ui/crumbs/recipeselectionpage.py
@@ -154,20 +154,21 @@ class RecipeSelectionPage (HobPage):
154 # append the tabs in order 154 # append the tabs in order
155 for page in self.pages: 155 for page in self.pages:
156 columns = page['columns'] 156 columns = page['columns']
157 tab = HobViewTable(columns) 157 name = page['name']
158 tab = HobViewTable(columns, name)
158 search_names.append(page['search']) 159 search_names.append(page['search'])
159 search_tips.append(page['searchtip']) 160 search_tips.append(page['searchtip'])
160 filter = page['filter'] 161 filter = page['filter']
161 sort_model = self.recipe_model.tree_model(filter) 162 sort_model = self.recipe_model.tree_model(filter, initial=True)
162 tab.set_model(sort_model) 163 tab.set_model(sort_model)
163 tab.connect("toggled", self.table_toggled_cb, page['name']) 164 tab.connect("toggled", self.table_toggled_cb, name)
164 if page['name'] == "Included recipes": 165 if name == "Included recipes":
165 tab.connect("button-release-event", self.button_click_cb) 166 tab.connect("button-release-event", self.button_click_cb)
166 tab.connect("cell-fadeinout-stopped", self.after_fadeout_checkin_include) 167 tab.connect("cell-fadeinout-stopped", self.after_fadeout_checkin_include)
167 if page['name'] == "Package Groups": 168 if name == "Package Groups":
168 tab.connect("button-release-event", self.button_click_cb) 169 tab.connect("button-release-event", self.button_click_cb)
169 tab.connect("cell-fadeinout-stopped", self.after_fadeout_checkin_include) 170 tab.connect("cell-fadeinout-stopped", self.after_fadeout_checkin_include)
170 if page['name'] == "All recipes": 171 if name == "All recipes":
171 tab.connect("button-release-event", self.button_click_cb) 172 tab.connect("button-release-event", self.button_click_cb)
172 tab.connect("cell-fadeinout-stopped", self.button_click_cb) 173 tab.connect("cell-fadeinout-stopped", self.button_click_cb)
173 self.ins.append_page(tab, page['name'], page['tooltip']) 174 self.ins.append_page(tab, page['name'], page['tooltip'])
@@ -241,7 +242,6 @@ class RecipeSelectionPage (HobPage):
241 properties['description'] = tree_model.get_value(tree_model.get_iter(path), RecipeListModel.COL_DESC) 242 properties['description'] = tree_model.get_value(tree_model.get_iter(path), RecipeListModel.COL_DESC)
242 self.builder.show_recipe_property_dialog(properties) 243 self.builder.show_recipe_property_dialog(properties)
243 244
244
245 def build_packages_clicked_cb(self, button): 245 def build_packages_clicked_cb(self, button):
246 self.builder.build_packages() 246 self.builder.build_packages()
247 247