OptionsDialog#
- class omni.kit.window.popup_dialog.OptionsDialog(
- width: int = 400,
- parent: Widget = None,
- message: str = None,
- title: str = None,
- ok_handler: Callable[[AbstractDialog], None] = None,
- cancel_handler: Callable[[AbstractDialog], None] = None,
- ok_label: str = 'Ok',
- cancel_label: str = 'Cancel',
- field_defs: List[OptionsDialogFieldDef] = None,
- value_changed_fn: Callable = None,
- radio_group: bool = False,
Bases:
PopupDialogA simple checkbox dialog with a set options and two buttons, OK and Cancel
- Keyword Arguments:
width (int) – Width of popup window. Default 400.
( (parent) – obj:’omni.ui.Widget’):OBSOLETE.
message (str) – Message string.
title (str) – Title of popup window. Default None.
ok_handler (Callable[[AbstractDialog], None]) – Handler called when click ok button. Default None. Function signature is: void ok_handler(AbstractDialog)
cancel_handler (Callable[[AbstractDialog], None]) – Handler called when click cancel button. Default None. Function signature is: void ok_handler(AbstractDialog)
ok_label (str) – Label text for ok button. Default “Ok”.
cancel_label (str) – Label text for cancel button. Default “Cancel”.
field_defs ([OptionsDialog.FieldDef]) – List of FieldDefs. Default [].
value_changed_fn (Callable) – This callback is triggered on any value change.
radio_group (bool) – If True, then only one option can be selected at a time.
Note
- OptionsDialog.FieldDef:
A namedtuple of (name, label, default) for describing the options field, e.g. OptionsDialog.FieldDef(“option”, “Option”, True).
Methods
__init__([width, parent, message, title, ...])Inherited args from the base class.
destroy()Destructor
Returns name of chosen option.
get_value(name)Returns value of the named field.
Returns all values in a dictionary.
Attributes
- __init__(
- width: int = 400,
- parent: Widget = None,
- message: str = None,
- title: str = None,
- ok_handler: Callable[[AbstractDialog], None] = None,
- cancel_handler: Callable[[AbstractDialog], None] = None,
- ok_label: str = 'Ok',
- cancel_label: str = 'Cancel',
- field_defs: List[OptionsDialogFieldDef] = None,
- value_changed_fn: Callable = None,
- radio_group: bool = False,
Inherited args from the base class.
- Keyword Arguments:
width (int) – Window width. Default 400.
title (str) – Title to display. Default None.
ok_handler (Callable) – Function to invoke when Ok button clicked. Function signature: void okay_handler(dialog: PopupDialog)
cancel_handler (Callable) – Function to invoke when Cancel button clicked. Function signature: void cancel_handler(dialog: PopupDialog)
ok_label (str) – Alternative text to display on ‘Accept’ button. Default ‘Ok’.
cancel_label (str) – Alternative text to display on ‘Cancel’ button. Default ‘Cancel’.
warning_message (Optional[str]) – Warning message that will displayed in red with the warning glyph. Default None.
parent (omni.ui.Widget) – OBSOLETE.
- FieldDef#
alias of
OptionsDialogFieldDef
- destroy()#
Destructor
- get_choice() str#
Returns name of chosen option.
- Returns:
str
- get_value(name: str) bool#
Returns value of the named field.
- Parameters:
name (str) – Name of the field.
- Returns:
bool
- get_values() Dict#
Returns all values in a dictionary.
- Returns:
Dict