14.7. TreeView Signals

TreeViews emit a large number of signals that you can use to track changes in the view of the model. The signals generally fall into the following categories:

The "test-collapse-row" and "test-expand-row" signals are emitted before a row is collapsed or expanded. The return value from your callback can cancel or allow the operation - TRUE to allow and FALSE to cancel.

  def callback(treeview, iter, path, user_data)

where iter is a TreeIter and path is a tree path pointing at the row and user_data is the data specified in the connect() method.

The "row-activated" signal is emitted when a double click occurs on a row or a non-editable row is selected and one of the keys: Space, Shift+Space, Return or Enter is pressed.

The rest of the signals are emitted after the TreeView has changed. The cursor is the row outlined by a box. In most cases moving the cursor also moves the selection. The cursor can be moved independently by Control+Down or Control+Up and various other key combinations.

See the PyGTK Reference Manual for more information on the TreeView signals.