<html><head><style type='text/css'>p { margin: 0; }</style><style type='text/css'>body { font-family: 'Verdana'; font-size: 10pt; color: #000000}</style></head><body>Hullo everyone .. <br><br>I am working on an application using a TreeView to show a TreeStore model through a Filter, including selection capabilities. The thing is, while showing all the model, when the user selects a parent row, all the childs are selected, this much works just fine, but when i have filtered the model and i try to select any parent row i get the following warning:<br><br>/home/darion/Projects/workspace/summon/src/summon/gui/main.py:585: GtkWarning: gtk_tree_model_filter_get_path: assertion `GTK_TREE_MODEL_FILTER (model)->priv->stamp == iter->stamp' failed
<br> selection.unselect_iter(iter)
<br><br>/home/darion/Projects/workspace/summon/src/summon/gui/main.py:586: GtkWarning: gtk_tree_selection_real_modify_range: assertion `start_node != NULL' failed
<br> selection.select_range(start_path, end_path)
<br><br>and only the parent row gets selected and none of its children.<br><br>I include the related methods:<br><br> # ****************************<br> # Selection Section<br> def select_package(self, arg1, path, column):<br> filter = self.packages_view.get_model()<br> real_path = filter.convert_path_to_child_path(path)<br> self.select_deselect(real_path, filter)<br> <br> def select_deselect(self, path, filter):<br> def do():<br> children = model.iter_n_children(iter)<br> start_path = model.get_path(model.iter_children(iter))<br> end_path = model.get_path(model.iter_nth_child(iter, children-1))<br> selection = self.packages_view.get_selection()<br> selection.unselect_all()<br> selection.unselect_iter(iter)<br> selection.select_range(start_path, end_path)<br> <br> model = filter.get_model()<br> value = not model[path][0]<br> model[path][0] = value<br> <br> iter = model.get_iter(path)<br> piter = model.iter_parent(iter)<br> <br> if piter is None:<br> if self.packages_view.row_expanded(path):<br> do()<br> self.on_check_button_clicked()<br> else:<br> self.packages_view.expand_row(path, False)<br> do()<br> self.on_check_button_clicked()<br> self.packages_view.collapse_row(path)<br> else:<br> cat = model.get_value(piter, 2)<br> atom = cat + "/" + model[path][2] + "-" + model[path][4]<br> if value and model[path][8]:<br> if self.current in ("install", "update"):<br> if atom not in self.summon.install_packages:<br> self.summon.install_packages.append(atom)<br> elif self.current == "remove":<br> if atom not in self.summon.remove_packages:<br> self.summon.remove_packages.append(atom)<br> else:<br> if self.current in ("install", "update"):<br> try:<br> self.summon.install_packages.remove(atom)<br> except ValueError, e:<br> pass<br> elif self.current == "remove":<br> try:<br> self.summon.remove_packages.remove(atom)<br> except ValueError, e:<br> pass<br> <br> sensitive = True<br> if len(self.summon.install_packages) == 0 and \<br> len(self.summon.remove_packages) == 0:<br> sensitive = False<br> self.process_button.set_sensitive(sensitive)<br> <br> def on_check_button_clicked(self, *args):<br> selection = self.packages_view.get_selection()<br> filter, paths = selection.get_selected_rows()<br> model = filter.get_model()<br> <br> true = 0<br> false = 0<br> action = True<br><br> for path in paths:<br> real_path = filter.convert_path_to_child_path(path)<br> if model[real_path][0]: true += 1<br> else: false += 1<br> action = true < false<br> <br> for path in paths:<br> real_path = filter.convert_path_to_child_path(path)<br> model[real_path][0] = not action<br> if model[real_path][8]:<br> self.select_deselect(real_path, filter)<br> <br> def on_checkall_button_clicked(self, *args):<br> selection = self.packages_view.get_selection()<br> selection.select_all()<br> filter, paths = selection.get_selected_rows()<br> model = filter.get_model()<br> <br> for path in paths:<br> real_path = filter.convert_path_to_child_path(path)<br> model[real_path][0] = False<br> self.select_deselect(real_path, filter)<br> <br> selection.unselect_all()<br> <br> def on_uncheck_button_clicked(self, *args):<br> selection = self.packages_view.get_selection()<br> selection.select_all()<br> filter, paths = selection.get_selected_rows()<br> model = filter.get_model()<br> <br> for path in paths:<br> real_path = filter.convert_path_to_child_path(path)<br> model[real_path][0] = True<br> self.select_deselect(real_path, filter)<br> <br> selection.unselect_all()<br> <br> def on_files_selection_changed(self, selection):<br> rows = selection.count_selected_rows()<br> self.erase_button.set_sensitive(rows>0)<br> self.merge_button.set_sensitive(rows>0)<br><br> # End of Selection Section<br> # ************************<br><br>If anyone has any idea what could be done .. i would be greatly thankful ..<br><br>Cheers .. and best regards ..<br><br>-- <br><div>Daniel Hernández Bahr<br>Universidad de las Ciencias Informáticas.<br></div><br></body></html>