FormDialog#
- class omni.kit.window.popup_dialog.FormDialog(
- 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[FormDialogFieldDef] = None,
- input_width: int = 250,
Bases:
PopupDialogA simple popup dialog with a set of input fields 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 ([FormDialog.FieldDef]) – List of FieldDefs. Default [].
input_width (int) – OBSOLETE.
Note
- FormDialog.FieldDef:
A namedtuple of (name, label, type, default value) for describing the input field, e.g. FormDialog.FieldDef(“name”, “Name: “, omni.ui.StringField, “Bob”).
Methods
__init__([width, parent, message, title, ...])Inherited args from the base class.
destroy()Destructor.
get_field(name)Returns widget corresponding to named field.
get_value(name)Returns value of the named field.
Returns all values in a dict.
Resets all values to their defaults.
show([offset_x, offset_y, parent])Shows this dialog, optionally offset from the parent widget, if any.
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[FormDialogFieldDef] = None,
- input_width: int = 250,
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
FormDialogFieldDef
- destroy()#
Destructor.
- get_field(name: str) AbstractField#
Returns widget corresponding to named field.
- Parameters:
name (str) – Name of the field.
- Returns:
omni.ui.AbstractField
- get_value(name: str) str | int | float | bool#
Returns value of the named field.
- Parameters:
name (str) – Name of the field.
- Returns:
Union[str, int, float, bool]
Note
Doesn’t currently return MultiFields correctly.
- get_values() dict#
Returns all values in a dict.
- Parameters:
name (str) – Name of the field.
- Returns:
dict
Note
Doesn’t currently return MultiFields correctly.
- reset_values()#
Resets all values to their defaults.
- show(
- offset_x: int = 0,
- offset_y: int = 0,
- parent: Widget = None,
Shows this dialog, optionally offset from the parent widget, if any.
- Keyword Arguments:
offset_x (int) – X offset. Default 0.
offset_y (int) – Y offset. Default 0.
parent (ui.Widget) – Offset from this parent widget. Default None.