SearchModel

class omni.kit.widget.searchable_combobox.search_widget.SearchModel(modified_fn)

Bases: AbstractValueModel

A model to support searching functionality in UI components.

This class provides methods to set and retrieve search strings, and to determine if a given string is part of the current search string. It is designed to be used within UI components that require search capabilities, such as searchable combo boxes or lists.

Parameters

modified_fn (callable) – A function to be called when the search string is modified.

Methods

__init__(modified_fn)

Initializes the SearchModel with a function to call when the model is modified.

get_value_as_string()

Retrieves the current value of the model as a string.

is_in_string(string)

Checks if the model's current string is a substring of the provided string.

set_value(value)

Sets the value of the model and triggers the modified callback if it's provided.

Attributes

__init__(modified_fn)

Initializes the SearchModel with a function to call when the model is modified.

get_value_as_string()

Retrieves the current value of the model as a string.

Returns

The current value of the model.

Return type

str

is_in_string(string: str)

Checks if the model’s current string is a substring of the provided string.

Parameters

string (str) – The string to check against.

Returns

True if the model’s string is a substring of `string`, False otherwise.

Return type

bool

set_value(value)

Sets the value of the model and triggers the modified callback if it’s provided.

Parameters

value – The new value to set for the model.