gobject.TYPE_BOOLEAN,
gobject.TYPE_STRING,
gobject.TYPE_STRING)
+ self.sort_column_id, self.sort_order = PackageListModel.COL_NAME, gtk.SORT_ASCENDING
"""
Find the model path for the item_name
model.set_visible_func(self.tree_model_filter, filter)
sort = gtk.TreeModelSort(model)
+ sort.connect ('sort-column-changed', self.sort_column_changed_cb)
if initial:
sort.set_sort_column_id(PackageListModel.COL_NAME, gtk.SORT_ASCENDING)
sort.set_default_sort_func(None)
-
- if excluded_items_ahead:
+ elif excluded_items_ahead:
sort.set_default_sort_func(self.exclude_item_sort_func, search_data)
elif included_items_ahead:
sort.set_default_sort_func(self.include_item_sort_func, search_data)
if search_data and search_data!='Search recipes by name' and search_data!='Search package groups by name':
sort.set_default_sort_func(self.sort_func, search_data)
else:
- sort.set_sort_column_id(PackageListModel.COL_NAME, gtk.SORT_ASCENDING)
+ sort.set_sort_column_id(self.sort_column_id, self.sort_order)
sort.set_default_sort_func(None)
sort.set_sort_func(PackageListModel.COL_INC, self.sort_column, PackageListModel.COL_INC)
sort.set_sort_func(PackageListModel.COL_RCP, self.sort_column, PackageListModel.COL_RCP)
return sort
+ def sort_column_changed_cb (self, data):
+ self.sort_column_id, self.sort_order = data.get_sort_column_id ()
+
def sort_column(self, model, row1, row2, col):
value1 = model.get_value(row1, col)
value2 = model.get_value(row2, col)
gobject.TYPE_STRING,
gobject.TYPE_STRING,
gobject.TYPE_STRING)
+ self.sort_column_id, self.sort_order = RecipeListModel.COL_NAME, gtk.SORT_ASCENDING
"""
Find the model path for the item_name
model.set_visible_func(self.tree_model_filter, filter)
sort = gtk.TreeModelSort(model)
+ sort.connect ('sort-column-changed', self.sort_column_changed_cb)
if initial:
sort.set_sort_column_id(RecipeListModel.COL_NAME, gtk.SORT_ASCENDING)
sort.set_default_sort_func(None)
-
- if excluded_items_ahead:
+ elif excluded_items_ahead:
sort.set_default_sort_func(self.exclude_item_sort_func, search_data)
elif included_items_ahead:
sort.set_default_sort_func(self.include_item_sort_func, search_data)
if search_data and search_data!='Search recipes by name' and search_data!='Search package groups by name':
sort.set_default_sort_func(self.sort_func, search_data)
else:
- sort.set_sort_column_id(RecipeListModel.COL_NAME, gtk.SORT_ASCENDING)
+ sort.set_sort_column_id(self.sort_column_id, self.sort_order)
sort.set_default_sort_func(None)
sort.set_sort_func(RecipeListModel.COL_INC, self.sort_column, RecipeListModel.COL_INC)
sort.set_sort_func(RecipeListModel.COL_LIC, self.sort_column, RecipeListModel.COL_LIC)
return sort
+ def sort_column_changed_cb (self, data):
+ self.sort_column_id, self.sort_order = data.get_sort_column_id ()
+
def sort_column(self, model, row1, row2, col):
value1 = model.get_value(row1, col)
value2 = model.get_value(row2, col)
glib.idle_add(self.toggle_item_idle_cb, path, view_tree, cell, pagename)
def pre_fadeout_checkout_include(self, tree):
+ #after the fadeout the table will be sorted as before
+ self.sort_column_id = self.package_model.sort_column_id
+ self.sort_order = self.package_model.sort_order
+
self.package_model.resync_fadeout_column(self.package_model.get_iter_first())
# Check out a model which base on the column COL_FADE_INC,
# it's save the prev state of column COL_INC before do exclude_item
filter = { PackageListModel.COL_FADE_INC : [True]}
- new_model = self.package_model.tree_model(filter)
+ new_model = self.package_model.tree_model(filter, excluded_items_ahead=True)
tree.set_model(new_model)
tree.expand_all()
cell.fadeout(tree, 1000, to_render_cells)
def after_fadeout_checkin_include(self, table, ctrl, cell, tree, filter):
+ self.package_model.sort_column_id = self.sort_column_id
+ self.package_model.sort_order = self.sort_order
tree.set_model(self.package_model.tree_model(filter))
tree.expand_all()
glib.idle_add(self.toggle_item_idle_cb, path, view_tree, cell, pagename)
def pre_fadeout_checkout_include(self, tree, pagename):
+ #after the fadeout the table will be sorted as before
+ self.sort_column_id = self.recipe_model.sort_column_id
+ self.sort_order = self.recipe_model.sort_order
+
#resync the included items to a backup fade include column
it = self.recipe_model.get_iter_first()
while it:
cell.fadeout(tree, 1000, to_render_cells)
def after_fadeout_checkin_include(self, table, ctrl, cell, tree, filter):
+ self.recipe_model.sort_column_id = self.sort_column_id
+ self.recipe_model.sort_order = self.sort_order
tree.set_model(self.recipe_model.tree_model(filter))
def set_recipe_curr_tab(self, curr_page):