Gtk.AccelGroup¶
- Subclasses:
None
Methods¶
- Inherited:
- Structs:
class |
|
class |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Virtual Methods¶
- Inherited:
|
Properties¶
Name |
Type |
Flags |
Short Description |
---|---|---|---|
r |
Is the accel group locked |
||
r |
Modifier Mask |
Signals¶
- Inherited:
Name |
Short Description |
---|---|
The accel-activate signal is an implementation detail of |
|
The accel-changed signal is emitted when an entry is added to or removed from the accel group. |
Fields¶
- Inherited:
Name |
Type |
Access |
Description |
---|---|---|---|
parent |
r |
Class Details¶
- class Gtk.AccelGroup(**kwargs)¶
- Bases:
- Abstract:
No
- Structure:
A
Gtk.AccelGroup
represents a group of keyboard accelerators, typically attached to a toplevelGtk.Window
(withGtk.Window.add_accel_group
()). Usually you won’t need to create aGtk.AccelGroup
directly; instead, when usingGtk.UIManager
, GTK+ automatically sets up the accelerators for your menus in the ui manager’sGtk.AccelGroup
.Note that “accelerators” are different from “mnemonics”. Accelerators are shortcuts for activating a menu item; they appear alongside the menu item they’re a shortcut for. For example “Ctrl+Q” might appear alongside the “Quit” menu item. Mnemonics are shortcuts for GUI elements such as text entries or buttons; they appear as underlined characters. See
Gtk.Label.new_with_mnemonic
(). Menu items can have both accelerators and mnemonics, of course.- classmethod from_accel_closure(closure)[source]¶
- Parameters:
closure (
GObject.Closure
) – aGObject.Closure
- Returns:
the
Gtk.AccelGroup
to which closure is connected, orNone
- Return type:
Finds the
Gtk.AccelGroup
to which closure is connected; seeGtk.AccelGroup.connect
().
- classmethod new()[source]¶
- Returns:
a new
Gtk.AccelGroup
object- Return type:
Creates a new
Gtk.AccelGroup
.
- activate(accel_quark, acceleratable, accel_key, accel_mods)[source]¶
- Parameters:
accel_quark (
int
) – the quark for the accelerator nameacceleratable (
GObject.Object
) – theGObject.Object
, usually aGtk.Window
, on which to activate the acceleratoraccel_key (
int
) – accelerator keyval from a key eventaccel_mods (
Gdk.ModifierType
) – keyboard state mask from a key event
- Returns:
True
if an accelerator was activated and handled this keypress- Return type:
Finds the first accelerator in self that matches accel_key and accel_mods, and activates it.
- connect(accel_key, accel_mods, accel_flags, closure)[source]¶
- Parameters:
accel_key (
int
) – key value of the acceleratoraccel_mods (
Gdk.ModifierType
) – modifier combination of the acceleratoraccel_flags (
Gtk.AccelFlags
) – a flag mask to configure this acceleratorclosure (
GObject.Closure
) – closure to be executed upon accelerator activation
Installs an accelerator in this group. When self is being activated in response to a call to
Gtk.accel_groups_activate
(), closure will be invoked if the accel_key and accel_mods fromGtk.accel_groups_activate
() match those of this connection.The signature used for the closure is that of
Gtk.AccelGroupActivate
.Note that, due to implementation details, a single closure can only be connected to one accelerator group.
- connect_by_path(accel_path, closure)[source]¶
- Parameters:
accel_path (
str
) – path used for determining key and modifiersclosure (
GObject.Closure
) – closure to be executed upon accelerator activation
Installs an accelerator in this group, using an accelerator path to look up the appropriate key and modifiers (see
Gtk.AccelMap.add_entry
()). When self is being activated in response to a call toGtk.accel_groups_activate
(), closure will be invoked if the accel_key and accel_mods fromGtk.accel_groups_activate
() match the key and modifiers for the path.The signature used for the closure is that of
Gtk.AccelGroupActivate
.Note that accel_path string will be stored in a #GQuark. Therefore, if you pass a static string, you can save some memory by interning it first with
GLib.intern_static_string
().
- disconnect(closure)[source]¶
- Parameters:
closure (
GObject.Closure
orNone
) – the closure to remove from this accelerator group, orNone
to remove all closures- Returns:
True
if the closure was found and got disconnected- Return type:
Removes an accelerator previously installed through
Gtk.AccelGroup.connect
().Since 2.20 closure can be
None
.
- disconnect_key(accel_key, accel_mods)[source]¶
- Parameters:
accel_key (
int
) – key value of the acceleratoraccel_mods (
Gdk.ModifierType
) – modifier combination of the accelerator
- Returns:
True
if there was an accelerator which could be removed,False
otherwise- Return type:
Removes an accelerator previously installed through
Gtk.AccelGroup.connect
().
- find(find_func, *data)[source]¶
- Parameters:
find_func (
Gtk.AccelGroupFindFunc
) – a function to filter the entries of self with
- Returns:
the key of the first entry passing find_func. The key is owned by GTK+ and must not be freed.
- Return type:
Finds the first entry in an accelerator group for which find_func returns
True
and returns itsGtk.AccelKey
.
- get_is_locked()[source]¶
-
Locks are added and removed using
Gtk.AccelGroup.lock
() andGtk.AccelGroup.unlock
().New in version 2.14.
- get_modifier_mask()[source]¶
- Returns:
the modifier mask for this accel group.
- Return type:
Gets a
Gdk.ModifierType
representing the mask for this self. For example,Gdk.ModifierType.CONTROL_MASK
,Gdk.ModifierType.SHIFT_MASK
, etc.New in version 2.14.
- lock()[source]¶
Locks the given accelerator group.
Locking an acelerator group prevents the accelerators contained within it to be changed during runtime. Refer to
Gtk.AccelMap.change_entry
() about runtime accelerator changes.If called more than once, self remains locked until
Gtk.AccelGroup.unlock
() has been called an equivalent number of times.
- query(accel_key, accel_mods)[source]¶
- Parameters:
accel_key (
int
) – key value of the acceleratoraccel_mods (
Gdk.ModifierType
) – modifier combination of the accelerator
- Returns:
an array of n_entries
Gtk.AccelGroupEntry
elements, orNone
. The array is owned by GTK+ and must not be freed.- Return type:
[
Gtk.AccelGroupEntry
] orNone
Queries an accelerator group for all entries matching accel_key and accel_mods.
- unlock()[source]¶
Undoes the last call to
Gtk.AccelGroup.lock
() on this self.
- do_accel_changed(keyval, modifier, accel_closure) virtual¶
- Parameters:
keyval (
int
) –modifier (
Gdk.ModifierType
) –accel_closure (
GObject.Closure
) –
Signal emitted when an entry is added to or removed from the accel group.
Signal Details¶
- Gtk.AccelGroup.signals.accel_activate(accel_group, acceleratable, keyval, modifier)¶
- Signal Name:
accel-activate
- Flags:
- Parameters:
accel_group (
Gtk.AccelGroup
) – The object which received the signalacceleratable (
GObject.Object
) – the object on which the accelerator was activatedkeyval (
int
) – the accelerator keyvalmodifier (
Gdk.ModifierType
) – the modifier combination of the accelerator
- Returns:
True
if the accelerator was activated- Return type:
The accel-activate signal is an implementation detail of
Gtk.AccelGroup
and not meant to be used by applications.
- Gtk.AccelGroup.signals.accel_changed(accel_group, keyval, modifier, accel_closure)¶
- Signal Name:
accel-changed
- Flags:
- Parameters:
accel_group (
Gtk.AccelGroup
) – The object which received the signalkeyval (
int
) – the accelerator keyvalmodifier (
Gdk.ModifierType
) – the modifier combination of the acceleratoraccel_closure (
GObject.Closure
) – theGObject.Closure
of the accelerator
The accel-changed signal is emitted when an entry is added to or removed from the accel group.
Widgets like
Gtk.AccelLabel
which display an associated accelerator should connect to this signal, and rebuild their visual representation if the accel_closure is theirs.
Property Details¶
- Gtk.AccelGroup.props.is_locked¶
-
Is the accel group locked
- Gtk.AccelGroup.props.modifier_mask¶
- Name:
modifier-mask
- Type:
- Default Value:
Gdk.ModifierType.SHIFT_MASK
|Gdk.ModifierType.CONTROL_MASK
|Gdk.ModifierType.MOD1_MASK
|Gdk.ModifierType.SUPER_MASK
|Gdk.ModifierType.HYPER_MASK
|Gdk.ModifierType.META_MASK
|Gdk.ModifierType.MODIFIER_MASK
- Flags:
Modifier Mask