PropertyWindow
- class omni.kit.window.property.window.PropertyWindow(window_kwargs=None, properties_frame_kwargs=None)
Bases:
object
Property Window framework.
Methods
__init__
([window_kwargs, ...])Create a PropertyWindow.
destroy
()Destroy function.
Gets the current scheme being displayed in Property Window.
notify
(scheme, payload)Notify Property Window of a scheme and/or payload change.
register_scheme_delegate
(scheme, name, delegate)Register a PropertySchemeDelegate for a given scheme.
register_widget
(scheme, name, property_widget)Registers a PropertyWidget to PropertyWindow.
Requests the entire property window to be rebuilt.
reset_scheme_delegate_layout
(scheme)Reset the order so PropertySchemeDelegate will be processed in the order of registration when building UI.
Restore scroll position from previous position.
save_scroll_pos
([reset])Save scroll position to previous position.
set_scheme_delegate_layout
(scheme, layout)Register a list of PropertySchemeDelegate's names to finalize the order and visibility of all registered PropertySchemeDelegate.
set_visibility_changed_listener
(listener)Adds callback function for when window visibility is changed.
set_visible
(visible)Set window visibility state.
unregister_scheme_delegate
(scheme, name)Unregister a PropertySchemeDelegate from PropertyWindow by name.
unregister_widget
(scheme, name[, top_stack])Unregister a PropertyWidget from PropertyWindow.
Attributes
Gets if property window refresh is paused.
Gets the ui.ScrollingFrame container of PropertyWidgets
- __init__(window_kwargs=None, properties_frame_kwargs=None)
Create a PropertyWindow.
- Parameters
window_kwargs (dict) – Additional kwargs to pass to ui.Window.
properties_frame_kwargs (dict) – Additional kwargs to pass to ui.ScrollingFrame.
- destroy()
Destroy function. Class cleanup function
- get_scheme()
Gets the current scheme being displayed in Property Window.
- notify(scheme: str, payload: Any)
Notify Property Window of a scheme and/or payload change. This is the function to trigger refresh of PropertyWindow.
- Parameters
scheme (str) – Scheme of this notification.
payload – Payload to refresh the widgets.
- register_scheme_delegate(scheme: str, name: str, delegate: PropertySchemeDelegate)
Register a PropertySchemeDelegate for a given scheme. A PropertySchemeDelegate tests the payload and determines what widgets to be drawn in what order. A scheme can have multiple PropertySchemeDelegate and their result will be merged to display all relevant widgets.
PropertySchemeDelegate does not hide widgets that are not returned from its get_widgets function. If you want to hide certain widget, return them in PropertySchemeDelegate.get_unwanted_widgets. See PropertySchemeDelegate’s documentation for details.
- Parameters
scheme (str) – Scheme of the PropertySchemeDelegate to be added to.
name (str) – A unique name to identify the PropertySchemeDelegate under. Delegate with existing name will be overridden.
delegate (PropertySchemeDelegate) – A PropertySchemeDelegate instance to be added.
- register_widget(scheme: str, name: str, property_widget: PropertyWidget, top_stack: bool = True)
Registers a PropertyWidget to PropertyWindow.
- Parameters
scheme (str) – Scheme of the PropertyWidget will work with.
name (str) – A unique name to identify the PropertyWidget under. Widget with existing name will be overridden.
property_widget (property_widget.PropertyWidget) – A PropertyWidget instance to be added.
top_stack (bool) – Widgets are managed in double stack: True to register the widget to “Top” stack which layouts widgets from top to bottom. False to register the widget to “Button” stack which layouts widgets from bottom to top and always below the “Top” stack.
- request_rebuild()
Requests the entire property window to be rebuilt.
- reset_scheme_delegate_layout(scheme: str)
Reset the order so PropertySchemeDelegate will be processed in the order of registration when building UI.
- Parameters
scheme (str) – Scheme of the PropertySchemeDelegate order to be removed from.
- restore_scroll_pos()
Restore scroll position from previous position. Used when trying to keep scroll position when selecting attributes of same type.
- save_scroll_pos(reset=False)
Save scroll position to previous position. Used when trying to keep scroll position when selecting attributes of same type.
- Parameters
reset (bool) – If True clear old scroll position.
- set_scheme_delegate_layout(scheme: str, layout: List[str])
Register a list of PropertySchemeDelegate’s names to finalize the order and visibility of all registered PropertySchemeDelegate. Useful if you need a fixed layout of Property Widgets for your Kit experience.
- Remark:
If you’re a Property Widget writer, DO NOT call this function. It should only be called by Kit Experience to tune the final look and layout of the Property Window.
- Parameters
scheme (str) – Scheme of the PropertySchemeDelegate order to be added to.
layout (List(str)) – a list of PropertySchemeDelegate’s name, in the order of being processed when building UI. Scheme delegate not in this will be skipped.
- set_visibility_changed_listener(listener: callable)
Adds callback function for when window visibility is changed.
- Parameters
listener (callable) – visibility changed callback.
- set_visible(visible: bool)
Set window visibility state.
- Parameters
visible (bool) – Visible state of the window.
- unregister_scheme_delegate(scheme: str, name: str)
Unregister a PropertySchemeDelegate from PropertyWindow by name.
- Parameters
scheme (str) – Scheme of the PropertySchemeDelegate to be removed from.
name (str) – The name to find the PropertySchemeDelegate and remove.
- unregister_widget(scheme: str, name: str, top_stack: bool = True)
Unregister a PropertyWidget from PropertyWindow.
- Parameters
scheme (str) – Scheme of the PropertyWidget to be removed from.
name (str) – The name to find the PropertyWidget and remove.
top_stack (bool) – see @register_widget
- property paused
Gets if property window refresh is paused.
- property properties_frame
Gets the ui.ScrollingFrame container of PropertyWidgets