The gtk.tree_selection.TreeSelection object is gotten from a gtk.tree_view.TreeView by calling
gtk.tree_view.TreeView.getSelection. It can be manipulated to check the
selection status of the tree, as well as select and deselect individual
rows. Selection is done completely view side. As a result, multiple
views of the same model can have completely different selections.
Additionally, you cannot change the selection of a row on the model that
is not currently displayed by the view without expanding its parents
first.
One of the important things to remember when monitoring the selection of
a view is that the gtk.tree_selection.TreeSelection::changed signal is mostly a hint.
That is, it may only emit one signal when a range of rows is selected.
Additionally, it may on occasion emit a gtk.tree_selection.TreeSelection::changed signal
when nothing has happened (mostly as a result of programmers calling
select_row on an already selected row).
The selection object for GtkTreeView
The gtk.tree_selection.TreeSelection object is a helper object to manage the selection for a gtk.tree_view.TreeView widget. The gtk.tree_selection.TreeSelection object is automatically created when a new gtk.tree_view.TreeView widget is created, and cannot exist independently of this widget. The primary reason the gtk.tree_selection.TreeSelection objects exists is for cleanliness of code and API. That is, there is no conceptual reason all these functions could not be methods on the gtk.tree_view.TreeView widget instead of a separate function.
The gtk.tree_selection.TreeSelection object is gotten from a gtk.tree_view.TreeView by calling gtk.tree_view.TreeView.getSelection. It can be manipulated to check the selection status of the tree, as well as select and deselect individual rows. Selection is done completely view side. As a result, multiple views of the same model can have completely different selections. Additionally, you cannot change the selection of a row on the model that is not currently displayed by the view without expanding its parents first.
One of the important things to remember when monitoring the selection of a view is that the gtk.tree_selection.TreeSelection::changed signal is mostly a hint. That is, it may only emit one signal when a range of rows is selected. Additionally, it may on occasion emit a gtk.tree_selection.TreeSelection::changed signal when nothing has happened (mostly as a result of programmers calling select_row on an already selected row).