Gcr.SystemPrompt¶
- Subclasses:
None
Methods¶
- Inherited:
GObject.Object (37), Gcr.Prompt (31), Gio.AsyncInitable (4), Gio.Initable (2)
- Structs:
class |
|
class |
|
class |
|
class |
|
class |
|
class |
|
|
|
|
|
|
|
Virtual Methods¶
Properties¶
- Inherited:
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r/w/co |
Prompter bus name |
||
r/w |
Secret exchange for passing passwords |
||
w/co |
Timeout (in seconds) for opening prompt |
Signals¶
- Inherited:
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
parent |
r |
Class Details¶
- class Gcr.SystemPrompt(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
A [iface`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 [func`SystemPrompt`.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 [method`SystemPrompt`.close] to close the prompt when you’re done with it.
- classmethod open(timeout_seconds, cancellable)[source]¶
- Parameters:
timeout_seconds (
int
) – the number of seconds to wait to access the prompt, or -1cancellable (
Gio.Cancellable
orNone
) – optional cancellation object
- Raises:
- Returns:
the prompt, or
None
if prompt could not be opened- Return type:
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. If timeout_seconds is equal to -1, then this will block indefinitely until the prompt can be opened. If timeout_seconds expires, then this function will fail with a
Gcr.SystemPromptError.SYSTEM_PROMPT_IN_PROGRESS
error.
- classmethod open_async(timeout_seconds, cancellable, callback, *user_data)[source]¶
- Parameters:
timeout_seconds (
int
) – the number of seconds to wait to access the prompt, or -1cancellable (
Gio.Cancellable
orNone
) – optional cancellation objectcallback (
Gio.AsyncReadyCallback
orNone
) – called when the operation completes
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. If timeout_seconds is equal to -1, then this will block indefinitely until the prompt can be opened. If timeout_seconds expires, then this operation will fail with a
Gcr.SystemPromptError.SYSTEM_PROMPT_IN_PROGRESS
error.
- classmethod open_finish(result)[source]¶
- Parameters:
result (
Gio.AsyncResult
) – the asynchronous result- Raises:
- Returns:
the prompt, or
None
if prompt could not be opened- Return type:
Complete an operation to asynchronously open a system prompt.
- classmethod open_for_prompter(prompter_name, timeout_seconds, cancellable)[source]¶
- Parameters:
timeout_seconds (
int
) – the number of seconds to wait to access the prompt, or -1cancellable (
Gio.Cancellable
orNone
) – optional cancellation object
- Raises:
- Returns:
the prompt, or
None
if prompt could not be opened- Return type:
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. If timeout_seconds is equal to -1, then this will block indefinitely until the prompt can be opened. If timeout_seconds expires, then this function will fail with a
Gcr.SystemPromptError.SYSTEM_PROMPT_IN_PROGRESS
error.
- classmethod open_for_prompter_async(prompter_name, timeout_seconds, cancellable, callback, *user_data)[source]¶
- Parameters:
timeout_seconds (
int
) – the number of seconds to wait to access the prompt, or -1cancellable (
Gio.Cancellable
orNone
) – optional cancellation objectcallback (
Gio.AsyncReadyCallback
orNone
) – called when the operation completes
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. If timeout_seconds is equal to -1, then this will block indefinitely until the prompt can be opened. If timeout_seconds expires, then this operation will fail with a
Gcr.SystemPromptError.SYSTEM_PROMPT_IN_PROGRESS
error.
- close(cancellable)[source]¶
- Parameters:
cancellable (
Gio.Cancellable
orNone
) – an optional cancellation object- Raises:
- Returns:
whether close was cleanly completed
- Return type:
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
Gcr.SystemPrompt.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.
- close_async(cancellable, callback, *user_data)[source]¶
- Parameters:
cancellable (
Gio.Cancellable
orNone
) – an optional cancellation objectcallback (
Gio.AsyncReadyCallback
orNone
) – called when the operation completes
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.
- close_finish(result)[source]¶
- Parameters:
result (
Gio.AsyncResult
) – asynchronous operation result- Raises:
- Returns:
whether close was cleanly completed
- Return type:
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.
Property Details¶
- Gcr.SystemPrompt.props.bus_name¶
- Name:
bus-name
- Type:
- Default Value:
- Flags:
The DBus bus name of the prompter to use for prompting, or
None
for the default prompter.
- Gcr.SystemPrompt.props.secret_exchange¶
- Name:
secret-exchange
- Type:
- Default Value:
- Flags:
The
Gcr.SecretExchange
to use when transferring passwords. A default secret exchange will be used if this is not set.
- Gcr.SystemPrompt.props.timeout_seconds¶
- Name:
timeout-seconds
- Type:
- Default Value:
-1
- Flags:
The timeout in seconds to wait when opening the prompt.