:right-sidebar: True Dialog =================================================================== .. currentmodule:: gi.repository.Adw .. versionadded:: 1.5 .. class:: Dialog(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.Gtk.Widget`, :class:`~gi.repository.GObject.InitiallyUnowned`, :class:`~gi.repository.GObject.Object` Subclasses: :class:`~gi.repository.Adw.AboutDialog`, :class:`~gi.repository.Adw.AlertDialog`, :class:`~gi.repository.Adw.PreferencesDialog` Implemented Interfaces: :class:`~gi.repository.Gtk.Accessible`, :class:`~gi.repository.Gtk.Buildable`, :class:`~gi.repository.Gtk.ConstraintTarget` :Constructors: :: Dialog(**properties) new() -> Adw.Dialog Constructors ------------ .. rst-class:: interim-class .. class:: Dialog :no-index: .. classmethod:: new() -> ~gi.repository.Adw.Dialog Creates a new ``AdwDialog``. .. versionadded:: 1.5 Methods ------- .. rst-class:: interim-class .. class:: Dialog :no-index: .. method:: add_breakpoint(breakpoint: ~gi.repository.Adw.Breakpoint) -> None Adds ``breakpoint`` to ``self``. .. versionadded:: 1.5 :param breakpoint: the breakpoint to add .. method:: close() -> bool Attempts to close ``self``. If the :obj:`~gi.repository.Adw.Dialog.props.can_close` property is set to ``FALSE``, the :obj:`~gi.repository.Adw.Dialog.signals.close_attempt` signal is emitted. See also: :obj:`~gi.repository.Dialog.force_close`. .. versionadded:: 1.5 .. method:: force_close() -> None Closes ``self``. Unlike :obj:`~gi.repository.Dialog.close`, it succeeds even if :obj:`~gi.repository.Adw.Dialog.props.can_close` is set to ``FALSE``. .. versionadded:: 1.5 .. method:: get_can_close() -> bool Gets whether ``self`` can be closed. .. versionadded:: 1.5 .. method:: get_child() -> ~gi.repository.Gtk.Widget | None Gets the child widget of ``self``. .. versionadded:: 1.5 .. method:: get_content_height() -> int Gets the height of the dialog's contents. .. versionadded:: 1.5 .. method:: get_content_width() -> int Gets the width of the dialog's contents. .. versionadded:: 1.5 .. method:: get_current_breakpoint() -> ~gi.repository.Adw.Breakpoint | None Gets the current breakpoint. .. versionadded:: 1.5 .. method:: get_default_widget() -> ~gi.repository.Gtk.Widget | None Gets the default widget for ``self``. .. versionadded:: 1.5 .. method:: get_focus() -> ~gi.repository.Gtk.Widget | None Gets the focus widget for ``self``. .. versionadded:: 1.5 .. method:: get_follows_content_size() -> bool Gets whether to size content of ``self`` automatically. .. versionadded:: 1.5 .. method:: get_presentation_mode() -> ~gi.repository.Adw.DialogPresentationMode Gets presentation mode for ``self``. .. versionadded:: 1.5 .. method:: get_title() -> str Gets the title of ``self``. .. versionadded:: 1.5 .. method:: present(parent: ~gi.repository.Gtk.Widget | None = None) -> None Presents ``self`` within ``parent``'s window. If ``self`` is already shown, raises it to the top instead. If the window is an :obj:`~gi.repository.Adw.Window` or :obj:`~gi.repository.Adw.ApplicationWindow`, the dialog will be shown within it. Otherwise, it will be a separate window. .. versionadded:: 1.5 :param parent: a widget within the toplevel .. method:: set_can_close(can_close: bool) -> None Sets whether ``self`` can be closed. If set to ``FALSE``, the close button, shortcuts and :obj:`~gi.repository.Dialog.close` will result in :obj:`~gi.repository.Adw.Dialog.signals.close_attempt` being emitted instead, and bottom sheet close swipe will be disabled. :obj:`~gi.repository.Dialog.force_close` still works. .. versionadded:: 1.5 :param can_close: whether to allow closing .. method:: set_child(child: ~gi.repository.Gtk.Widget | None = None) -> None Sets the child widget of ``self``. .. versionadded:: 1.5 :param child: the child widget .. method:: set_content_height(content_height: int) -> None Sets the height of the dialog's contents. Set it to -1 to reset it to the content's natural height. See also: :obj:`~gi.repository.Gtk.Window.props.default_height` .. versionadded:: 1.5 :param content_height: the content height .. method:: set_content_width(content_width: int) -> None Sets the width of the dialog's contents. Set it to -1 to reset it to the content's natural width. See also: :obj:`~gi.repository.Gtk.Window.props.default_width` .. versionadded:: 1.5 :param content_width: the content width .. method:: set_default_widget(default_widget: ~gi.repository.Gtk.Widget | None = None) -> None Sets the default widget for ``self``. It's activated when the user presses Enter. .. versionadded:: 1.5 :param default_widget: the default widget .. method:: set_focus(focus: ~gi.repository.Gtk.Widget | None = None) -> None Sets the focus widget for ``self``. If ``focus`` is not the current focus widget, and is focusable, sets it as the focus widget for the dialog. If focus is ``NULL``, unsets the focus widget for this dialog. To set the focus to a particular widget in the dialog, it is usually more convenient to use :obj:`~gi.repository.Gtk.Widget.grab_focus` instead of this function. .. versionadded:: 1.5 :param focus: the focus widget .. method:: set_follows_content_size(follows_content_size: bool) -> None Sets whether to size content of ``self`` automatically. If set to ``TRUE``, always use the content's natural size instead of :obj:`~gi.repository.Adw.Dialog.props.content_width` and :obj:`~gi.repository.Adw.Dialog.props.content_height`. If the content resizes, the dialog will immediately resize as well. See also: :obj:`~gi.repository.Gtk.Window.props.resizable` .. versionadded:: 1.5 :param follows_content_size: whether to size content automatically .. method:: set_presentation_mode(presentation_mode: ~gi.repository.Adw.DialogPresentationMode) -> None Sets presentation mode for ``self``. When set to ``ADW_DIALOG_AUTO``, the dialog appears as a bottom sheet when the following condition is met: `max-width: 450px or max-height: 360px`, and as a floating window otherwise. Set it to ``ADW_DIALOG_FLOATING`` or ``ADW_DIALOG_BOTTOM_SHEET`` to always present it a floating window or a bottom sheet respectively, regardless of available size. Presentation mode does nothing for dialogs presented as a window. .. versionadded:: 1.5 :param presentation_mode: the new presentation mode .. method:: set_title(title: str) -> None Sets the title of ``self``. .. versionadded:: 1.5 :param title: the new title Properties ---------- .. rst-class:: interim-class .. class:: Dialog :no-index: .. attribute:: props.can_close :type: bool Whether the dialog can be closed. If set to ``FALSE``, the close button, shortcuts and :obj:`~gi.repository.Dialog.close` will result in :obj:`~gi.repository.Adw.Dialog.signals.close_attempt` being emitted instead, and bottom sheet close swipe will be disabled. :obj:`~gi.repository.Dialog.force_close` still works. .. versionadded:: 1.5 .. attribute:: props.child :type: ~gi.repository.Gtk.Widget The child widget of the ``AdwDialog``. .. versionadded:: 1.5 .. attribute:: props.content_height :type: int The height of the dialog's contents. Set it to -1 to reset it to the content's natural height. See also: :obj:`~gi.repository.Gtk.Window.props.default_height` .. versionadded:: 1.5 .. attribute:: props.content_width :type: int The width of the dialog's contents. Set it to -1 to reset it to the content's natural width. See also: :obj:`~gi.repository.Gtk.Window.props.default_width` .. versionadded:: 1.5 .. attribute:: props.current_breakpoint :type: ~gi.repository.Adw.Breakpoint The current breakpoint. .. versionadded:: 1.5 .. attribute:: props.default_widget :type: ~gi.repository.Gtk.Widget The default widget. It's activated when the user presses Enter. .. versionadded:: 1.5 .. attribute:: props.focus_widget :type: ~gi.repository.Gtk.Widget The focus widget. .. versionadded:: 1.5 .. attribute:: props.follows_content_size :type: bool Whether to size content automatically. If set to ``TRUE``, always use the content's natural size instead of :obj:`~gi.repository.Adw.Dialog.props.content_width` and :obj:`~gi.repository.Adw.Dialog.props.content_height`. If the content resizes, the dialog will immediately resize as well. See also: :obj:`~gi.repository.Gtk.Window.props.resizable` .. versionadded:: 1.5 .. attribute:: props.presentation_mode :type: ~gi.repository.Adw.DialogPresentationMode The dialog's presentation mode. When set to ``ADW_DIALOG_AUTO``, the dialog appears as a bottom sheet when the following condition is met: `max-width: 450px or max-height: 360px`, and as a floating window otherwise. Set it to ``ADW_DIALOG_FLOATING`` or ``ADW_DIALOG_BOTTOM_SHEET`` to always present it a floating window or a bottom sheet respectively, regardless of available size. Presentation mode does nothing for dialogs presented as a window. .. versionadded:: 1.5 .. attribute:: props.title :type: str The title of the dialog. .. versionadded:: 1.5 Signals ------- .. rst-class:: interim-class .. class:: Dialog.signals :no-index: .. method:: close_attempt() -> None Emitted when the close button or shortcut is used, or :obj:`~gi.repository.Dialog.close` is called while :obj:`~gi.repository.Adw.Dialog.props.can_close` is set to ``FALSE``. .. versionadded:: 1.5 .. method:: closed() -> None Emitted when the dialog is successfully closed. .. versionadded:: 1.5 Virtual Methods --------------- .. rst-class:: interim-class .. class:: Dialog :no-index: .. method:: do_close_attempt() -> None .. method:: do_closed() -> None Fields ------ .. rst-class:: interim-class .. class:: Dialog :no-index: .. attribute:: parent_instance