PreferencesWindow

class PreferencesWindow(*args, **kwargs)

Superclasses: Window, Window, Widget, InitiallyUnowned, Object

Implemented Interfaces: Accessible, Buildable, ConstraintTarget, Native, Root, ShortcutManager

A window to present an application’s preferences.

https://gnome.pages.gitlab.gnome.org/libadwaita/doc/1-latest/preferences-window.png

The AdwPreferencesWindow widget presents an application’s preferences gathered into pages and groups. The preferences are searchable by the user.

CSS nodes

AdwPreferencesWindow has a main CSS node with the name window and the style class .preferences.

Constructors

class PreferencesWindow
classmethod new() Widget

Creates a new AdwPreferencesWindow.

Methods

class PreferencesWindow
add(page: PreferencesPage) None

Adds a preferences page to self.

Parameters:

page – the page to add

add_toast(toast: Toast) None

Displays toast.

See add_toast.

Parameters:

toast – a toast

close_subpage() None

Closes the current subpage.

If there is no presented subpage, this does nothing.

Deprecated since version 1.4: Use pop_subpage instead.

get_can_navigate_back() bool

Gets whether gestures and shortcuts for closing subpages are enabled.

Deprecated since version 1.4: Use get_can_pop instead.

get_search_enabled() bool

Gets whether search is enabled for self.

get_visible_page() PreferencesPage | None

Gets the currently visible page of self.

get_visible_page_name() str | None

Gets the name of currently visible page of self.

pop_subpage() bool

Pop the visible page from the subpage stack of self.

Added in version 1.4.

present_subpage(subpage: Widget) None

Sets subpage as the window’s subpage and opens it.

The transition can be cancelled by the user, in which case visible child will change back to the previously visible child.

Deprecated since version 1.4: Use push_subpage instead.

Parameters:

subpage – the subpage

push_subpage(page: NavigationPage) None

Pushes page onto the subpage stack of self.

The page will be automatically removed when popped.

Added in version 1.4.

Parameters:

page – the subpage

remove(page: PreferencesPage) None

Removes a page from self.

Parameters:

page – the page to remove

set_can_navigate_back(can_navigate_back: bool) None

Sets whether gestures and shortcuts for closing subpages are enabled.

The supported gestures are:

  • One-finger swipe on touchscreens

  • Horizontal scrolling on touchpads (usually two-finger swipe)

  • Back mouse button

The keyboard back key is also supported, as well as the Alt`+:kbd:`← shortcut.

For right-to-left locales, gestures and shortcuts are reversed.

Deprecated since version 1.4: Use set_can_pop instead.

Has no effect for subpages added with push_subpage.

Parameters:

can_navigate_back – the new value

set_search_enabled(search_enabled: bool) None

Sets whether search is enabled for self.

Parameters:

search_enabled – whether search is enabled

set_visible_page(page: PreferencesPage) None

Makes page the visible page of self.

Parameters:

page – a page of self

set_visible_page_name(name: str) None

Makes the page with the given name visible.

See visible_page.

Parameters:

name – the name of the page to make visible

Properties

class PreferencesWindow
props.can_navigate_back: bool

Whether gestures and shortcuts for closing subpages are enabled.

The supported gestures are:

  • One-finger swipe on touchscreens

  • Horizontal scrolling on touchpads (usually two-finger swipe)

  • Back mouse button

The keyboard back key is also supported, as well as the Alt`+:kbd:`← shortcut.

For right-to-left locales, gestures and shortcuts are reversed.

Deprecated since version 1.4: Use can_pop instead.

Has no effect for subpages added with push_subpage.

props.search_enabled: bool

Whether search is enabled.

props.visible_page: Widget

The currently visible page.

props.visible_page_name: str

The name of the currently visible page.

See visible_page.

Fields

class PreferencesWindow
parent_instance