SearchField#
- class omni.kit.widget.searchfield.SearchField(width: ~omni.ui._ui.Length | None = None, height: ~omni.ui._ui.Length | None = 26.000000px, on_search_fn: ~typing.Callable[[~typing.List[str] | None], None] = None, subscribe_edit_changed: bool = False, show_tokens: bool = True, style: ~typing.Dict = None, suggestions: ~typing.List[str] | None = None, max_suggestions: int = 10, separator=' ')#
Bases:
object
Represents a search field where users can input search words and receive suggestions.
Methods
__init__
([width, height, on_search_fn, ...])Construct a search field.
clear
()clear search words
destroy
()Clean resources.
set_filter
(filter_cls)Set filter.
Attributes
Size of close image
Size of search image
Widget enabled/disabled
Max number of suggestion words appeared
Current words appeared in the search field.
Suggestion words to show when input in search field
Text currently in search field
Widget visibility
- __init__(width: ~omni.ui._ui.Length | None = None, height: ~omni.ui._ui.Length | None = 26.000000px, on_search_fn: ~typing.Callable[[~typing.List[str] | None], None] = None, subscribe_edit_changed: bool = False, show_tokens: bool = True, style: ~typing.Dict = None, suggestions: ~typing.List[str] | None = None, max_suggestions: int = 10, separator=' ')#
Construct a search field.
- Keyword Arguments:
width (Optional[ui.Length]) – Widget width. Default None, means auto.
height (Optional[ui.Length]) – Widget height. Default ui.Pixel(26). Use None for auto.
on_search_fn (Callable[[Optional[List[str]]], None]) – Function called to do searching.
subscribe_edit_changed (bool) – True to retrieve on_search_fn called when input changed. Default False only retrieve on_search_fn called when input ended.
show_tokens (bool) – Default True to show tokens if end edit. Do nothing if False.
style (Dict) – Widget additional style. Default None, means using default style.
suggestions (Optional[List[str]]) – Show suggestion list when input search words. Default None means not supported.
max_suggestions (int) – Max number of suggestions to show at same time.
separator (Optional[str]) – Separator to break the search string into multiple words. None means no separate. Defaults to “ “.
- Properties:
visible (bool): Widget visibility. enabled (bool): Enable/Disable widget. search_words (Optional[List[str]]): Search words. suggestions (Optional[List[str]]): Suggestions. max_suggestions (int): Maximum number of suggestions. text (str): Text in the search field.
- clear()#
clear search words
- destroy()#
Clean resources.
- CLOSE_IMAGE_SIZE = 12#
Size of close image
- SEARCH_IMAGE_SIZE = 16#
Size of search image
- property enabled: bool#
Widget enabled/disabled
- property max_suggestions: int#
Max number of suggestion words appeared
- property search_words: List[str] | None#
Current words appeared in the search field.
- property suggestions: List[str] | None#
Suggestion words to show when input in search field
- property text: str#
Text currently in search field
- property visible: bool#
Widget visibility