ScriptDialog#
- class ScriptDialog(*args, **kwargs)#
Carries details to be shown in user-facing dialogs.
Methods#
- class ScriptDialog
- close() None #
Close
dialog
.When handling a
ScriptDialog
asynchronously (ref()
was called inWebView
::script-dialog callback), this function needs to be called to notify that we are done with the script dialog. The dialog will be closed on destruction if this function hasn’t been called before.Added in version 2.24.
- confirm_set_confirmed(confirmed: bool) None #
Set whether the user confirmed the dialog.
This method is used for
CONFIRM
andBEFORE_UNLOAD_CONFIRM
dialogs whenWebView
::script-dialog signal is emitted to set whether the user confirmed the dialog or not. The default implementation ofWebView
::script-dialog signal setsTrue
when the OK or Stay buttons are clicked andFalse
otherwise. It’s an error to use this method with aScriptDialog
that is not of typeCONFIRM
orBEFORE_UNLOAD_CONFIRM
- Parameters:
confirmed – whether user confirmed the dialog
- get_dialog_type() ScriptDialogType #
Get the dialog type of a
ScriptDialog
.
- get_message() str #
Get the message of a
ScriptDialog
.
- prompt_get_default_text() str #
Get the default text of a
ScriptDialog
of typePROMPT
.It’s an error to use this method with a
ScriptDialog
that is not of typePROMPT
.
- prompt_set_text(text: str) None #
Set the text entered by the user in the dialog.
This method is used for
PROMPT
dialogs whenWebView
::script-dialog signal is emitted to set the text entered by the user. The default implementation ofWebView
::script-dialog signal sets the text of the entry form when OK button is clicked, otherwiseNone
is set. It’s an error to use this method with aScriptDialog
that is not of typePROMPT
.- Parameters:
text – the text to set