ScriptDialog#
- class ScriptDialog(*args, **kwargs)#
Carries details to be shown in user-facing dialogs.
Methods#
- class ScriptDialog
- close() None#
Close
dialog.When handling a
ScriptDialogasynchronously (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
CONFIRMandBEFORE_UNLOAD_CONFIRMdialogs whenWebView::script-dialog signal is emitted to set whether the user confirmed the dialog or not. The default implementation ofWebView::script-dialog signal setsTruewhen the OK or Stay buttons are clicked andFalseotherwise. It’s an error to use this method with aScriptDialogthat is not of typeCONFIRMorBEFORE_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
ScriptDialogof typePROMPT.It’s an error to use this method with a
ScriptDialogthat 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
PROMPTdialogs 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, otherwiseNoneis set. It’s an error to use this method with aScriptDialogthat is not of typePROMPT.- Parameters:
text – the text to set