Workspace

class omni.ui.Workspace

Bases: pybind11_object

Workspace object provides access to the windows in Kit.

Methods

__init__(*args, **kwargs)

clear()

Undock all.

compare_workspace([compare_delegate])

Compare current docked windows according to the workspace description.

dump_workspace()

Capture current workspace and return the dict with the description of the docking state and window size.

get_dock_children_id(dock_id)

Get two dock children of the given dock ID.

get_dock_id_height(dock_id)

Returns the height of the docking node.

get_dock_id_width(dock_id)

Returns the width of the docking node.

get_dock_position(dock_id)

Returns the position of the given dock ID.

get_docked_neighbours(member)

Get all the windows that docked with the given widow.

get_docked_windows(dock_id)

Get all the windows of the given dock ID.

get_dpi_scale()

Returns current DPI Scale.

get_main_window_height()

Get the height in points of the current main window.

get_main_window_width()

Get the width in points of the current main window.

get_parent_dock_id(dock_id)

Return the parent Dock Node ID.

get_selected_window_index(dock_id)

Get currently selected window inedx from the given dock id.

get_window(title)

Find Window by name.

get_window_from_callback(callback)

Find Window by window callback.

get_windows()

Returns the list of windows ordered from back to front.

remove_window_visibility_changed_callback(fn)

Remove the callback that is triggered when window's visibility changed.

restore_workspace([keep_windows_open])

Dock the windows according to the workspace description.

set_dock_id_height(dock_id, height)

Set the height of the dock node.

set_dock_id_width(dock_id, width)

Set the width of the dock node.

set_show_window_fn(title, fn)

Add the callback to create a window with the given title.

set_window_created_callback(fn)

Addd the callback that is triggered when a new window is created.

set_window_visibility_changed_callback(fn)

Add the callback that is triggered when window's visibility changed.

show_window(title[, show])

Makes the window visible or create the window with the callback provided with set_show_window_fn.

__init__(*args, **kwargs)
static clear() None

Undock all.

compare_workspace(compare_delegate: ~omni.ui.workspace_utils.CompareDelegate = <omni.ui.workspace_utils.CompareDelegate object>)

Compare current docked windows according to the workspace description.

### Arguments

`workspace_dumpList[Any]`

The dictionary with the description of the layout. It’s the dict received from `dump_workspace`.

dump_workspace()

Capture current workspace and return the dict with the description of the docking state and window size.

static get_dock_children_id(dock_id: int) object

Get two dock children of the given dock ID. true if the given dock ID has children

### Arguments:

`dockId :`

the given dock ID

`first :`

output. the first child dock ID

`second :`

output. the second child dock ID

static get_dock_id_height(dock_id: int) float

Returns the height of the docking node. It’s different from the window height because it considers dock tab bar.

### Arguments:

`dockId :`

the given dock ID

static get_dock_id_width(dock_id: int) float

Returns the width of the docking node.

### Arguments:

`dockId :`

the given dock ID

static get_dock_position(dock_id: int) omni.ui._ui.DockPosition

Returns the position of the given dock ID. Left/Right/Top/Bottom.

static get_docked_neighbours(member: omni.ui._ui.WindowHandle) List[omni.ui._ui.WindowHandle]

Get all the windows that docked with the given widow.

static get_docked_windows(dock_id: int) List[omni.ui._ui.WindowHandle]

Get all the windows of the given dock ID.

static get_dpi_scale() float

Returns current DPI Scale.

static get_main_window_height() float

Get the height in points of the current main window.

static get_main_window_width() float

Get the width in points of the current main window.

static get_parent_dock_id(dock_id: int) int

Return the parent Dock Node ID.

### Arguments:

`dockId :`

the child Dock Node ID to get parent

static get_selected_window_index(dock_id: int) int

Get currently selected window inedx from the given dock id.

static get_window(title: str) omni.ui._ui.WindowHandle

Find Window by name.

static get_window_from_callback(callback: omni::ui::windowmanager::IWindowCallback) omni.ui._ui.WindowHandle

Find Window by window callback.

static get_windows() List[omni.ui._ui.WindowHandle]

Returns the list of windows ordered from back to front. If the window is a Omni::UI window, it can be upcasted.

static remove_window_visibility_changed_callback(fn: int) None

Remove the callback that is triggered when window’s visibility changed.

restore_workspace(keep_windows_open=False)

Dock the windows according to the workspace description.

### Arguments

`workspace_dumpList[Any]`

The dictionary with the description of the layout. It’s the dict received from `dump_workspace`.

`keep_windows_openbool`

Determines if it’s necessary to hide the already opened windows that are not present in `workspace_dump`.

static set_dock_id_height(dock_id: int, height: float) None

Set the height of the dock node. It also sets the height of parent nodes if necessary and modifies the height of siblings.

### Arguments:

`dockId :`

the given dock ID

`height :`

the given height

static set_dock_id_width(dock_id: int, width: float) None

Set the width of the dock node. It also sets the width of parent nodes if necessary and modifies the width of siblings.

### Arguments:

`dockId :`

the given dock ID

`width :`

the given width

static set_show_window_fn(title: str, fn: Callable[[bool], None]) None

Add the callback to create a window with the given title. When the callback’s argument is true, it’s necessary to create the window. Otherwise remove.

static set_window_created_callback(fn: Callable[[omni.ui._ui.WindowHandle], None]) None

Addd the callback that is triggered when a new window is created.

static set_window_visibility_changed_callback(fn: Callable[[str, bool], None]) int

Add the callback that is triggered when window’s visibility changed.

static show_window(title: str, show: bool = True) bool

Makes the window visible or create the window with the callback provided with set_show_window_fn. true if the window is already created, otherwise it’s necessary to wait one frame

### Arguments:

`title :`

the given window title

`show :`

true to show, false to hide