omni.kit.widget.path_field
A UI alternative to omni.ui.StringField for smarter path traversal (think filesystem paths).
A UI alternative to omni.ui.StringField for navigating tree views with the keyboard. As the user navigates the tree using TAB, Backspace, and Arrow keys, they are constantly provided branching options via auto-filtered tooltips.
Example:
path_field = PathField(
apply_path_handler=self._apply_path_handler,
branching_options_provider=self._branching_options_provider,
)
- class omni.kit.widget.path_field.PathField(**kwargs)
Main class for the PathField widget. This widget is a UI alternative to omni.ui.StringField for navigating tree views with the keyboard. As the user navigates the tree using TAB, Backspace, and Arrow keys, they are constantly provided branching options via auto-filtered tooltips.
- Parameters
None –
- Keyword Arguments
apply_path_handler (Callable) – This function is called when the user hits Enter on the input field, signaling that they want to apply the path. This handler is expected to update the caller’s app accordingly. Function signature: void apply_path_handler(path: str)
branching_options_handler (Callable) – This function is required to provide a list of possible branches whenever prompted with a path. For example, if path = “C:”, then the list of values produced might be [“Program Files”, “temp”, …, “Users”]. Function signature: list(str) branching_options_provider(path: str, callback: func)
separator (str) – Character used to split a path into list of branches. Default ‘/’.
modal (bool) – Used for modal window. Default False.
begin_edit_handler (callable) – A callback for path string field begin edit. Default None.
- destroy()
Destructor.
- property path: str
Returns the current path as entered in the field box.
- Type
str
- set_path(full_path: str)
Sets the path.
- Parameters
path (str) – The full path name.