Adw.ShortcutLabel¶
- Subclasses:
None
Methods¶
- Inherited:
Gtk.Widget (183), GObject.Object (37), Gtk.Accessible (17), Gtk.Buildable (1)
- Structs:
class |
|
|
|
|
Virtual Methods¶
- Inherited:
Gtk.Widget (25), GObject.Object (7), Gtk.Accessible (6), Gtk.Buildable (9)
Properties¶
- Inherited:
Name |
Type |
Flags |
Short Description |
|---|---|---|---|
r/w/en |
|||
r/w/en |
Signals¶
- Inherited:
Fields¶
- Inherited:
Class Details¶
- class Adw.ShortcutLabel(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
A widget that displays a keyboard shortcut.
<picture> <source srcset=”shortcut-label-dark.png” media=”(prefers-color-scheme: dark)”> <img src=”shortcut-label.png” alt=”shortcut-label”> </picture>
The shown shortcut can be set using the [property`ShortcutLabel`:py:data::accelerator<Adw.ShortcutLabel.props.accelerator>] property.
Optionally, if no shortcut is set,
AdwShortcutLabelwill display a placeholder set with the [property`ShortcutLabel`:py:data::disabled-text<Adw.ShortcutLabel.props.disabled_text>] property.The following types of shortcuts can be displayed:
A single shortcut in [func`Gtk`.accelerator_parse] format, e.g.
<Control>C:<picture> <source srcset=”shortcut-label-single-dark.png” media=”(prefers-color-scheme: dark)”> <img src=”shortcut-label-single.png” alt=”shortcut-label-single”> </picture>
Multiple alternative shortcuts, separated with spaces, e.g.
<Shift>A Home:<picture> <source srcset=”shortcut-label-alternative-dark.png” media=”(prefers-color-scheme: dark)”> <img src=”shortcut-label-alternative.png” alt=”shortcut-label-alternative”> </picture>
A range of shortcuts, separated with
..., e.g.<Alt>1...9:<picture> <source srcset=”shortcut-label-range-dark.png” media=”(prefers-color-scheme: dark)”> <img src=”shortcut-label-range.png” alt=”shortcut-label-range”> </picture>
Multiple keys pressed at once, separated with
&, e.g.Control_L&Control_R:<picture> <source srcset=”shortcut-label-multiple-dark.png” media=”(prefers-color-scheme: dark)”> <img src=”shortcut-label-multiple.png” alt=”shortcut-label-multiple”> </picture>
Multiple shortcuts or keys, pressed sequentially, separated with
+, e.g.<Control>C+<Control>X:<picture> <source srcset=”shortcut-label-sequence-dark.png” media=”(prefers-color-scheme: dark)”> <img src=”shortcut-label-sequence.png” alt=”shortcut-label-sequence”> </picture>
::: note
<,>and&need to be escaped as<,>and&when used in UI files.- CSS nodes
AdwShortcutLabelhas a single CSS node with nameshortcut-label. The individual keycap labels each have the.keycapstyle class, while the labels separating them have the.dimmedstyle class.- Accessibility
AdwShortcutLabeluses theGTK_ACCESSIBLE_ROLE_LABELrole.See also: [class`ShortcutsDialog`].
New in version 1.8.
- classmethod new(accelerator)¶
- Parameters:
accelerator (
str) – the accelerator to show- Returns:
the newly created
AdwShortcutLabel- Return type:
Creates a new
AdwShortcutLabelshowing accelerator.New in version 1.8.
- get_accelerator()¶
- Returns:
the displayed accelerator
- Return type:
Gets the accelerator displayed by self.
New in version 1.8.
- get_disabled_text()¶
- Returns:
the text displayed when no accelerator is set
- Return type:
Gets the text displayed by self when no accelerator is set.
New in version 1.8.
Property Details¶
- Adw.ShortcutLabel.props.accelerator¶
- Name:
accelerator- Type:
- Default Value:
''- Flags:
The displayed accelerator.
New in version 1.8.
- Adw.ShortcutLabel.props.disabled_text¶
- Name:
disabled-text- Type:
- Default Value:
''- Flags:
The text displayed when no accelerator is set.
New in version 1.8.