Dialog
Added in version 1.5.
Superclasses: Widget
, InitiallyUnowned
, Object
Subclasses: AboutDialog
, AlertDialog
, PreferencesDialog
Implemented Interfaces: Accessible
, Buildable
, ConstraintTarget
- Constructors:
Dialog(**properties)
new() -> Adw.Dialog
Constructors
Methods
- class Dialog
- add_breakpoint(breakpoint: Breakpoint) None
Adds
breakpoint
toself
.Added in version 1.5.
- Parameters:
breakpoint – the breakpoint to add
- close() bool
Attempts to close
self
.If the
can_close
property is set toFALSE
, theclose_attempt
signal is emitted.See also:
force_close
.Added in version 1.5.
- force_close() None
Closes
self
.Unlike
close
, it succeeds even ifcan_close
is set toFALSE
.Added in version 1.5.
- get_current_breakpoint() Breakpoint | None
Gets the current breakpoint.
Added in version 1.5.
- get_follows_content_size() bool
Gets whether to size content of
self
automatically.Added in version 1.5.
- get_presentation_mode() DialogPresentationMode
Gets presentation mode for
self
.Added in version 1.5.
- present(parent: Widget | None = None) None
Presents
self
withinparent
’s window.If
self
is already shown, raises it to the top instead.If the window is an
Window
orApplicationWindow
, the dialog will be shown within it. Otherwise, it will be a separate window.Added in version 1.5.
- Parameters:
parent – a widget within the toplevel
- set_can_close(can_close: bool) None
Sets whether
self
can be closed.If set to
FALSE
, the close button, shortcuts andclose
will result inclose_attempt
being emitted instead, and bottom sheet close swipe will be disabled.force_close
still works.Added in version 1.5.
- Parameters:
can_close – whether to allow closing
- set_child(child: Widget | None = None) None
Sets the child widget of
self
.Added in version 1.5.
- Parameters:
child – the child widget
- 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:
default_height
Added in version 1.5.
- Parameters:
content_height – the content height
- 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:
default_width
Added in version 1.5.
- Parameters:
content_width – the content width
- set_default_widget(default_widget: Widget | None = None) None
Sets the default widget for
self
.It’s activated when the user presses Enter.
Added in version 1.5.
- Parameters:
default_widget – the default widget
- set_focus(focus: 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 usegrab_focus
instead of this function.Added in version 1.5.
- Parameters:
focus – the focus widget
- 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 ofcontent_width
andcontent_height
. If the content resizes, the dialog will immediately resize as well.See also:
resizable
Added in version 1.5.
- Parameters:
follows_content_size – whether to size content automatically
- set_presentation_mode(presentation_mode: 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
orADW_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.
Added in version 1.5.
- Parameters:
presentation_mode – the new presentation mode
Properties
- class Dialog
- props.can_close: bool
Whether the dialog can be closed.
If set to
FALSE
, the close button, shortcuts andclose
will result inclose_attempt
being emitted instead, and bottom sheet close swipe will be disabled.force_close
still works.Added in version 1.5.
- props.content_height: int
The height of the dialog’s contents.
Set it to -1 to reset it to the content’s natural height.
See also:
default_height
Added in version 1.5.
- props.content_width: int
The width of the dialog’s contents.
Set it to -1 to reset it to the content’s natural width.
See also:
default_width
Added in version 1.5.
- props.current_breakpoint: Breakpoint
The current breakpoint.
Added in version 1.5.
- props.default_widget: Widget
The default widget.
It’s activated when the user presses Enter.
Added in version 1.5.
- props.follows_content_size: bool
Whether to size content automatically.
If set to
TRUE
, always use the content’s natural size instead ofcontent_width
andcontent_height
. If the content resizes, the dialog will immediately resize as well.See also:
resizable
Added in version 1.5.
- props.presentation_mode: 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
orADW_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.
Added in version 1.5.
Signals
Virtual Methods
Fields
- class Dialog
- parent_instance