Module gwy :: Class NullStore
[hide private]
[frames] | no frames]

Class NullStore

source code

Instance Methods [hide private]
 
__init__(n)
Creates a new GtkTreeModel wrapper around nothing.
source code
 
get_n_rows()
Gets the number of imaginary rows in a null store.
source code
 
set_n_rows(n)
Sets the number of imaginary rows in a null store.
source code
 
get_model()
Gets the model pointer of a null store.
source code
 
set_model(model, destroy)
Sets the model pointer of a null store.
source code
 
row_changed(i)
Emits "GtkTreeModel::row-changed" signal on a null store.
source code
 
rows_changed(ifrom, ito)
Emits "GtkTreeModel::row-changed" signal on a block of rows in a null store.
source code
Method Details [hide private]

__init__(n)
(Constructor)

source code 

Creates a new GtkTreeModel wrapper around nothing.

Parameters:
  • n - The initial number of rows. (int)
Returns:
The newly created null store. (NullStore)

get_n_rows()

source code 

Gets the number of imaginary rows in a null store.

This is a convenience function, the same information can be obtained with gtk_tree_model_iter_n_children().

Returns:
The number of rows. (int)

set_n_rows(n)

source code 

Sets the number of imaginary rows in a null store.

If the new number of rows is larger than the current one, rows will be sequentially and virtually appended to the end of the store until the requested number of rows is reached.

Similarly, if the new number of rows is smaller then the current one, rows will be sequentially and virtually deleted from the end of the store until the requested number of rows is reached.

Note for radical changes it is usually more useful to disconnect the model from its view(s), change the number of rows, and then reconnect.

Parameters:
  • n - The new number of rows. (int)

get_model()

source code 

Gets the model pointer of a null store.

Returns:
The pointer set with NullStore.set_model(). (gpointer)

set_model(model, destroy)

source code 

Sets the model pointer of a null store.

While the virtual integers in NullStore can be used directly, a null store typically serves as an adaptor for array-like structures and its rows are used as indices to these structures. This helper method provides means to attach such a structure to a null store in the common case.

The store itself does not interpret nor access the attached data by any means. No signals are emitted in response to the model pointer change either, particularly because it is expected to be set only once upon creation (null stores are cheap).

You are free to keep the model pointer at None if these functions do not suit your needs.

Parameters:
  • model - Model pointer. (gpointer)
  • destroy - Function to call on model when it is replaced or the store is destroyed. (GDestroyNotify)

row_changed(i)

source code 

Emits "GtkTreeModel::row-changed" signal on a null store.

This is a convenience method, with a bit more work the same effect can be achieved with gtk_tree_model_row_changed().

Parameters:
  • i - A row to emit "row-changed" on. (int)

rows_changed(ifrom, ito)

source code 

Emits "GtkTreeModel::row-changed" signal on a block of rows in a null store.

This is a convenience method, with a bit more work the same effect can be achieved with gtk_tree_model_row_changed().

It is possible to pass ifrom larger than ito. The signal is then emitted for the same rows, but in the opposite order.

Parameters:
  • ifrom - The first row to emit "row-changed" on. (int)
  • ito - The last row to emit "row-changed" on (inclusive). (int)

Since: 2.62