Gtk.AccelGroup - Classes - Gtk 3.0 (original) (raw)

g GObject.Object GObject.Object Gtk.AccelGroup Gtk.AccelGroup GObject.Object->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 ()

Virtual Methods

Inherited:

GObject.Object (7)

do_accel_changed (keyval, modifier, accel_closure)

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.AccelGroup and 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.

Fields

Inherited:

GObject.Object (1)

Name Type Access Description
parent GObject.Object r

Class Details

class Gtk.AccelGroup(**kwargs)

Bases:

GObject.Object

Abstract:

No

Structure:

Gtk.AccelGroupClass

A Gtk.AccelGroup represents a group of keyboard accelerators, typically attached to a toplevel Gtk.Window (withGtk.Window.add_accel_group()). Usually you won’t need to create aGtk.AccelGroup directly; 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. SeeGtk.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.AccelGroup to which closureis connected, or None

Return type:

Gtk.AccelGroup or None

Finds the Gtk.AccelGroup to which closure is connected; see Gtk.AccelGroup.connect().

classmethod new()[source]

Returns:

a new Gtk.AccelGroup object

Return type:

Gtk.AccelGroup

Creates a new Gtk.AccelGroup.

activate(accel_quark, acceleratable, accel_key, accel_mods)[source]

Parameters:

Returns:

True if an accelerator was activated and handled this keypress

Return type:

bool

Finds the first accelerator in self that matchesaccel_key and accel_mods, and activates it.

connect(accel_key, accel_mods, accel_flags, closure)[source]

Parameters:

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:

Installs an accelerator in this group, using an accelerator path to look up the appropriate key and modifiers (seeGtk.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 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 or None) – the closure to remove from this accelerator group, or None to remove all closures

Returns:

True if the closure was found and got disconnected

Return type:

bool

Removes an accelerator previously installed throughGtk.AccelGroup.connect().

Since 2.20 closure can be None.

disconnect_key(accel_key, accel_mods)[source]

Parameters:

Returns:

True if there was an accelerator which could be removed, False otherwise

Return type:

bool

Removes an accelerator previously installed throughGtk.AccelGroup.connect().

find(find_func, *data)[source]

Parameters:

Returns:

the key of the first entry passingfind_func. The key is owned by GTK+ and must not be freed.

Return type:

Gtk.AccelKey

Finds the first entry in an accelerator group for whichfind_func returns True and returns its Gtk.AccelKey.

get_is_locked()[source]

Returns:

True if there are 1 or more locks on the self,False otherwise.

Return type:

bool

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:

Gdk.ModifierType

Gets a Gdk.ModifierType representing the mask for thisself. 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 toGtk.AccelMap.change_entry() about runtime accelerator changes.

If called more than once, self remains locked untilGtk.AccelGroup.unlock() has been called an equivalent number of times.

query(accel_key, accel_mods)[source]

Parameters:

Returns:

an array ofn_entries Gtk.AccelGroupEntry elements, 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_keyand accel_mods.

unlock()[source]

Undoes the last call to Gtk.AccelGroup.lock() on this self.

do_accel_changed(keyval, modifier, accel_closure) virtual

Parameters:

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:

DETAILED

Parameters:

Returns:

True if the accelerator was activated

Return type:

bool

The accel-activate signal is an implementation detail ofGtk.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:

RUN_FIRST, DETAILED

Parameters:

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

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