Gtk.AccelGroup¶
| Subclasses: | None | 
|---|
Methods¶
| Inherited: | GObject.Object (37) | 
|---|---|
| Structs: | GObject.ObjectClass (5) | 
| class | from_accel_closure(closure) | 
| class | new() | 
| activate(accel_quark, acceleratable, accel_key, accel_mods) | |
| connect(accel_key, accel_mods, accel_flags, closure) | |
| connect_by_path(accel_path, closure) | |
| disconnect(closure) | |
| disconnect_key(accel_key, accel_mods) | |
| find(find_func, *data) | |
| get_is_locked() | |
| get_modifier_mask() | |
| lock() | |
| query(accel_key, accel_mods) | |
| unlock() | 
Properties¶
| Name | Type | Flags | Short Description | 
|---|---|---|---|
| is-locked | bool | r | Is the accel group locked | 
| modifier-mask | Gdk.ModifierType | r | Modifier Mask | 
Signals¶
| Inherited: | GObject.Object (1) | 
|---|
| Name | Short Description | 
|---|---|
| accel-activate | The accel-activate signal is an implementation detail of Gtk.AccelGroupand not meant to be used by applications. | 
| accel-changed | The accel-changed signal is emitted when an entry is added to or removed from the accel group. | 
Class Details¶
- 
class Gtk.AccelGroup(**kwargs)¶
- Bases: - GObject.Object- Abstract: - No - Structure: - Gtk.AccelGroupClass- A - Gtk.AccelGrouprepresents a group of keyboard accelerators, typically attached to a toplevel- Gtk.Window(with- Gtk.Window.add_accel_group()). Usually you won’t need to create a- Gtk.AccelGroupdirectly; instead, when using- Gtk.UIManager, GTK+ automatically sets up the accelerators for your menus in the ui manager’s- Gtk.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) – a- GObject.Closure- Returns: - the - Gtk.AccelGroupto which closure is connected, or- None- Return type: - Gtk.AccelGroupor- None- Finds the - Gtk.AccelGroupto which closure is connected; see- Gtk.AccelGroup.connect().
 - 
classmethod new()[source]¶
- Returns: - a new - Gtk.AccelGroupobject- Return type: - Gtk.AccelGroup- Creates a new - Gtk.AccelGroup.
 - 
activate(accel_quark, acceleratable, accel_key, accel_mods)[source]¶
- Parameters: - accel_quark (int) – the quark for the accelerator name
- acceleratable (GObject.Object) – theGObject.Object, usually aGtk.Window, on which to activate the accelerator
- accel_key (int) – accelerator keyval from a key event
- accel_mods (Gdk.ModifierType) – keyboard state mask from a key event
 - Returns: - Trueif 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. 
- accel_quark (
 - 
connect(accel_key, accel_mods, accel_flags, closure)[source]¶
- Parameters: - accel_key (int) – key value of the accelerator
- accel_mods (Gdk.ModifierType) – modifier combination of the accelerator
- accel_flags (Gtk.AccelFlags) – a flag mask to configure this accelerator
- closure (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 from- Gtk.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. 
- accel_key (
 - 
connect_by_path(accel_path, closure)[source]¶
- Parameters: - accel_path (str) – path used for determining key and modifiers
- closure (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 to- Gtk.accel_groups_activate(), closure will be invoked if the accel_key and accel_mods from- Gtk.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().
- accel_path (
 - 
disconnect(closure)[source]¶
- Parameters: - closure ( - GObject.Closureor- None) – the closure to remove from this accelerator group, or- Noneto remove all closures- Returns: - Trueif the closure was found and got disconnected- Return type: - bool- 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 accelerator
- accel_mods (Gdk.ModifierType) – modifier combination of the accelerator
 - Returns: - Trueif there was an accelerator which could be removed,- Falseotherwise- Return type: - Removes an accelerator previously installed through - Gtk.AccelGroup.connect().
- accel_key (
 - 
find(find_func, *data)[source]¶
- Parameters: - find_func (Gtk.AccelGroupFindFunc) – a function to filter the entries of self with
- data (objectorNone) – data to pass to find_func
 - 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 - Trueand returns its- Gtk.AccelKey.
- find_func (
 - 
get_is_locked()[source]¶
- Returns: - Trueif there are 1 or more locks on the self,- Falseotherwise.- Return type: - bool- Locks are added and removed using - Gtk.AccelGroup.lock() and- Gtk.AccelGroup.unlock().- New in version 2.14. 
 - 
get_modifier_mask()[source]¶
- Returns: - the modifier mask for this accel group. - Return type: - Gdk.ModifierType- Gets a - Gdk.ModifierTyperepresenting 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 accelerator
- accel_mods (Gdk.ModifierType) – modifier combination of the accelerator
 - Returns: - an array of n_entries - Gtk.AccelGroupEntryelements, or- None. The array is owned by GTK+ and must not be freed.- Return type: - [ - Gtk.AccelGroupEntry] or- None- Queries an accelerator group for all entries matching accel_key and accel_mods. 
- accel_key (
 - 
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) –
 
- keyval (
 
- 
classmethod 
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 signal
- acceleratable (GObject.Object) – the object on which the accelerator was activated
- keyval (int) – the accelerator keyval
- modifier (Gdk.ModifierType) – the modifier combination of the accelerator
 - Returns: - Trueif the accelerator was activated- Return type: - The accel-activate signal is an implementation detail of - Gtk.AccelGroupand not meant to be used by applications.
- accel_group (
- 
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 signal
- keyval (int) – the accelerator keyval
- modifier (Gdk.ModifierType) – the modifier combination of the accelerator
- accel_closure (GObject.Closure) – theGObject.Closureof the accelerator
 - The accel-changed signal is emitted when an entry is added to or removed from the accel group. - Widgets like - Gtk.AccelLabelwhich display an associated accelerator should connect to this signal, and rebuild their visual representation if the accel_closure is theirs.
- accel_group (
Property Details¶
- 
Gtk.AccelGroup.props.is_locked¶
- Name: - is-locked- Type: - bool- Default Value: - False- Flags: - READABLE- Is the accel group locked 
- 
Gtk.AccelGroup.props.modifier_mask¶
- Name: - modifier-mask- Type: - Gdk.ModifierType- 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: - READABLE- Modifier Mask