Adw.ShortcutsItem

g Adw.ShortcutsItem Adw.ShortcutsItem GObject.Object GObject.Object GObject.Object->Adw.ShortcutsItem

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

new (title, accelerator)

class

new_from_action (title, action_name)

get_accelerator ()

get_action_name ()

get_direction ()

get_subtitle ()

get_title ()

set_accelerator (accelerator)

set_action_name (action_name)

set_direction (direction)

set_subtitle (subtitle)

set_title (title)

Virtual Methods

Inherited:

GObject.Object (7)

Properties

Name

Type

Flags

Short Description

accelerator

str

r/w/en

action-name

str

r/w/en

direction

Gtk.TextDirection

r/w/en

subtitle

str

r/w/en

title

str

r/w/en

Signals

Inherited:

GObject.Object (1)

Fields

Inherited:

GObject.Object (1)

Class Details

class Adw.ShortcutsItem(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

Adw.ShortcutsItemClass

An object representing an individual shortcut in [class`ShortcutsSection`].

A shortcut has a title, an optional subtitle, and an accelerator.

Accelerator must be specified in the format [class`ShortcutLabel`] accepts.

Alternatively, the [property`ShortcutsItem`:py:data::action-name<Adw.ShortcutsItem.props.action_name>] property can be used to automatically get accelerator associated with the specified action, as set via [method`Gtk`.Application.set_accels_for_action].

If both are specified, the accelerator will be used if the action couldn’t be found or doesn’t have an accelerator associated for it.

If [property`ShortcutsItem`:py:data::direction<Adw.ShortcutsItem.props.direction>] is set, the shortcut will only be displayed for the specified text direction. This allows to display different shortcuts for different text directions.

New in version 1.8.

classmethod new(title, accelerator)
Parameters:
  • title (str) – the shortcut title

  • accelerator (str) – the shortcut accelerator

Returns:

the newly created AdwShortcutsItem

Return type:

Adw.ShortcutsItem

Creates a new AdwShortcutsItem with title and accelerator.

New in version 1.8.

classmethod new_from_action(title, action_name)
Parameters:
  • title (str) – the shortcut title

  • action_name (str) – the shortcut action name

Returns:

the newly created AdwShortcutsItem

Return type:

Adw.ShortcutsItem

Creates a new AdwShortcutsItem with title and action_name.

New in version 1.8.

get_accelerator()
Returns:

the accelerator

Return type:

str

Gets the accelerator of self.

New in version 1.8.

get_action_name()
Returns:

the action name

Return type:

str

Gets the action name to get the accelerator from.

New in version 1.8.

get_direction()
Returns:

the shortcut direction

Return type:

Gtk.TextDirection

Gets the direction of self.

New in version 1.8.

get_subtitle()
Returns:

the subtitle

Return type:

str

Gets the subtitle of self.

New in version 1.8.

get_title()
Returns:

the title

Return type:

str

Gets the title of self.

New in version 1.8.

set_accelerator(accelerator)
Parameters:

accelerator (str) – the accelerator to use

Sets the accelerator of self.

accelerator must be in the format [class`ShortcutLabel`] accepts.

New in version 1.8.

set_action_name(action_name)
Parameters:

action_name (str) – the action name to use

Sets the action name to get the accelerator from.

New in version 1.8.

set_direction(direction)
Parameters:

direction (Gtk.TextDirection) – the shortcut direction

Sets the direction of self.

If set to [enum`Gtk`.TextDirection.LTR] or [enum`Gtk`.TextDirection.RTL], the shortcut will only be displayed for this direction.

New in version 1.8.

set_subtitle(subtitle)
Parameters:

subtitle (str) – the subtitle to use

Sets the subtitle of self.

New in version 1.8.

set_title(title)
Parameters:

title (str) – the title to use

Sets the title of self.

New in version 1.8.

Property Details

Adw.ShortcutsItem.props.accelerator
Name:

accelerator

Type:

str

Default Value:

''

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The shortcut accelerator.

Accelerator must be in the format [class`ShortcutLabel`] accepts.

New in version 1.8.

Adw.ShortcutsItem.props.action_name
Name:

action-name

Type:

str

Default Value:

''

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

Fully qualified action name to get the accelerator from.

New in version 1.8.

Adw.ShortcutsItem.props.direction
Name:

direction

Type:

Gtk.TextDirection

Default Value:

Gtk.TextDirection.NONE

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The shortcut direction.

If set to [enum`Gtk`.TextDirection.LTR] or [enum`Gtk`.TextDirection.RTL], the shortcut will only be displayed for this direction.

New in version 1.8.

Adw.ShortcutsItem.props.subtitle
Name:

subtitle

Type:

str

Default Value:

''

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The subtitle of the shortcut.

New in version 1.8.

Adw.ShortcutsItem.props.title
Name:

title

Type:

str

Default Value:

''

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The title of the shortcut.

New in version 1.8.