Skip to content

Gtk.ShortcutsSection

class — extends Box, Accessible, Buildable, ConstraintTarget, Orientable

:::warning Deprecated since 4.18 This API is deprecated. :::

A GtkShortcutsSection collects all the keyboard shortcuts and gestures for a major application mode.

If your application needs multiple sections, you should give each section a unique ShortcutsSection.section-name and a ShortcutsSection.title that can be shown in the section selector of the ShortcutsWindow.

The ShortcutsSection.max-height property can be used to influence how the groups in the section are distributed over pages and columns.

This widget is only meant to be used with ShortcutsWindow.

The recommended way to construct a GtkShortcutsSection is with Builder, by using the <child> tag to populate a GtkShortcutsSection with one or more ShortcutsGroup instances, which in turn contain one or more ShortcutsShortcut objects.

If you need to add a group programmatically, use ShortcutsSection.add_group.

Shortcuts and Gestures

Pan gestures allow to navigate between sections.

The following signals have default keybindings:

Methods

add_group

def add_group(self, group: ShortcutsGroup) -> None

:::warning Deprecated since 4.18 This API is deprecated. :::

Adds a group to the shortcuts section.

This is the programmatic equivalent to using Builder and a <child> tag to add the child.

Adding children with the GtkBox API is not appropriate, as GtkShortcutsSection manages its children internally.

Parameters:

  • group — the GtkShortcutsGroup to add

Properties

max_height

max_height: int  # read/write

:::warning Deprecated since 4.18 This API is deprecated. :::

The maximum number of lines to allow per column.

This property can be used to influence how the groups in this section are distributed across pages and columns. The default value of 15 should work in most cases.

section_name

section_name: str  # read/write

:::warning Deprecated since 4.18 This API is deprecated. :::

A unique name to identify this section among the sections added to the GtkShortcutsWindow.

Setting the ShortcutsWindow.section-name property to this string will make this section shown in the GtkShortcutsWindow.

title

title: str  # read/write

:::warning Deprecated since 4.18 This API is deprecated. :::

The string to show in the section selector of the GtkShortcutsWindow for this section.

If there is only one section, you don't need to set a title, since the section selector will not be shown in this case.

view_name

view_name: str  # read/write

:::warning Deprecated since 4.18 This API is deprecated. :::

A view name to filter the groups in this section by.

See ShortcutsGroup.view.

Applications are expected to use the ShortcutsWindow.view-name property for this purpose.

Signals

change-current-page

def on_change_current_page(self, offset: int) -> bool: ...

:::warning Deprecated since 4.18 This API is deprecated. :::

Emitted when we change the current page.

The default bindings for this signal are <kbd>Ctrl</kbd>+<kbd>PgUp</kbd>, <kbd>PgUp</kbd>, <kbd>Ctrl</kbd>+<kbd>PgDn</kbd>, <kbd>PgDn</kbd>.