OmniUIQuery#
- class omni.ui_query.OmniUIQuery#
Bases:
objectA class for querying and retrieving widget information in Omni UI applications.
This class provides class methods that assist in navigating and extracting details from widget hierarchies, including those found in Omni UI windows and containers. It supports operations such as obtaining widget paths, searching for widgets based on path queries, and processing widget tokens with wildcard options. The query system accepts widget path expressions that may include exact names, indices, and attribute predicates to refine search results.
The methods in this class allow users to retrieve single or multiple widget instances by parsing and evaluating structured query strings. This functionality is useful for debugging user interface layouts and for dynamically exploring complex widget trees. The class leverages underlying Omni UI capabilities to iterate over widget children and evaluate widget attributes, making it easier to verify the structure and properties of UI components.
Example usage: .. code-block:: python
query = ‘MainWindow//Frame/Button[0]’ widget = OmniUIQuery.find_widget(query)
Methods
__init__()Initializes the OmniUIQuery instance.
find_first_widget(query[, root_widgets])Find the first widget that matches our query.
find_menu_item(query)TODO: This may now be legacy functionality after https://gitlab-master.nvidia.com/omniverse/kit/-/merge_requests/10402 is merged so need to see if its actually being used on 102 tests etc.
find_widget(query)find a single widget given a full widget path
find_widgets(query[, root_widgets])Find a set of widgets that match our query.
get_widget_children_with_path(widget, path)Given a widget and its path, get all its child widgets with path.
get_widget_path(window, widget)Given a Window and a Widget in that window, get its path.
get_window_widget_paths(window[, ...])Given a window, get all its widgets' paths.
- __init__() None#
Initializes the OmniUIQuery instance.
- classmethod find_first_widget(
- query: str,
- root_widgets=[],
Find the first widget that matches our query.
- Parameters:
query (str) – Query string used to locate the widget.
root_widgets (list) – List of root widgets to begin the search.
- Returns:
The first matching widget if found, else None.
- Return type:
ui.Widget
TODO: This may now be legacy functionality after https://gitlab-master.nvidia.com/omniverse/kit/-/merge_requests/10402 is merged so need to see if its actually being used on 102 tests etc.
- Parameters:
query (str) – Query string to locate the menu item.
- Returns:
Found menu item widget, or None if not found.
- Return type:
Optional[ui.Widget]
- classmethod find_widget(query: str) Widget | None#
find a single widget given a full widget path
- Parameters:
query (str) – Full widget path string.
- Returns:
The widget matching the path, or None if not found.
- Return type:
Union[ui.Widget, None]
- classmethod find_widgets(
- query: str,
- root_widgets=[],
Find a set of widgets that match our query.
- Parameters:
query (str) – Query string used to match widgets.
root_widgets (list) – List of root widgets to begin the search.
- Returns:
List of widgets that match the query.
- Return type:
List[ui.Widget]
- classmethod get_widget_children_with_path(
- widget: Widget,
- path: str,
Given a widget and its path, get all its child widgets with path.
- Parameters:
widget (ui.Widget) – Starting widget to retrieve children.
path (str) – Path for computing child widget paths.
- Returns:
Mapping of child widgets to their paths.
- Return type:
Dict[ui.Widget, str]
- classmethod get_widget_path(
- window: Window,
- widget: Widget,
Given a Window and a Widget in that window, get its path.
- Parameters:
window (ui.Window) – Window instance to extract widget path.
widget (ui.Widget) – Widget instance to compute its path.
- Returns:
Widget path if found, else None.
- Return type:
Union[str, None]
- classmethod get_window_widget_paths(
- window: Window,
- widget_postfix_fn: Callable[[Widget], str] | None = None,
Given a window, get all its widgets’ paths.
- Parameters:
window (ui.Window) – Window from which widget paths are derived.
widget_postfix_fn (Optional[Callable[[ui.Widget], str]]) – Optional function to add postfix to widget name.
- Returns:
List of widget paths for the window.
- Return type:
List[str]