omni.kit.window.preferences
Preferences Window
- class omni.kit.window.preferences.IntFlag(value)
Support for integer-based Flags
- class omni.kit.window.preferences.PreferenceBuilder(title)
- WINDOW_NAME = 'Preferences'
- 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 theomni.kit.commands
module, usingChangeSettingCommand
.- 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
orlist
. Fordict
keys are UI displayed names, values are actual values set into settings. If it is alist
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.
- spacer() 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)
- 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: 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: Union[int, str]) 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.PreferencesExtension
-
- hide_preferences_window()
Hide the Preferences window from the User.
- on_shutdown()
- on_startup(ext_id)
- rebuild_pages()
- select_page(page)
- show_preferences_window()
Show the Preferences window to the User.
- class omni.kit.window.preferences.SettingType
Supported setting types
- BOOL = 3
- COLOR3 = 2
- DOUBLE2 = 7
- DOUBLE3 = 5
- FLOAT = 0
- INT = 1
- INT2 = 6
- STRING = 4
- omni.kit.window.preferences.deregister_actions(extension_id)
- 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_actions(extension_id, cls, get_self_fn)
- omni.kit.window.preferences.register_page(page)
- omni.kit.window.preferences.select_page(page)
- omni.kit.window.preferences.show_file_importer(title: str, file_exts: list = [('All Files(*)', '')], filename_url: Optional[str] = None, click_apply_fn: Optional[Callable] = None, show_only_folders: bool = False)
- omni.kit.window.preferences.show_preferences_window()
Show the Preferences window to the User.
- omni.kit.window.preferences.unregister_page(page, rebuild: bool = True)