:right-sidebar: True UriLauncher =================================================================== .. currentmodule:: gi.repository.Gtk .. versionadded:: 4.10 .. class:: UriLauncher(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.GObject.Object` A ``GtkUriLauncher`` object collects the arguments that are needed to open a uri with an application. 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 :obj:`~gi.repository.Gtk.UriLauncher.launch` function. This API follows the GIO async pattern, and the result can be obtained by calling :obj:`~gi.repository.Gtk.UriLauncher.launch_finish`. To launch a file, use :obj:`~gi.repository.Gtk.FileLauncher`. Constructors ------------ .. rst-class:: interim-class .. class:: UriLauncher :no-index: .. classmethod:: new(uri: str | None = None) -> ~gi.repository.Gtk.UriLauncher Creates a new ``GtkUriLauncher`` object. .. versionadded:: 4.10 :param uri: the uri to open Methods ------- .. rst-class:: interim-class .. class:: UriLauncher :no-index: .. method:: get_uri() -> str | None Gets the uri that will be opened. .. versionadded:: 4.10 .. method:: launch(parent: ~gi.repository.Gtk.Window | None = None, cancellable: ~gi.repository.Gio.Cancellable | None = None, callback: ~typing.Callable[[...], None] | None = None, *user_data: ~typing.Any) -> None Launch an application to open the uri. This may present an app chooser dialog to the user. The ``callback`` will be called when the operation is completed. It should call :obj:`~gi.repository.Gtk.UriLauncher.launch_finish` to obtain the result. .. versionadded:: 4.10 :param parent: the parent ``GtkWindow`` :param cancellable: a ``GCancellable`` to cancel the operation :param callback: a callback to call when the operation is complete :param user_data: data to pass to ``callback`` .. method:: launch_finish(result: ~gi.repository.Gio.AsyncResult) -> bool Finishes the :obj:`~gi.repository.Gtk.UriLauncher.launch` call and returns the result. .. versionadded:: 4.10 :param result: a ``GAsyncResult`` .. method:: set_uri(uri: str | None = None) -> None Sets the uri that will be opened. .. versionadded:: 4.10 :param uri: the uri Properties ---------- .. rst-class:: interim-class .. class:: UriLauncher :no-index: .. attribute:: props.uri :type: str The uri to launch. .. versionadded:: 4.10