Gtk.ShortcutTrigger¶
Methods¶
- Inherited:
- Structs:
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
None
Signals¶
- Inherited:
Fields¶
- Inherited:
Class Details¶
- class Gtk.ShortcutTrigger(**kwargs)¶
- Bases:
- Abstract:
Yes
- Structure:
GtkShortcutTrigger
tracks how aGtkShortcut
should be activated.To find out if a
GtkShortcutTrigger
triggers, you can call [method`Gtk`.ShortcutTrigger.trigger] on aGdkEvent
.GtkShortcutTriggers
contain functions that allow easy presentation to end users as well as being printed for debugging.All
GtkShortcutTriggers
are immutable, you can only specify their properties during construction. If you want to change a trigger, you have to replace it with a new one.- classmethod parse_string(string)[source]¶
- Parameters:
string (
str
) – the string to parse- Returns:
a new
GtkShortcutTrigger
- Return type:
Tries to parse the given string into a trigger.
On success, the parsed trigger is returned. When parsing failed,
None
is returned.The accepted strings are:
never
, forGtkNeverTrigger
a string parsed by
Gtk.accelerator_parse
(), for aGtkKeyvalTrigger
, e.g.<Control>C
underscore, followed by a single character, for
GtkMnemonicTrigger
, e.g._l
two valid trigger strings, separated by a
|
character, for aGtkAlternativeTrigger
:<Control>q|<Control>w
Note that you will have to escape the
<
and>
characters when specifying triggers in XML files, such asGtk.Builder
ui files. Use<
instead of<
and>
instead of>
.
- compare(trigger2)[source]¶
- Parameters:
trigger2 (
Gtk.ShortcutTrigger
) – aGtkShortcutTrigger
- Returns:
An integer less than, equal to, or greater than zero if self is found, respectively, to be less than, to match, or be greater than trigger2.
- Return type:
The types of self and trigger2 are
gconstpointer
only to allow use of this function as aGCompareFunc
.They must each be a
GtkShortcutTrigger
.
- equal(trigger2)[source]¶
- Parameters:
trigger2 (
Gtk.ShortcutTrigger
) – aGtkShortcutTrigger
- Returns:
True
if self and trigger2 are equal- Return type:
Checks if self and trigger2 trigger under the same conditions.
The types of one and two are
gconstpointer
only to allow use of this function withGHashTable
. They must each be aGtkShortcutTrigger
.
- hash()[source]¶
- Returns:
a hash value corresponding to self
- Return type:
Generates a hash value for a
GtkShortcutTrigger
.The output of this function is guaranteed to be the same for a given value only per-process. It may change between different processor architectures or even different versions of GTK. Do not use this function as a basis for building protocols or file formats.
The types of self is
gconstpointer
only to allow use of this function withGHashTable
. They must each be aGtkShortcutTrigger
.
- print_(string)[source]¶
- Parameters:
string (
GLib.String
) – aGString
to print into
Prints the given trigger into a string for the developer. This is meant for debugging and logging.
The form of the representation may change at any time and is not guaranteed to stay identical.
- print_label(display, string)[source]¶
- Parameters:
display (
Gdk.Display
) –GdkDisplay
to print forstring (
GLib.String
) – aGString
to print into
- Returns:
True
if something was printed orFalse
if the trigger did not have a textual representation suitable for end users.- Return type:
Prints the given trigger into a string.
This function is returning a translated string for presentation to end users for example in menu items or in help texts.
The display in use may influence the resulting string in various forms, such as resolving hardware keycodes or by causing display-specific modifier names.
The form of the representation may change at any time and is not guaranteed to stay identical.
- to_label(display)[source]¶
- Parameters:
display (
Gdk.Display
) –GdkDisplay
to print for- Returns:
a new string
- Return type:
Gets textual representation for the given trigger.
This function is returning a translated string for presentation to end users for example in menu items or in help texts.
The display in use may influence the resulting string in various forms, such as resolving hardware keycodes or by causing display-specific modifier names.
The form of the representation may change at any time and is not guaranteed to stay identical.
- to_string()[source]¶
- Returns:
a new string
- Return type:
Prints the given trigger into a human-readable string.
This is a small wrapper around [method`Gtk`.ShortcutTrigger.print] to help when debugging.