Alert¶
Enables showing modal alerts.
- class Alert(title: str, subtitle: str, window_id: Optional[str] = None)¶
A modal alert.
- Parameters
title – The title, shown in bold at the top.
subtitle – The informative text, which may be more than one line long.
window_id – The window to attach the alert to. If None, it will be application modal.
See also
Example “One-Shot Alert”
- async async_run(connection: iterm2.connection.Connection) → int¶
Shows the modal alert.
- Return type
int
- Parameters
connection (
Connection
) – The connection to use.- Returns
The index of the selected button, plus 1000. If no buttons were defined then a single button, “OK”, is automatically added.
- Throws
RPCException
if something goes wrong.
- property subtitle: str¶
Returns the subtitle string
- property title: str¶
Returns the title string
- class TextInputAlert(title: str, subtitle: str, placeholder: str, default_value: str, window_id: Optional[str] = None)¶
A modal alert with a text input accessory.
- Parameters
title – The title, shown in bold at the top.
subtitle – The informative text, which may be more than one line long.
placeholder – Grayed-out text to show in the text field when it is empty.
default_value – Default text to place in the text field.
window_id – Window ID to attach to, or None to make app-modal.
- async async_run(connection: iterm2.connection.Connection) → Optional[str]¶
Shows the modal alert.
- Parameters
connection (
Connection
) – The connection to use.- Returns
The string entered, or None if the alert was canceled.
- Throws
RPCException
if something goes wrong.
- property default_value: str¶
Returns the default value.
- property placeholder: str¶
Returns the placeholder string
- property subtitle: str¶
Returns the subtitle string
- property title: str¶
Returns the title string
- property window_id: Optional[str]¶
Returns the window ID