SidebarItem#
Added in version 1.9.
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
AdwSidebarItemwithtitleas its title.Added in version 1.9.
- Parameters:
title – the item title
Methods#
- class SidebarItem
- get_drag_motion_activate() → bool#
Gets whether
selfwill be activated on pointer motion during Drag-and-Drop.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
selfwithin itsSidebar.If
selfis within a section, but that section is not in a sidebar, index will be within the section only.If
selfis 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
selfis in.Added in version 1.9.
- get_section_index() → int#
Gets index of
selfwithin itsSidebarSection.If
selfis 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_use_underline() → bool#
Gets whether an underline in the title indicates a mnemonic.
Added in version 1.9.
- set_drag_motion_activate(drag_motion_activate: bool) → None#
Sets whether to activate
selfon 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
selfis 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
pagemode.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
Properties#
- class SidebarItem
-
- props.section: SidebarSection#
The type of the None singleton.
Added in version 1.9.
Fields#
- class SidebarItem
- parent_instance#