SearchWidget#

class omni.kit.material.library.SearchWidget(theme: str, icon_path: str, modified_fn: callable = None)#

Bases: object

Simulated searchable combobox class, used by MaterialListBoxWidget.

Methods

__init__(theme, icon_path[, modified_fn])

Initialize class function.

build_ui(width, search_size)

build_ui for search widget.

build_ui_popup(search_size, popup_text, ...)

Build the UI for the listbox part of the widget.

clean()

Clean up widget.

destroy()

Destroy class and cleanup.

focus()

Focus search text.

get_text()

Get material name as string.

set_placeholder_text(msg)

Set material placeholder name from string.

set_text(new_text)

Set material name from string.

update(filter_string)

Update placeholder string and clear button.

__init__(
theme: str,
icon_path: str,
modified_fn: callable = None,
)#

Initialize class function.

Parameters:
  • theme (str) – theme name, should be “NvidiaDark” or “NvidiaLight”. Not wildly supported.

  • icon_path (str) – path to icons, if None then omni.kit.material.library/data/icons will be used.

  • modified_fn (callable) – modified_fn passed to SearchModel.

class WidgetFlags(
value,
names=<not given>,
*values,
module=None,
qualname=None,
type=None,
start=1,
boundary=None,
)#

Bases: IntFlag

build_ui_popup() options

build_ui(width: float, search_size: float)#

build_ui for search widget.

Parameters:
  • width (float) – width of ui.StringField widget.

  • search_size (float) – size of widget

build_ui_popup(
search_size: float,
popup_text: str,
index: int,
update_fn: callable,
widget_flags=<WidgetFlags.SHOW_ALL: 3>,
missing=False,
)#

Build the UI for the listbox part of the widget.

Parameters:
  • search_size (float) – widget size.

  • popup_text (str) – material name selected in combo box.

  • index (int) – default index of material name in combo box.

  • update_fn (callable) – callback called when ui.TextField string is cleared.

  • widget_flags (WidgetFlags) – Can be SHOW_OPEN_BUTTON and/or SHOW_GOTO_BUTTON or None.

  • missing (bool) – Material name is missing, text will be red.

Returns:

(ui.Widget) name field (ui.Widget) open button (ui.Widget) goto button

clean()#

Clean up widget.

destroy()#

Destroy class and cleanup.

focus()#

Focus search text.

get_text()#

Get material name as string.

Returns:

(str) material name.

set_placeholder_text(msg: str)#

Set material placeholder name from string. This is the string displayed when material name is empty.

Parameters:

msg (str) – text to use as placeholder.

set_text(new_text: str)#

Set material name from string.

Parameters:

new_text (str) – New material name

update(filter_string: str)#

Update placeholder string and clear button.

Parameters:

filter_string (str) – current search string.