:right-sidebar: True ShortcutsItem =================================================================== .. currentmodule:: gi.repository.Adw .. versionadded:: 1.8 .. class:: ShortcutsItem(**properties: ~typing.Any) :no-contents-entry: Superclasses: :class:`~gi.repository.GObject.Object` An object representing an individual shortcut in :obj:`~gi.repository.Adw.ShortcutsSection`\. A shortcut has a title, an optional subtitle, and an accelerator. Accelerator must be specified in the format :obj:`~gi.repository.Adw.ShortcutLabel` accepts. Alternatively, the :obj:`~gi.repository.Adw.ShortcutsItem.props.action_name` property can be used to automatically get accelerator associated with the specified action, as set via :obj:`~gi.repository.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 :obj:`~gi.repository.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. Constructors ------------ .. rst-class:: interim-class .. class:: ShortcutsItem :no-index: .. classmethod:: new(title: str, accelerator: str) -> ~gi.repository.Adw.ShortcutsItem Creates a new ``AdwShortcutsItem`` with ``title`` and ``accelerator``\. .. versionadded:: 1.8 :param title: the shortcut title :param accelerator: the shortcut accelerator .. classmethod:: new_from_action(title: str, action_name: str) -> ~gi.repository.Adw.ShortcutsItem Creates a new ``AdwShortcutsItem`` with ``title`` and ``action_name``\. .. versionadded:: 1.8 :param title: the shortcut title :param action_name: the shortcut action name Methods ------- .. rst-class:: interim-class .. class:: ShortcutsItem :no-index: .. method:: get_accelerator() -> str Gets the accelerator of ``self``\. .. versionadded:: 1.8 .. method:: get_action_name() -> str Gets the action name to get the accelerator from. .. versionadded:: 1.8 .. method:: get_direction() -> ~gi.repository.Gtk.TextDirection Gets the direction of ``self``\. .. versionadded:: 1.8 .. method:: get_subtitle() -> str Gets the subtitle of ``self``\. .. versionadded:: 1.8 .. method:: get_title() -> str Gets the title of ``self``\. .. versionadded:: 1.8 .. method:: set_accelerator(accelerator: str) -> None Sets the accelerator of ``self``\. ``accelerator`` must be in the format :obj:`~gi.repository.Adw.ShortcutLabel` accepts. .. versionadded:: 1.8 :param accelerator: the accelerator to use .. method:: set_action_name(action_name: str) -> None Sets the action name to get the accelerator from. .. versionadded:: 1.8 :param action_name: the action name to use .. method:: set_direction(direction: ~gi.repository.Gtk.TextDirection) -> None Sets the direction of ``self``\. If set to :obj:`~gi.repository.Gtk.TextDirection.ltr` or :obj:`~gi.repository.Gtk.TextDirection.rtl`\, the shortcut will only be displayed for this direction. .. versionadded:: 1.8 :param direction: the shortcut direction .. method:: set_subtitle(subtitle: str) -> None Sets the subtitle of ``self``\. .. versionadded:: 1.8 :param subtitle: the subtitle to use .. method:: set_title(title: str) -> None Sets the title of ``self``\. .. versionadded:: 1.8 :param title: the title to use Properties ---------- .. rst-class:: interim-class .. class:: ShortcutsItem :no-index: .. attribute:: props.accelerator :type: str The shortcut accelerator. Accelerator must be in the format :obj:`~gi.repository.Adw.ShortcutLabel` accepts. .. versionadded:: 1.8 .. attribute:: props.action_name :type: str Fully qualified action name to get the accelerator from. .. versionadded:: 1.8 .. attribute:: props.direction :type: ~gi.repository.Gtk.TextDirection The shortcut direction. If set to :obj:`~gi.repository.Gtk.TextDirection.LTR` or :obj:`~gi.repository.Gtk.TextDirection.rtl`\, the shortcut will only be displayed for this direction. .. versionadded:: 1.8 .. attribute:: props.subtitle :type: str The subtitle of the shortcut. .. versionadded:: 1.8 .. attribute:: props.title :type: str The title of the shortcut. .. versionadded:: 1.8