Callbacks

CollatorFunc (input, *data)

CompareRowFunc (row1, row2, *user_data)

CompareRowSizedFunc (row1, row2, *user_data)

FilterMapFunc (orig_model, filter_model, *user_data)

FilterMapNotify (orig_model, orig_iter, filter_model, *user_data)

IndexIterFunc (key, rows, *userdata)

ModelReaderFunc (model, iter, *userdata)

SerializableParseFunc (data)

TermFilterFunc (terms_in, terms_out, *filter_data)

Details

Dee.CollatorFunc(input, *data)
Parameters:
  • input (str) – The string to produce a collation key for

  • data (object or None) – User data set when registering the collator

Returns:

The collation key. Free with GLib.free() when done using it.

Return type:

str

A collator takes an input string, most often a term produced from a Dee.Analyzer, and outputs a collation key.

Dee.CompareRowFunc(row1, row2, *user_data)
Parameters:
  • row1 ([GLib.Variant]) – The model being indexed

  • row2 ([GLib.Variant]) – The row to extract terms for

  • user_data (object or None) – User data to pass to comparison function

Returns:

-1, 0, or 1 if row1 is respectively less than, equal, or greater than row2.

Return type:

int

Compares row1 and row2. Mainly used with dee_model_insert_sorted() and dee_model_find_sorted().

Dee.CompareRowSizedFunc(row1, row2, *user_data)
Parameters:
Returns:

-1, 0, or 1 if row1 is respectively less than, equal, or greater than row2.

Return type:

int

Compares row1 and row2. Mainly used with Dee.Model.insert_row_sorted_with_sizes() and Dee.Model.find_row_sorted_with_sizes().

Dee.FilterMapFunc(orig_model, filter_model, *user_data)
Parameters:
  • orig_model (Dee.Model) – The model containing the original data to filter

  • filter_model (Dee.FilterModel) – The model that will contain the filtered results. The filter func must iterate over orig_model and add all relevant rows to filter_model. This model is guaranteed to be empty when the filter func is invoked

  • user_data (object or None) – User data passed together with the filter func

Function used to collect the rows from a model that should be included in a Dee.FilterModel. To add rows to filter_model use the methods Dee.FilterModel.append_iter(), Dee.FilterModel.prepend_iter(), Dee.FilterModel.insert_iter(), and Dee.FilterModel.insert_iter_before().

The iteration over the original model is purposely left to the map func in order to allow optimized iterations if the the caller has a priori knowledge of the sorting and grouping of the data in the original model.

Dee.FilterMapNotify(orig_model, orig_iter, filter_model, *user_data)
Parameters:
Returns:

True if orig_iter was added to filter_model

Return type:

bool

Callback invoked when a row is added to orig_model. To add rows to filter_model use the methods Dee.FilterModel.append_iter(), Dee.FilterModel.prepend_iter(), Dee.FilterModel.insert_iter(), and Dee.FilterModel.insert_iter_before().

Dee.IndexIterFunc(key, rows, *userdata)
Parameters:
Returns:

False if iteration should stop, True if it should continue

Return type:

bool

The signature of the function passed to Dee.Index.foreach().

Be cautious if you plan on modifying the rows in the model via the Dee.ModelIter s you find. Your code may have to be reentrant since the index may change in reaction to the changes in the model. It’s not impossible to do this in a non-broken manner, but it may likely require you calling dee_model_freeze_signals() and dee_model_thaw_signals() at strategic points.

Dee.ModelReaderFunc(model, iter, *userdata)
Parameters:
  • model (Dee.Model) – The model being indexed

  • iter (Dee.ModelIter) – The row to extract terms for

  • userdata (object or None) – The data set when registering the reader

Returns:

A newly allocated string with the row data to be indexed. Free with GLib.free().

Return type:

str

Extracts a string from a row in a model.

Dee.SerializableParseFunc(data)
Parameters:

data (GLib.Variant) – A GLib.Variant with type signature as passed to dee_serializable_register_parser() when the parser was registered. The variant is not referenced.

Returns:

A newly constructed GObject.Object of the GObject.GType used when registering the parser. Note that since the environment guarantees that the input data is valid according to the registration information this function can not fail. Thus None is not a valid return value.

Return type:

GObject.Object

Dee.TermFilterFunc(terms_in, terms_out, *filter_data)
Parameters:

A term filter takes a list of terms and runs it through a filtering and/or set of transformations and stores the output in a Dee.TermList.

You can register term filters on a Dee.Analyzer with Dee.Analyzer.add_term_filter().