SystemPrompt
Superclasses: Object
Implemented Interfaces: Prompt
, AsyncInitable
, Initable
A Prompt
implementation which calls to the system prompter to
display prompts in a system modal fashion.
Since the system prompter usually only displays one prompt at a time, you
may have to wait for the prompt to be displayed. Use open
or a related function to open a prompt. Since this can take a long time, you
should always check that the prompt is still needed after it is opened. A
previous prompt may have already provided the information needed and you
may no longer need to prompt.
Use close
to close the prompt when you’re done with it.
Methods
- class SystemPrompt
- close(cancellable: Cancellable | None = None) bool
Close this prompt. After calling this function, no further prompts will succeed on this object. The prompt object is not unreferenced by this function, and you must unreference it once done.
This call may block, use the
close_async()
to perform this action indefinitely.Whether or not this function returns
True
, the system prompt object is still closed and may not be further used.- Parameters:
cancellable – an optional cancellation object
- close_async(cancellable: Cancellable | None = None, callback: Callable[[...], None] | None = None, *user_data: Any) None
Close this prompt asynchronously. After calling this function, no further methods may be called on this object. The prompt object is not unreferenced by this function, and you must unreference it once done.
This call returns immediately and completes asynchronously.
- Parameters:
cancellable – an optional cancellation object
callback – called when the operation completes
user_data – data to pass to the callback
- close_finish(result: AsyncResult) bool
Complete operation to close this prompt.
Whether or not this function returns
True
, the system prompt object is still closed and may not be further used.- Parameters:
result – asynchronous operation result
- get_secret_exchange() SecretExchange
Get the current
SecretExchange
used to transfer secrets in this prompt.
- open(timeout_seconds: int, cancellable: Cancellable | None = None) SystemPrompt
Opens a system prompt with the default prompter.
Most system prompters only allow showing one prompt at a time, and if another prompt is shown then this method will block for up to
timeout_seconds
seconds. Iftimeout_seconds
is equal to -1, then this will block indefinitely until the prompt can be opened. Iftimeout_seconds
expires, then this function will fail with aSYSTEM_PROMPT_IN_PROGRESS
error.- Parameters:
timeout_seconds – the number of seconds to wait to access the prompt, or -1
cancellable – optional cancellation object
- open_async(timeout_seconds: int, cancellable: Cancellable | None = None, callback: Callable[[...], None] | None = None, *user_data: Any) None
Asynchronously open a system prompt with the default system prompter.
Most system prompters only allow showing one prompt at a time, and if another prompt is shown then this method will block for up to
timeout_seconds
seconds. Iftimeout_seconds
is equal to -1, then this will block indefinitely until the prompt can be opened. Iftimeout_seconds
expires, then this operation will fail with aSYSTEM_PROMPT_IN_PROGRESS
error.- Parameters:
timeout_seconds – the number of seconds to wait to access the prompt, or -1
cancellable – optional cancellation object
callback – called when the operation completes
user_data – data to pass the callback
- open_finish(result: AsyncResult) SystemPrompt
Complete an operation to asynchronously open a system prompt.
- Parameters:
result – the asynchronous result
- open_for_prompter(prompter_name: str | None, timeout_seconds: int, cancellable: Cancellable | None = None) SystemPrompt
Opens a system prompt. If prompter_name is
None
, then the default system prompter is used.Most system prompters only allow showing one prompt at a time, and if another prompt is shown then this method will block for up to
timeout_seconds
seconds. Iftimeout_seconds
is equal to -1, then this will block indefinitely until the prompt can be opened. Iftimeout_seconds
expires, then this function will fail with aSYSTEM_PROMPT_IN_PROGRESS
error.- Parameters:
prompter_name – the prompter dbus name
timeout_seconds – the number of seconds to wait to access the prompt, or -1
cancellable – optional cancellation object
- open_for_prompter_async(prompter_name: str | None, timeout_seconds: int, cancellable: Cancellable | None = None, callback: Callable[[...], None] | None = None, *user_data: Any) None
Opens a system prompt asynchronously. If prompter_name is
None
, then the default system prompter is used.Most system prompters only allow showing one prompt at a time, and if another prompt is shown then this method will block for up to
timeout_seconds
seconds. Iftimeout_seconds
is equal to -1, then this will block indefinitely until the prompt can be opened. Iftimeout_seconds
expires, then this operation will fail with aSYSTEM_PROMPT_IN_PROGRESS
error.- Parameters:
prompter_name – the prompter D-Bus name
timeout_seconds – the number of seconds to wait to access the prompt, or -1
cancellable – optional cancellation object
callback – called when the operation completes
user_data – data to pass the callback
Properties
- class SystemPrompt
- props.bus_name: str
The DBus bus name of the prompter to use for prompting, or
None
for the default prompter.
- props.secret_exchange: SecretExchange
The
SecretExchange
to use when transferring passwords. A default secret exchange will be used if this is not set.