Dazzle.ShortcutController

g Dazzle.ShortcutController Dazzle.ShortcutController GObject.Object GObject.Object GObject.Object->Dazzle.ShortcutController

Subclasses:

None

Methods

Inherited:

GObject.Object (37)

Structs:

GObject.ObjectClass (5)

class

find (widget)

class

new (widget)

class

try_find (widget)

add_command_action (command_id, default_accel, phase, action)

add_command_callback (command_id, default_accel, phase, callback, *callback_data)

execute_command (command)

get_context ()

get_context_for_phase (phase)

get_current_chord ()

get_manager ()

get_widget ()

remove_accel (accel, phase)

set_context_by_name (name)

set_manager (manager)

Virtual Methods

Inherited:

GObject.Object (7)

Properties

Name

Type

Flags

Short Description

context

Dazzle.ShortcutContext

r

The current context of the controller, for dispatch phase

current-chord

Dazzle.ShortcutChord

r

The current chord for the controller

manager

Dazzle.ShortcutManager

r/w/en

The shortcut manager

widget

Gtk.Widget

r/w/co

The widget for which the controller attached

Signals

Inherited:

GObject.Object (1)

Name

Short Description

reset

This signal is emitted when the shortcut controller is requesting the widget to reset any state it may have regarding the shortcut controller.

set-context-named

This changes the current context on the Dazzle.ShortcutController to be the context matching name.

Fields

Inherited:

GObject.Object (1)

Class Details

class Dazzle.ShortcutController(**kwargs)
Bases:

GObject.Object

Abstract:

No

Structure:

Dazzle.ShortcutControllerClass

classmethod find(widget)
Parameters:

widget (Gtk.Widget) –

Returns:

An Dazzle.ShortcutController or None.

Return type:

Dazzle.ShortcutController

Finds the registered Dazzle.ShortcutController for a widget.

The controller is created if it does not already exist.

classmethod new(widget)
Parameters:

widget (Gtk.Widget) –

Return type:

Dazzle.ShortcutController

classmethod try_find(widget)
Parameters:

widget (Gtk.Widget) –

Returns:

An Dazzle.ShortcutController or None.

Return type:

Dazzle.ShortcutController or None

Finds the registered Dazzle.ShortcutController for a widget.

If no controller is found, None is returned.

add_command_action(command_id, default_accel, phase, action)
Parameters:
add_command_callback(command_id, default_accel, phase, callback, *callback_data)
Parameters:
execute_command(command)
Parameters:

command (str) – the id of the command

Returns:

True if the command was found and executed.

Return type:

bool

This method will locate and execute the command matching the id command.

If the command is not found, False is returned.

get_context()
Returns:

A Dazzle.ShortcutContext or None.

Return type:

Dazzle.ShortcutContext or None

This function gets the Dazzle.ShortcutController :context property, which is the current context to dispatch events to. An Dazzle.ShortcutContext is a group of keybindings that may be activated in response to a single or series of Gdk.EventKey.

New in version 3.26.

get_context_for_phase(phase)
Parameters:

phase (Dazzle.ShortcutPhase) – the phase for the shorcut delivery

Returns:

A Dazzle.ShortcutContext or None.

Return type:

Dazzle.ShortcutContext or None

Controllers can have a different context for a particular phase, which allows them to activate different keybindings depending if the event in capture, bubble, or dispatch.

New in version 3.26.

get_current_chord()
Returns:

A Dazzle.ShortcutChord or None.

Return type:

Dazzle.ShortcutChord or None

This method gets the Dazzle.ShortcutController :current-chord property. This is useful if you want to monitor in-progress chord building.

Note that this value will only be valid on the controller for the toplevel widget (a Gtk.Window). Chords are not tracked at the individual widget controller level.

get_manager()
Returns:

A Dazzle.ShortcutManager.

Return type:

Dazzle.ShortcutManager

Gets the Dazzle.ShortcutManager associated with this controller.

Generally, this will look for the root controller’s manager as mixing and matching managers in a single window hierarchy is not supported.

get_widget()
Returns:

the widget for the controller

Return type:

Gtk.Widget

New in version 3.34.

remove_accel(accel, phase)
Parameters:
set_context_by_name(name)
Parameters:

name (str or None) – The name of the context

Changes the context for the controller to the context matching name.

Contexts are resolved at runtime through the current theme (and possibly a parent theme if it inherits from one).

New in version 3.26.

set_manager(manager)
Parameters:

manager (Dazzle.ShortcutManager or None) – A Dazzle.ShortcutManager or None

Sets the Dazzle.ShortcutController :manager property.

If you set this to None, it will revert to the default Dazzle.ShortcutManager for the process.

Signal Details

Dazzle.ShortcutController.signals.reset(shortcut_controller)
Signal Name:

reset

Flags:

RUN_LAST, ACTION

Parameters:

shortcut_controller (Dazzle.ShortcutController) – The object which received the signal

This signal is emitted when the shortcut controller is requesting the widget to reset any state it may have regarding the shortcut controller. Such an example might be a modal system that lives outside the controller whose state should be cleared in response to the controller changing modes.

Dazzle.ShortcutController.signals.set_context_named(shortcut_controller, name)
Signal Name:

set-context-named

Flags:

RUN_LAST, ACTION

Parameters:

This changes the current context on the Dazzle.ShortcutController to be the context matching name. This is found by looking up the context by name in the active Dazzle.ShortcutTheme.

Property Details

Dazzle.ShortcutController.props.context
Name:

context

Type:

Dazzle.ShortcutContext

Default Value:

None

Flags:

READABLE

The current context of the controller, for dispatch phase

Dazzle.ShortcutController.props.current_chord
Name:

current-chord

Type:

Dazzle.ShortcutChord

Default Value:

None

Flags:

READABLE

The current chord for the controller

Dazzle.ShortcutController.props.manager
Name:

manager

Type:

Dazzle.ShortcutManager

Default Value:

None

Flags:

READABLE, WRITABLE, EXPLICIT_NOTIFY

The shortcut manager

Dazzle.ShortcutController.props.widget
Name:

widget

Type:

Gtk.Widget

Default Value:

None

Flags:

READABLE, WRITABLE, CONSTRUCT_ONLY

The widget for which the controller attached