Gtk.ShortcutAction¶
- Subclasses:
Gtk.ActivateAction
,Gtk.CallbackAction
,Gtk.MnemonicAction
,Gtk.NamedAction
,Gtk.NothingAction
,Gtk.SignalAction
Methods¶
- Inherited:
- Structs:
class |
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
Properties¶
None
Signals¶
- Inherited:
Fields¶
- Inherited:
Class Details¶
- class Gtk.ShortcutAction(**kwargs)¶
- Bases:
- Abstract:
Yes
- Structure:
GtkShortcutAction
encodes an action that can be triggered by a keyboard shortcut.GtkShortcutActions
contain functions that allow easy presentation to end users as well as being printed for debugging.All
GtkShortcutActions
are immutable, you can only specify their properties during construction. If you want to change a action, you have to replace it with a new one. If you need to pass arguments to an action, these are specified by the higher-levelGtkShortcut
object.To activate a
GtkShortcutAction
manually, [method`Gtk`.ShortcutAction.activate] can be called.GTK provides various actions:
[class`Gtk`.MnemonicAction]: a shortcut action that calls
Gtk.Widget.mnemonic_activate
()[class`Gtk`.CallbackAction]: a shortcut action that invokes a given callback
[class`Gtk`.SignalAction]: a shortcut action that emits a given signal
[class`Gtk`.ActivateAction]: a shortcut action that calls
Gtk.Widget.activate
()[class`Gtk`.NamedAction]: a shortcut action that calls
Gtk.Widget.activate_action
()[class`Gtk`.NothingAction]: a shortcut action that does nothing
- classmethod parse_string(string)[source]¶
- Parameters:
string (
str
) – the string to parse- Returns:
a new
GtkShortcutAction
- Return type:
Tries to parse the given string into an action.
On success, the parsed action is returned. When parsing failed,
None
is returned.The accepted strings are:
nothing
, forGtkNothingAction
activate
, forGtkActivateAction
mnemonic-activate
, forGtkMnemonicAction
action(NAME)
, for aGtkNamedAction
for the action namedNAME
signal(NAME)
, for aGtkSignalAction
for the signalNAME
- activate(flags, widget, args)[source]¶
- Parameters:
flags (
Gtk.ShortcutActionFlags
) – flags to activate withwidget (
Gtk.Widget
) – Target of the activationargs (
GLib.Variant
orNone
) – arguments to pass
- Returns:
True
if this action was activated successfully- Return type:
Activates the action on the widget with the given args.
Note that some actions ignore the passed in flags, widget or args.
Activation of an action can fail for various reasons. If the action is not supported by the widget, if the args don’t match the action or if the activation otherwise had no effect,
False
will be returned.
- print_(string)[source]¶
- Parameters:
string (
GLib.String
) – aGString
to print into
Prints the given action 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.