UriLauncher#
Added in version 4.10.
Superclasses: Object
Asynchronous API to open a uri with an application.
GtkUriLauncher collects the arguments that are needed to open the uri.
Depending on system configuration, user preferences and available APIs, this may or may not show an app chooser dialog or launch the default application right away.
The operation is started with the launch function.
To launch a file, use FileLauncher.
Constructors#
- class UriLauncher
- classmethod new(uri: str | None = None) UriLauncher#
Creates a new
GtkUriLauncherobject.Added in version 4.10.
- Parameters:
uri – the uri to open
Methods#
- class UriLauncher
- can_launch(parent: Window | None = None) bool#
Returns whether the launcher is likely to succeed in launching an application for its uri.
This can be used to disable controls that trigger the launcher when they are known not to work.
Added in version 4.20.
- Parameters:
parent – the parent window
- async launch(self, parent: Window | None = None) bool#
This is the awaitable version of
launch().Added in version 4.10.
- Parameters:
parent – the parent window
- launch(parent: Window | None = None, cancellable: Cancellable | None = None, callback: Callable[[Object | None, AsyncResult, Any], None] | None = None, user_data: Any = None) None#
Launches an application to open the uri.
This may present an app chooser dialog to the user.
Added in version 4.10.
- Parameters:
parent – the parent window
cancellable – a cancellable to cancel the operation
callback – a callback to call when the operation is complete
user_data – data to pass to
callback
- launch_finish(result: AsyncResult) bool#
Finishes the
launchcall and returns the result.Added in version 4.10.
- Parameters:
result – the result