omni.kit.window.preferences

Preferences Window

class omni.kit.window.preferences.PreferenceBuilder(title)

Bases: object

add_frame(name: str) → omni.ui._ui.CollapsableFrame

Create a UI collapsable frame.

Parameters

name – Name to be in frame

Returns

ui.Widget connected with the setting on the path specified.

cleanup_slashes(path: str, is_directory: bool = False)str

Makes path/slashes uniform

Parameters
  • path – path

  • is path a directory (is_directory) –

  • final slash can be added (so) –

Returns

path

create_setting_widget(label_name: str, setting_path: str, setting_type: omni.kit.widget.settings.settings_widget.SettingType, **kwargs) → omni.ui._ui.Widget

Create a UI widget connected with a setting.

If range_from >= range_to there is no limit. Undo/redo operations are also supported, because changing setting goes through the omni.kit.commands module, using ChangeSettingCommand.

Parameters
  • setting_path – Path to the setting to show and edit.

  • setting_type – Type of the setting to expect.

  • range_from – Limit setting value lower bound.

  • range_to – Limit setting value upper bound.

Returns

ui.Widget connected with the setting on the path specified.

create_setting_widget_combo(name: str, setting_path: str, list: List[str], **kwargs) → omni.ui._ui.Widget

Creating a Combo Setting widget.

This function creates a combo box that shows a provided list of names and it is connected with setting by path specified. Underlying setting values are used from values of items dict.

Parameters
  • setting_path – Path to the setting to show and edit.

  • items – Can be either dict or list. For dict keys are UI displayed names, values are actual values set into settings. If it is a list UI displayed names are equal to setting values.

  • setting_is_index – True - setting_path value is index into items list False - setting_path value is string in items list (default)

get_title()str

Gets the page title

Parameters

None

Returns

str name of the page

label(name: str)None

Create a UI widget label.

Parameters

name – Name to be in label

Returns

ui.Widget connected with the setting on the path specified.

spacer() → omni.ui._ui.Spacer

Create a UI spacer.

Parameters

None

Returns

ui.Widget connected with the setting on the path specified.

class omni.kit.window.preferences.PreferenceBuilderUI(visibility_changed_fn: Callable)

Bases: object

create_window()

Create omni.ui.window

Parameters

None

Returns

None

destroy()
hide_window()None

hide window

Parameters

None

Returns

None

rebuild_pages()None

Rebuilds window pages using current page list

Parameters

None

Returns

None

select_page(page: omni.kit.window.preferences.scripts.preference_builder.PreferenceBuilder)bool

If found, display the given Preference page and select its title in the TreeView.

Parameters

page – One of the page from the list of pages.

Returns

A flag indicating if the given page was successfully selected.

Return type

bool

set_active_page(page_index: int)None

Set the given page index as the active one.

Parameters

page_index – Index of page of the page list to set as the active one.

Returns

None

show_window()None

show window

Parameters

None

Returns

None

update_page_list(page_list: List)None

Updates page list

Parameters

page_list – list of pages

Returns

None

class omni.kit.window.preferences.PreferencePage(title)

Bases: object

get_title()
class omni.kit.window.preferences.PreferencePageUI(visibility_changed_fn)

Bases: object

create_window()

Create omni.kit.ui.window

Parameters

None

Returns

None

destroy()
hide_window()

hide window

Parameters

None

Returns

None

rebuild_pages()

Rebuilds window pages using current page list

Parameters

None

Returns

None

select_page(page)

sets actve page on current page list

Parameters

page – page in page list

Returns

None

set_active_page(page)

sets actve page on current page list

Parameters

page – page in page list

Returns

None

show_window()

show window. Only show if needed

Parameters

None

Returns

None

update_page_list(page_list)

Updates page list

Parameters

page_list – list of pages

Returns

None

class omni.kit.window.preferences.PreferencesExtension(self: omni.ext._extensions.IExt)None

Bases: omni.ext._extensions.IExt

hide_preferences_window()

Hide the Preferences window from the User.

on_shutdown()
on_startup()
rebuild_pages()
select_page(page)
show_preferences_window()

Show the Preferences window to the User.

class omni.kit.window.preferences.SettingType

Bases: object

Supported setting types

BOOL = 3
COLOR3 = 2
DOUBLE2 = 7
DOUBLE3 = 5
FLOAT = 0
INT = 1
INT2 = 6
STRING = 4
omni.kit.window.preferences.create_filepicker(title: str, filters: list = ['All Files (*)'], click_apply_fn: Optional[Callable] = None, error_fn: Optional[Callable] = None)
omni.kit.window.preferences.get_instance()
omni.kit.window.preferences.get_page_list()
omni.kit.window.preferences.hide_preferences_window()

Hide the Preferences window from the User.

omni.kit.window.preferences.rebuild_pages()
omni.kit.window.preferences.register_page(page)
omni.kit.window.preferences.select_page(page)
omni.kit.window.preferences.show_preferences_window()

Show the Preferences window to the User.

omni.kit.window.preferences.unregister_page(page)