PreferenceBuilder

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

Bases: object

Page building class

Methods

__init__(title)

add_frame(name)

Create a UI collapsable frame.

cleanup_slashes(path[, is_directory])

Makes path/slashes uniform

create_setting_widget(label_name, ...)

Create a UI widget connected with a setting.

create_setting_widget_combo(name, ...[, ...])

Creating a Combo Setting widget.

get_title()

Gets the page title

label(name[, tooltip])

Create a UI widget label.

show_page()

Page is visible.

spacer()

Create a UI spacer.

Attributes

WINDOW_NAME

__init__(title)
add_frame(name: str) 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

  • directory (is_directory is path a) –

  • added (so final slash can be) –

Returns

path

create_setting_widget(label_name: str, setting_path: str, setting_type: SettingType, **kwargs) 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 :class:`.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], setting_is_index=False, **kwargs) 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 :py:obj:`list`. For :py:obj:`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, tooltip: Optional[str] = None)

Create a UI widget label.

Parameters
  • name – Name to be in label

  • tooltip – The Tooltip string to be displayed when mouse hovers on the label

Returns

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

show_page() bool

Page is visible. Function can be overridden in subclasses to hide pages.

Returns

True or False

spacer() Spacer

Create a UI spacer.

Parameters

None

Returns

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