SidebarItem#

Added in version 1.9.

class SidebarItem(**properties: Any)#

Superclasses: Object

An item within SidebarSection.

Sidebar items must have a title, set via title.

Sidebar items should, but are not required to, have an icon. Icons can be set from an icon name, via icon_name, or a Paintable, via icon_paintable.

Items can also have subtitles, set with the subtitle property. Subtitles should be used sparingly.

To add a tooltip, use tooltip. Tooltips always use Pango markup.

Items can have an arbitrary suffix widget, set with the suffix properties. It will be displayed at the end of its row, or before the arrow in the page mode.

To hide or disable the item, use the visible and enabled properties respectively.

To access the items’s section, use section.

It’s also possible to access the index of the item in both the section and the sidebar, using get_section_index and get_index respectively.

Dragging content over sidebar items activates them by default. To disable this behavior, set drag_motion_activate to FALSE.

AdwSidebarItem is derivable, and applications that need to associate each page with data can store it in the items themselves this way.

Constructors#

class SidebarItem
classmethod new(title: str) SidebarItem#

Creates a new AdwSidebarItem with title as its title.

Added in version 1.9.

Parameters:

title – the item title

Methods#

class SidebarItem
get_drag_motion_activate() bool#

Gets whether self will be activated on pointer motion during Drag-and-Drop.

Added in version 1.9.

get_enabled() bool#

Gets whether self is enabled.

Added in version 1.9.

get_icon_name() str | None#

Gets the icon name for item.

Added in version 1.9.

get_icon_paintable() Paintable | None#

Gets the paintable used as the icon for item.

Added in version 1.9.

get_index() int#

Gets index of self within its Sidebar.

If self is within a section, but that section is not in a sidebar, index will be within the section only.

If self is not within a section, the index will be 0.

The item can later be retrieved by passing this index into get_item.

Added in version 1.9.

get_section() SidebarSection | None#

Gets the section self is in.

Added in version 1.9.

get_section_index() int#

Gets index of self within its SidebarSection.

If self is not within a section, the index will be 0.

The item can later be retrieved by passing this index into get_item.

Added in version 1.9.

get_subtitle() str | None#

Gets the subtitle of self.

Added in version 1.9.

get_suffix() Widget | None#

Gets the suffix widget for self.

Added in version 1.9.

get_title() str | None#

Gets the title of self.

Added in version 1.9.

get_tooltip() str | None#

Gets the tooltip of self.

Added in version 1.9.

get_use_underline() bool#

Gets whether an underline in the title indicates a mnemonic.

Added in version 1.9.

get_visible() bool#

Gets whether self is visible.

Added in version 1.9.

set_drag_motion_activate(drag_motion_activate: bool) None#

Sets whether to activate self on pointer motion during Drag-and-Drop.

This is needed to be able to drag content into the page the item represents, when the sidebar is used as a page switcher. However, it may be unwanted when dropping content onto the item itself, so it can be disabled.

Added in version 1.9.

Parameters:

drag_motion_activate – whether to enable the item on drag motion

set_enabled(enabled: bool) None#

Sets whether self is enabled.

See sensitive.

Added in version 1.9.

Parameters:

enabled – whether to enable the item

set_icon_name(icon_name: str | None = None) None#

Sets the icon name for item.

Mutually exclusive with icon_paintable.

Added in version 1.9.

Parameters:

icon_name – the icon name

set_icon_paintable(paintable: Paintable | None = None) None#

Sets the paintable to use as the icon for item.

Mutually exclusive with icon_name.

Added in version 1.9.

Parameters:

paintable – the icon paintable

set_subtitle(subtitle: str | None = None) None#

Sets the subtitle of self.

Added in version 1.9.

Parameters:

subtitle – the subtitle

set_suffix(suffix: Widget | None = None) None#

Sets the suffix widget for self.

Suffix will be shown at the end of the item’s row, or before the arrow in the page mode.

Added in version 1.9.

Parameters:

suffix – the suffix widget

set_title(title: str | None = None) None#

Sets the title of self.

Added in version 1.9.

Parameters:

title – the title

set_tooltip(tooltip: str | None = None) None#

Sets the tooltip of self.

The tooltip can be marked up with the Pango text markup language.

Added in version 1.9.

Parameters:

tooltip – the tooltip

set_use_underline(use_underline: bool) None#

Sets whether an underline in the title indicates a mnemonic.

The mnemonic can be used to activate the item.

Added in version 1.9.

Parameters:

use_underline – whether an underline in the text indicates a mnemonic

set_visible(visible: bool) None#

Sets whether self is visible.

Added in version 1.9.

Parameters:

visible – whether the item is visible

Properties#

class SidebarItem
props.drag_motion_activate: bool#

The type of the None singleton.

Added in version 1.9.

props.enabled: bool#

The type of the None singleton.

Added in version 1.9.

props.icon_name: str#

The type of the None singleton.

Added in version 1.9.

props.icon_paintable: Paintable#

The type of the None singleton.

Added in version 1.9.

props.section: SidebarSection#

The type of the None singleton.

Added in version 1.9.

props.subtitle: str#

The type of the None singleton.

Added in version 1.9.

props.suffix: Widget#

The type of the None singleton.

Added in version 1.9.

props.title: str#

The type of the None singleton.

Added in version 1.9.

props.tooltip: str#

The type of the None singleton.

Added in version 1.9.

props.use_underline: bool#

The type of the None singleton.

Added in version 1.9.

props.visible: bool#

The type of the None singleton.

Added in version 1.9.

Fields#

class SidebarItem
parent_instance#