Dee.Model

g Dee.Model Dee.Model GObject.GInterface GObject.GInterface GObject.GInterface->Dee.Model

Implementations:

Dee.SerializableModel

Methods

append_row (row_members)

begin_changeset ()

clear ()

clear_tag (iter, tag)

end_changeset ()

find_row_sorted (row_spec, cmp_func, *user_data)

find_row_sorted_with_sizes (row_spec, cmp_func, *user_data)

get_bool (iter, column)

get_column_index (column_name)

get_column_names ()

get_column_schema (column)

get_double (iter, column)

get_field_schema (field_name)

get_first_iter ()

get_int32 (iter, column)

get_int64 (iter, column)

get_iter_at_row (row)

get_last_iter ()

get_n_columns ()

get_n_rows ()

get_position (iter)

get_row (iter)

get_schema ()

get_string (iter, column)

get_tag (iter, tag)

get_uchar (iter, column)

get_uint32 (iter, column)

get_uint64 (iter, column)

get_value (iter, column)

get_value_by_name (iter, column_name)

get_vardict_schema (column)

insert_row (pos, row_members)

insert_row_before (iter, row_members)

insert_row_sorted (row_members, cmp_func, *user_data)

insert_row_sorted_with_sizes (row_members, cmp_func, *user_data)

is_first (iter)

is_last (iter)

next (iter)

prepend_row (row_members)

prev (iter)

register_tag (tag_destroy)

register_vardict_schema (column, schemas)

remove (iter)

set_column_names_full (column_names)

set_row (iter, row_members)

set_schema_full (column_schemas)

set_tag (iter, tag, value)

set_value (iter, column, value)

Virtual Methods

do_append_row (row_members)

do_begin_changeset ()

do_changeset_finished ()

do_changeset_started ()

do_clear ()

do_end_changeset ()

do_find_row_sorted (row_spec, cmp_func, *user_data)

do_get_bool (iter, column)

do_get_column_index (column_name)

do_get_column_names ()

do_get_column_schema (column)

do_get_double (iter, column)

do_get_field_schema (field_name)

do_get_first_iter ()

do_get_int32 (iter, column)

do_get_int64 (iter, column)

do_get_iter_at_row (row)

do_get_last_iter ()

do_get_n_columns ()

do_get_n_rows ()

do_get_position (iter)

do_get_row (iter, out_row_members)

do_get_schema ()

do_get_string (iter, column)

do_get_tag (iter, tag)

do_get_uchar (iter, column)

do_get_uint32 (iter, column)

do_get_uint64 (iter, column)

do_get_value (iter, column)

do_get_value_by_name (iter, column_name)

do_get_vardict_schema (num_column)

do_insert_row (pos, row_members)

do_insert_row_before (iter, row_members)

do_insert_row_sorted (row_members, cmp_func, *user_data)

do_is_first (iter)

do_is_last (iter)

do_next (iter)

do_prepend_row (row_members)

do_prev (iter)

do_register_tag (tag_destroy)

do_register_vardict_schema (num_column, schemas)

do_remove (iter)

do_row_added (iter)

do_row_changed (iter)

do_row_removed (iter)

do_set_column_names_full (column_names)

do_set_row (iter, row_members)

do_set_schema_full (column_schemas)

do_set_tag (iter, tag, value)

do_set_value (iter, column, value)

Properties

None

Signals

Name

Short Description

changeset-finished

Connect to this signal to be notified when a changeset that can contain multiple row additions / changes / removals has been committed to the model.

changeset-started

Connect to this signal to be notified when a changeset that can contain multiple row additions / changes / removals is about to be committed to the model.

row-added

Connect to this signal to be notified when a row is added to self.

row-changed

Connect to this signal to be notified when a row is changed.

row-removed

Connect to this signal to be notified when a row is removed from self.

Fields

None

Class Details

class Dee.Model
Bases:

GObject.GInterface

Structure:

Dee.ModelIface

append_row(row_members)
Parameters:

row_members ([GLib.Variant]) – An array of GLib.Variants with type signature matching those of the column schemas of self. If any of the variants have floating references they will be consumed

Returns:

A Dee.ModelIter pointing to the new row

Return type:

Dee.ModelIter

Like dee_model_append() but intended for language bindings or situations where you work with models on a meta level and may not have a prior knowledge of the column schemas of the models. See also dee_model_build_row().

begin_changeset()

Notify listeners that the model is about to be changed, which means that multiple row additions / changes / removals will follow. The default implementation of this method will emit the ::changeset-started signal.

It is not stricly necessary to enclose every change to a model in a Dee.Model.begin_changeset() and Dee.Model.end_changeset() calls, but doing so is highly recommended and allows implementing various optimizations.

The usual way to perform multiple changes to a model is as follows:

void update_model (DeeModel *model)
{
  GVariant **added_row_data1 = ...;
  GVariant **added_row_data2 = ...;

  dee_model_begin_changeset (model);

  dee_model_remove (model, dee_model_get_first_iter (model));
  dee_model_append_row (model, added_row_data1);
  dee_model_append_row (model, added_row_data2);

  dee_model_end_changeset (model);
}
clear()

Removes all rows in the model. Signals are emitted for each row in the model

clear_tag(iter, tag)
Parameters:

This method is purely syntactic sugar for calling Dee.Model.set_tag() with a value of None. It’s included in order to help developers write more readable code.

end_changeset()

Notify listeners that all changes have been committed to the model. The default implementation of this method will emit the ::changeset-finished signal.

See also Dee.Model.begin_changeset().

find_row_sorted(row_spec, cmp_func, *user_data)
Parameters:
  • row_spec ([GLib.Variant]) – An array of GLib.Variants with type signature matching those of the column schemas of self. No references will be taken on the variants.

  • cmp_func (Dee.CompareRowFunc) – Callback used for comparison or rows

  • user_data (object or None) – Arbitrary pointer passed to cmp_func during search

Returns:

If out_was_found is set to True then a Dee.ModelIter pointing to the last matching row. If it is False then the iter pointing to the row just after where row_spec_would have been inserted.

out_was_found:

A place to store a boolean value that will be set when this method returns. If True then an exact match was found. If False then the returned iter points to a row just after where row_spec would have been inserted. Pass None to ignore.

Return type:

(Dee.ModelIter, out_was_found: bool)

Finds a row in self according to the sorting specified by cmp_func. This method will assume that self is already sorted by cmp_func.

If you use this method for searching you should only use Dee.Model.insert_row_sorted() to insert rows in the model.

find_row_sorted_with_sizes(row_spec, cmp_func, *user_data)
Parameters:
  • row_spec ([GLib.Variant]) – An array of GLib.Variants with type signature matching those of the column schemas of self. No references will be taken on the variants.

  • cmp_func (Dee.CompareRowSizedFunc) – Callback used for comparison or rows

  • user_data (object or None) – Arbitrary pointer passed to cmp_func during search

Returns:

If out_was_found is set to True then a Dee.ModelIter pointing to the last matching row. If it is False then the iter pointing to the row just after where row_spec_would have been inserted.

out_was_found:

A place to store a boolean value that will be set when this method returns. If True then an exact match was found. If False then the returned iter points to a row just after where row_spec would have been inserted. Pass None to ignore.

Return type:

(Dee.ModelIter, out_was_found: bool)

Like Dee.Model.find_row_sorted(), but uses Dee.CompareRowSizedFunc and therefore doesn’t cause trouble when used from introspected languages.

Finds a row in self according to the sorting specified by cmp_func. This method will assume that self is already sorted by cmp_func.

If you use this method for searching you should only use Dee.Model.insert_row_sorted() (or Dee.Model.insert_row_sorted_with_sizes()) to insert rows in the model.

get_bool(iter, column)
Parameters:
Returns:

if iter and column are valid, the boolean stored at column. Otherwise False

Return type:

bool

get_column_index(column_name)
Parameters:

column_name (str) – the column name to retrieve the index of

Returns:

0-based index of the column or -1 if column with this name wasn’t found

Return type:

int

Get the column index of a column.

get_column_names()
Returns:

A None-terminated array of GLib.Variant type strings. The length of the returned array is written to num_columns. The returned array should not be freed or modified. It is owned by the model.

Return type:

[str]

Get a None-terminated array of column names for the columns of self. These names can be used in calls to dee_model_build_named_row().

get_column_schema(column)
Parameters:

column (int) – the column to get retrieve the GLib.Variant type string of

Returns:

the GLib.Variant signature of the column at index column

Return type:

str

Get the GLib.Variant signature of a column

get_double(iter, column)
Parameters:
Returns:

if iter and column are valid, the double stored at column. Otherwise 0.

Return type:

float

get_field_schema(field_name)
Parameters:

field_name (str) – name of vardict field to get schema of

Returns:

the GLib.Variant signature for the field, or None if given field wasn’t registered with Dee.Model.register_vardict_schema().

out_column:

column index of the associated vardict

Return type:

(str, out_column: int)

Get the GLib.Variant signature of field previously registered with Dee.Model.register_vardict_schema().

get_first_iter()
Returns:

A Dee.ModelIter (owned by self, do not free it)

Return type:

Dee.ModelIter

Retrieves a Dee.ModelIter representing the first row in self.

get_int32(iter, column)
Parameters:
Returns:

if iter and column are valid, the int stored at column. Otherwise 0.

Return type:

int

get_int64(iter, column)
Parameters:
Returns:

if iter and column are valid, the int64 stored at column. Otherwise 0.

Return type:

int

get_iter_at_row(row)
Parameters:

row (int) – position of the row to retrieve

Returns:

A new Dee.ModelIter, or None if row was out of bounds. The returned iter is owned by self, so do not free it.

Return type:

Dee.ModelIter

Retrieves a Dee.ModelIter representing the row at the given index.

Note that this method does not have any performance guarantees. In particular it is not guaranteed to be O(1).

get_last_iter()
Returns:

A Dee.ModelIter (owned by self, do not free it)

Return type:

Dee.ModelIter

Retrieves a Dee.ModelIter pointing right after the last row in self. This is refered to also the the end iter.

As with other iters the end iter, in particular, is stable over inserts, changes, or removals.

get_n_columns()
Returns:

the number of columns per row in self

Return type:

int

Gets the number of columns in self

get_n_rows()
Returns:

the number of rows in self

Return type:

int

Gets the number of rows in self

get_position(iter)
Parameters:

iter (Dee.ModelIter) – The iter to get the position of

Returns:

The integer offset of iter in self

Return type:

int

Get the numeric offset of iter into self. Note that this method is not guaranteed to be O(1).

get_row(iter)
Parameters:

iter (Dee.ModelIter) – A Dee.ModelIter pointing to the row to get

Returns:

out_row_members if it was not None or a newly allocated array otherwise which you must free with GLib.free(). The variants in the array will have a strong reference and needs to be freed with GLib.Variant.unref().

out_row_members:

An array of variants with a length bigger than or equal to the number of columns in self, or None. If you pass None here a new array will be allocated for you. The returned variants will have a non-floating reference

Return type:

([GLib.Variant], out_row_members: [GLib.Variant])

get_schema()
Returns:

A None-terminated array of GLib.Variant type strings. The length of the returned array is written to num_columns. The returned array should not be freed or modified. It is owned by the model.

Return type:

[str]

Get a None-terminated array of GLib.Variant type strings that defines the required formats for the columns of self.

get_string(iter, column)
Parameters:
Returns:

if iter and column are valid, the string stored at column. Otherwise None.

Return type:

str

get_tag(iter, tag)
Parameters:
Returns:

Returns None if tag is unset otherwise the value of the tag as it was set with Dee.Model.set_tag().

Return type:

object or None

Look up a tag value for a given row in a model. This method is guaranteed to be O(1).

get_uchar(iter, column)
Parameters:
Returns:

if iter and column are valid, the uchar stored at column. Otherwise 0.

Return type:

int

get_uint32(iter, column)
Parameters:
Returns:

if iter and column are valid, the uint stored at column. Otherwise 0.

Return type:

int

get_uint64(iter, column)
Parameters:
Returns:

if iter and column are valid, the uint64 stored at column. Otherwise 0.

Return type:

int

get_value(iter, column)
Parameters:
Returns:

A, guaranteed non-floating, reference to a GLib.Variant containing the row data. Free with GLib.Variant.unref().

Return type:

GLib.Variant

get_value_by_name(iter, column_name)
Parameters:
Returns:

A, guaranteed non-floating, reference to a GLib.Variant containing the row data. Free with GLib.Variant.unref().

Return type:

GLib.Variant

get_vardict_schema(column)
Parameters:

column (int) – the column index to get the schemas for

Returns:

Hashtable containing a mapping from field names to schemas or None. Note that keys and values in the hashtable may be owned by the model, so you need to create a deep copy if you intend to keep the hashtable around.

Return type:

{str: str}

Get a schema for variant dictionary column previously registered using Dee.Model.register_vardict_schema().

insert_row(pos, row_members)
Parameters:
  • pos (int) – The index to insert the row on. The existing row will be pushed down.

  • row_members ([GLib.Variant]) – An array of GLib.Variants with type signature matching those of the column schemas of self. If any of the variants have floating references they will be consumed.

Returns:

A Dee.ModelIter pointing to the new row

Return type:

Dee.ModelIter

As dee_model_insert(), but intended for language bindings or situations where you work with models on a meta level and may not have a priori knowledge of the column schemas of the models. See also dee_model_build_row().

insert_row_before(iter, row_members)
Parameters:
  • iter (Dee.ModelIter) – An iter pointing to the row before which to insert the new one

  • row_members ([GLib.Variant]) – An array of GLib.Variants with type signature matching those of the column schemas of self. If any of the variants have floating references they will be consumed.

Returns:

A Dee.ModelIter pointing to the new row

Return type:

Dee.ModelIter

As dee_model_insert_before(), but intended for language bindings or situations where you work with models on a meta level and may not have a priori knowledge of the column schemas of the models. See also dee_model_build_row().

insert_row_sorted(row_members, cmp_func, *user_data)
Parameters:
  • row_members ([GLib.Variant]) – An array of GLib.Variants with type signature matching those of the column schemas of self. If any of the variants have floating references they will be consumed.

  • cmp_func (Dee.CompareRowFunc) – Callback used for comparison or rows

  • user_data (object or None) – Arbitrary pointer passed to cmp_func during search

Returns:

A Dee.ModelIter pointing to the new row

Return type:

Dee.ModelIter

Inserts a row in self according to the sorting specified by cmp_func. If you use this method for insertion you should not use other methods as this method assumes the model to be already sorted by cmp_func.

insert_row_sorted_with_sizes(row_members, cmp_func, *user_data)
Parameters:
  • row_members ([GLib.Variant]) – An array of GLib.Variants with type signature matching those of the column schemas of self. If any of the variants have floating references they will be consumed.

  • cmp_func (Dee.CompareRowSizedFunc) – Callback used for comparison or rows

  • user_data (object or None) – Arbitrary pointer passed to cmp_func during search

Returns:

A Dee.ModelIter pointing to the new row

Return type:

Dee.ModelIter

Inserts a row in self according to the sorting specified by cmp_func. If you use this method for insertion you should not use other methods as this method assumes the model to be already sorted by cmp_func.

is_first(iter)
Parameters:

iter (Dee.ModelIter) – a Dee.ModelIter

Returns:

True if iter is the first iter in the model

Return type:

bool

Checks if iter is the very first iter self.

is_last(iter)
Parameters:

iter (Dee.ModelIter) – a Dee.ModelIter

Returns:

True if iter is the last iter in the model

Return type:

bool

Whether iter is the end iter of self. Note that the end iter points right after the last valid row in self.

next(iter)
Parameters:

iter (Dee.ModelIter) – a Dee.ModelIter

Returns:

A Dee.ModelIter, pointing to the next row in the model. The iter is owned by self, do not free it.

Return type:

Dee.ModelIter

Returns a Dee.ModelIter that points to the next position in the model.

prepend_row(row_members)
Parameters:

row_members ([GLib.Variant]) – An array of GLib.Variants with type signature matching those of the column schemas of self. If any of the variants have floating references they will be consumed.

Returns:

A Dee.ModelIter pointing to the new row

Return type:

Dee.ModelIter

Like dee_model_prepend() but intended for language bindings or situations where you work with models on a meta level and may not have a priori knowledge of the column schemas of the models. See also dee_model_build_row().

prev(iter)
Parameters:

iter (Dee.ModelIter) – a Dee.ModelIter

Returns:

A Dee.ModelIter, pointing to the previous row in the model. The iter is owned by self, do not free it.

Return type:

Dee.ModelIter

Returns a Dee.ModelIter that points to the previous position in the model.

register_tag(tag_destroy)
Parameters:

tag_destroy (GLib.DestroyNotify) – Function called when a tagged row is removed from the model. This function will also be called on all tagged rows when the model is finalized.

Returns:

A Dee.ModelTag handle that you can use to set and get tags with

Return type:

Dee.ModelTag

Register a new tag on a Dee.Model. A tag is an extra value attached to a given row on a model. The tags are invisible to all that doesn’t have the tag handle returned by this method. Dee.Model implementations must ensure that Dee.Model.get_tag() is an O(1) operation.

Tags can be very useful in associating some extra data to a row in a model and have that automatically synced when the model changes. If you’re writing a tiled view for a model you might want to tag each row with the tile widget for that row. That way you have very convenient access to the tile widget given any row in the model.

The private nature of tags and the fact that you can store arbitrary pointers and binary data in them also means that they are not serialized if you utilize a model implementation that exposes the Dee.Serializable interface.

register_vardict_schema(column, schemas)
Parameters:
  • column (int) – the column index to register the schemas with

  • schemas ({str: str}) – hashtable with keys specifying names of the fields and values defining their schema

Register schema for fields in a model containing column with variant dictionary schema (‘a{sv}’). The keys registered with this function can be later used with dee_model_build_named_row() function, as well as Dee.Model.get_value_by_name(). Note that it is possible to register the same field name for multiple columns, in which case you need to use fully-qualified “column_name::field” name in the calls to dee_model_build_named_row() and Dee.Model.get_field_schema().

remove(iter)
Parameters:

iter (Dee.ModelIter) – a Dee.ModelIter pointing to the row to remove

Removes the row at the given position from the model.

set_column_names_full(column_names)
Parameters:

column_names ([str]) – A list of column names terminated by a None

Set column names used by self. This method must be called exactly once, but only after setting a schema of the model. Note that some constructors will do this for you.

set_row(iter, row_members)
Parameters:

Sets all columns in the row iter points to, to those found in row_members. The variants in row_members must match the types defined in the model’s schema.

set_schema_full(column_schemas)
Parameters:

column_schemas ([str]) – A list of GLib.Variant type strings terminated by a None

Set the GLib.Variant types and the number of columns used by self. This method must be called exactly once before using self. Note that some constructors will do this for you.

set_tag(iter, tag, value)
Parameters:

Set a tag on a row in a model. This function is guaranteed to be O(1). See also Dee.Model.register_tag().

If tag is already set on this row the existing tag value will be destroyed with the GLib.DestroyNotify passed to the Dee.Model.register_tag().

set_value(iter, column, value)
Parameters:
  • iter (Dee.ModelIter) – a Dee.ModelIter

  • column (int) – column number to set the value

  • value (GLib.Variant) – New value for cell. If value is a floating reference the model will assume ownership of the variant

Sets the data in column for the row iter points to, to value. The type of value must be convertible to the type of the column.

When this method call completes the model will emit ::row-changed. You can edit the model in place without triggering the change signals by calling dee_model_set_value_silently().

do_append_row(row_members) virtual
Parameters:

row_members ([GLib.Variant]) – An array of GLib.Variants with type signature matching those of the column schemas of self. If any of the variants have floating references they will be consumed

Returns:

A Dee.ModelIter pointing to the new row

Return type:

Dee.ModelIter

Like dee_model_append() but intended for language bindings or situations where you work with models on a meta level and may not have a prior knowledge of the column schemas of the models. See also dee_model_build_row().

do_begin_changeset() virtual

Notify listeners that the model is about to be changed, which means that multiple row additions / changes / removals will follow. The default implementation of this method will emit the ::changeset-started signal.

It is not stricly necessary to enclose every change to a model in a Dee.Model.begin_changeset() and Dee.Model.end_changeset() calls, but doing so is highly recommended and allows implementing various optimizations.

The usual way to perform multiple changes to a model is as follows:

void update_model (DeeModel *model)
{
  GVariant **added_row_data1 = ...;
  GVariant **added_row_data2 = ...;

  dee_model_begin_changeset (model);

  dee_model_remove (model, dee_model_get_first_iter (model));
  dee_model_append_row (model, added_row_data1);
  dee_model_append_row (model, added_row_data2);

  dee_model_end_changeset (model);
}
do_changeset_finished() virtual
do_changeset_started() virtual
do_clear() virtual

Removes all rows in the model. Signals are emitted for each row in the model

do_end_changeset() virtual

Notify listeners that all changes have been committed to the model. The default implementation of this method will emit the ::changeset-finished signal.

See also Dee.Model.begin_changeset().

do_find_row_sorted(row_spec, cmp_func, *user_data) virtual
Parameters:
  • row_spec ([GLib.Variant]) – An array of GLib.Variants with type signature matching those of the column schemas of self. No references will be taken on the variants.

  • cmp_func (Dee.CompareRowFunc) – Callback used for comparison or rows

  • user_data (object or None) – Arbitrary pointer passed to cmp_func during search

Returns:

If out_was_found is set to True then a Dee.ModelIter pointing to the last matching row. If it is False then the iter pointing to the row just after where row_spec_would have been inserted.

out_was_found:

A place to store a boolean value that will be set when this method returns. If True then an exact match was found. If False then the returned iter points to a row just after where row_spec would have been inserted. Pass None to ignore.

Return type:

(Dee.ModelIter, out_was_found: bool)

Finds a row in self according to the sorting specified by cmp_func. This method will assume that self is already sorted by cmp_func.

If you use this method for searching you should only use Dee.Model.insert_row_sorted() to insert rows in the model.

do_get_bool(iter, column) virtual
Parameters:
Returns:

if iter and column are valid, the boolean stored at column. Otherwise False

Return type:

bool

do_get_column_index(column_name) virtual
Parameters:

column_name (str) – the column name to retrieve the index of

Returns:

0-based index of the column or -1 if column with this name wasn’t found

Return type:

int

Get the column index of a column.

do_get_column_names() virtual
Returns:

A None-terminated array of GLib.Variant type strings. The length of the returned array is written to num_columns. The returned array should not be freed or modified. It is owned by the model.

Return type:

[str]

Get a None-terminated array of column names for the columns of self. These names can be used in calls to dee_model_build_named_row().

do_get_column_schema(column) virtual
Parameters:

column (int) – the column to get retrieve the GLib.Variant type string of

Returns:

the GLib.Variant signature of the column at index column

Return type:

str

Get the GLib.Variant signature of a column

do_get_double(iter, column) virtual
Parameters:
Returns:

if iter and column are valid, the double stored at column. Otherwise 0.

Return type:

float

do_get_field_schema(field_name) virtual
Parameters:

field_name (str) – name of vardict field to get schema of

Returns:

the GLib.Variant signature for the field, or None if given field wasn’t registered with Dee.Model.register_vardict_schema().

out_column:

column index of the associated vardict

Return type:

(str, out_column: int)

Get the GLib.Variant signature of field previously registered with Dee.Model.register_vardict_schema().

do_get_first_iter() virtual
Returns:

A Dee.ModelIter (owned by self, do not free it)

Return type:

Dee.ModelIter

Retrieves a Dee.ModelIter representing the first row in self.

do_get_int32(iter, column) virtual
Parameters:
Returns:

if iter and column are valid, the int stored at column. Otherwise 0.

Return type:

int

do_get_int64(iter, column) virtual
Parameters:
Returns:

if iter and column are valid, the int64 stored at column. Otherwise 0.

Return type:

int

do_get_iter_at_row(row) virtual
Parameters:

row (int) – position of the row to retrieve

Returns:

A new Dee.ModelIter, or None if row was out of bounds. The returned iter is owned by self, so do not free it.

Return type:

Dee.ModelIter

Retrieves a Dee.ModelIter representing the row at the given index.

Note that this method does not have any performance guarantees. In particular it is not guaranteed to be O(1).

do_get_last_iter() virtual
Returns:

A Dee.ModelIter (owned by self, do not free it)

Return type:

Dee.ModelIter

Retrieves a Dee.ModelIter pointing right after the last row in self. This is refered to also the the end iter.

As with other iters the end iter, in particular, is stable over inserts, changes, or removals.

do_get_n_columns() virtual
Returns:

the number of columns per row in self

Return type:

int

Gets the number of columns in self

do_get_n_rows() virtual
Returns:

the number of rows in self

Return type:

int

Gets the number of rows in self

do_get_position(iter) virtual
Parameters:

iter (Dee.ModelIter) – The iter to get the position of

Returns:

The integer offset of iter in self

Return type:

int

Get the numeric offset of iter into self. Note that this method is not guaranteed to be O(1).

do_get_row(iter, out_row_members) virtual
Parameters:
Return type:

GLib.Variant

do_get_schema() virtual
Returns:

A None-terminated array of GLib.Variant type strings. The length of the returned array is written to num_columns. The returned array should not be freed or modified. It is owned by the model.

Return type:

[str]

Get a None-terminated array of GLib.Variant type strings that defines the required formats for the columns of self.

do_get_string(iter, column) virtual
Parameters:
Returns:

if iter and column are valid, the string stored at column. Otherwise None.

Return type:

str

do_get_tag(iter, tag) virtual
Parameters:
Returns:

Returns None if tag is unset otherwise the value of the tag as it was set with Dee.Model.set_tag().

Return type:

object or None

Look up a tag value for a given row in a model. This method is guaranteed to be O(1).

do_get_uchar(iter, column) virtual
Parameters:
Returns:

if iter and column are valid, the uchar stored at column. Otherwise 0.

Return type:

int

do_get_uint32(iter, column) virtual
Parameters:
Returns:

if iter and column are valid, the uint stored at column. Otherwise 0.

Return type:

int

do_get_uint64(iter, column) virtual
Parameters:
Returns:

if iter and column are valid, the uint64 stored at column. Otherwise 0.

Return type:

int

do_get_value(iter, column) virtual
Parameters:
Returns:

A, guaranteed non-floating, reference to a GLib.Variant containing the row data. Free with GLib.Variant.unref().

Return type:

GLib.Variant

do_get_value_by_name(iter, column_name) virtual
Parameters:
Returns:

A, guaranteed non-floating, reference to a GLib.Variant containing the row data. Free with GLib.Variant.unref().

Return type:

GLib.Variant

do_get_vardict_schema(num_column) virtual
Parameters:

num_column (int) –

Returns:

Hashtable containing a mapping from field names to schemas or None. Note that keys and values in the hashtable may be owned by the model, so you need to create a deep copy if you intend to keep the hashtable around.

Return type:

{str: str}

Get a schema for variant dictionary column previously registered using Dee.Model.register_vardict_schema().

do_insert_row(pos, row_members) virtual
Parameters:
  • pos (int) – The index to insert the row on. The existing row will be pushed down.

  • row_members ([GLib.Variant]) – An array of GLib.Variants with type signature matching those of the column schemas of self. If any of the variants have floating references they will be consumed.

Returns:

A Dee.ModelIter pointing to the new row

Return type:

Dee.ModelIter

As dee_model_insert(), but intended for language bindings or situations where you work with models on a meta level and may not have a priori knowledge of the column schemas of the models. See also dee_model_build_row().

do_insert_row_before(iter, row_members) virtual
Parameters:
  • iter (Dee.ModelIter) – An iter pointing to the row before which to insert the new one

  • row_members ([GLib.Variant]) – An array of GLib.Variants with type signature matching those of the column schemas of self. If any of the variants have floating references they will be consumed.

Returns:

A Dee.ModelIter pointing to the new row

Return type:

Dee.ModelIter

As dee_model_insert_before(), but intended for language bindings or situations where you work with models on a meta level and may not have a priori knowledge of the column schemas of the models. See also dee_model_build_row().

do_insert_row_sorted(row_members, cmp_func, *user_data) virtual
Parameters:
  • row_members ([GLib.Variant]) – An array of GLib.Variants with type signature matching those of the column schemas of self. If any of the variants have floating references they will be consumed.

  • cmp_func (Dee.CompareRowFunc) – Callback used for comparison or rows

  • user_data (object or None) – Arbitrary pointer passed to cmp_func during search

Returns:

A Dee.ModelIter pointing to the new row

Return type:

Dee.ModelIter

Inserts a row in self according to the sorting specified by cmp_func. If you use this method for insertion you should not use other methods as this method assumes the model to be already sorted by cmp_func.

do_is_first(iter) virtual
Parameters:

iter (Dee.ModelIter) – a Dee.ModelIter

Returns:

True if iter is the first iter in the model

Return type:

bool

Checks if iter is the very first iter self.

do_is_last(iter) virtual
Parameters:

iter (Dee.ModelIter) – a Dee.ModelIter

Returns:

True if iter is the last iter in the model

Return type:

bool

Whether iter is the end iter of self. Note that the end iter points right after the last valid row in self.

do_next(iter) virtual
Parameters:

iter (Dee.ModelIter) – a Dee.ModelIter

Returns:

A Dee.ModelIter, pointing to the next row in the model. The iter is owned by self, do not free it.

Return type:

Dee.ModelIter

Returns a Dee.ModelIter that points to the next position in the model.

do_prepend_row(row_members) virtual
Parameters:

row_members ([GLib.Variant]) – An array of GLib.Variants with type signature matching those of the column schemas of self. If any of the variants have floating references they will be consumed.

Returns:

A Dee.ModelIter pointing to the new row

Return type:

Dee.ModelIter

Like dee_model_prepend() but intended for language bindings or situations where you work with models on a meta level and may not have a priori knowledge of the column schemas of the models. See also dee_model_build_row().

do_prev(iter) virtual
Parameters:

iter (Dee.ModelIter) – a Dee.ModelIter

Returns:

A Dee.ModelIter, pointing to the previous row in the model. The iter is owned by self, do not free it.

Return type:

Dee.ModelIter

Returns a Dee.ModelIter that points to the previous position in the model.

do_register_tag(tag_destroy) virtual
Parameters:

tag_destroy (GLib.DestroyNotify) – Function called when a tagged row is removed from the model. This function will also be called on all tagged rows when the model is finalized.

Returns:

A Dee.ModelTag handle that you can use to set and get tags with

Return type:

Dee.ModelTag

Register a new tag on a Dee.Model. A tag is an extra value attached to a given row on a model. The tags are invisible to all that doesn’t have the tag handle returned by this method. Dee.Model implementations must ensure that Dee.Model.get_tag() is an O(1) operation.

Tags can be very useful in associating some extra data to a row in a model and have that automatically synced when the model changes. If you’re writing a tiled view for a model you might want to tag each row with the tile widget for that row. That way you have very convenient access to the tile widget given any row in the model.

The private nature of tags and the fact that you can store arbitrary pointers and binary data in them also means that they are not serialized if you utilize a model implementation that exposes the Dee.Serializable interface.

do_register_vardict_schema(num_column, schemas) virtual
Parameters:
  • num_column (int) –

  • schemas ({str: str}) – hashtable with keys specifying names of the fields and values defining their schema

Register schema for fields in a model containing column with variant dictionary schema (‘a{sv}’). The keys registered with this function can be later used with dee_model_build_named_row() function, as well as Dee.Model.get_value_by_name(). Note that it is possible to register the same field name for multiple columns, in which case you need to use fully-qualified “column_name::field” name in the calls to dee_model_build_named_row() and Dee.Model.get_field_schema().

do_remove(iter) virtual
Parameters:

iter (Dee.ModelIter) – a Dee.ModelIter pointing to the row to remove

Removes the row at the given position from the model.

do_row_added(iter) virtual
Parameters:

iter (Dee.ModelIter) –

do_row_changed(iter) virtual
Parameters:

iter (Dee.ModelIter) –

do_row_removed(iter) virtual
Parameters:

iter (Dee.ModelIter) –

do_set_column_names_full(column_names) virtual
Parameters:

column_names ([str]) – A list of column names terminated by a None

Set column names used by self. This method must be called exactly once, but only after setting a schema of the model. Note that some constructors will do this for you.

do_set_row(iter, row_members) virtual
Parameters:

Sets all columns in the row iter points to, to those found in row_members. The variants in row_members must match the types defined in the model’s schema.

do_set_schema_full(column_schemas) virtual
Parameters:

column_schemas ([str]) – A list of GLib.Variant type strings terminated by a None

Set the GLib.Variant types and the number of columns used by self. This method must be called exactly once before using self. Note that some constructors will do this for you.

do_set_tag(iter, tag, value) virtual
Parameters:

Set a tag on a row in a model. This function is guaranteed to be O(1). See also Dee.Model.register_tag().

If tag is already set on this row the existing tag value will be destroyed with the GLib.DestroyNotify passed to the Dee.Model.register_tag().

do_set_value(iter, column, value) virtual
Parameters:
  • iter (Dee.ModelIter) – a Dee.ModelIter

  • column (int) – column number to set the value

  • value (GLib.Variant) – New value for cell. If value is a floating reference the model will assume ownership of the variant

Sets the data in column for the row iter points to, to value. The type of value must be convertible to the type of the column.

When this method call completes the model will emit ::row-changed. You can edit the model in place without triggering the change signals by calling dee_model_set_value_silently().

Signal Details

Dee.Model.signals.changeset_finished(model)
Signal Name:

changeset-finished

Flags:

RUN_LAST

Parameters:

model (Dee.Model) – The object which received the signal

Connect to this signal to be notified when a changeset that can contain multiple row additions / changes / removals has been committed to the model.

Dee.Model.signals.changeset_started(model)
Signal Name:

changeset-started

Flags:

RUN_LAST

Parameters:

model (Dee.Model) – The object which received the signal

Connect to this signal to be notified when a changeset that can contain multiple row additions / changes / removals is about to be committed to the model. Note that not all model implementations use the changeset approach and you might still get a row change signal outside of changeset-started and changeset-finished signals. It also isn’t guaranteed that a changeset would always be non-empty.

Dee.Model.signals.row_added(model, iter)
Signal Name:

row-added

Flags:

RUN_LAST

Parameters:

Connect to this signal to be notified when a row is added to self.

Dee.Model.signals.row_changed(model, iter)
Signal Name:

row-changed

Flags:

RUN_LAST

Parameters:

Connect to this signal to be notified when a row is changed.

Dee.Model.signals.row_removed(model, iter)
Signal Name:

row-removed

Flags:

RUN_LAST

Parameters:

Connect to this signal to be notified when a row is removed from self. The row is still valid while the signal is being emitted.