bgdev.utils.hotkey

Easily create custom hotkey.

created

11/02/2019

author

Benoit GIELLY <benoit.gielly@gmail.com>

create_hotkey(name, command, keys, edit=False, annotation='New user script', category='custom', language='python')[source]

Create a user hotkey with its namedCommand.

Parameters
  • name (str) – Name of the command to attach to a hotkey

  • command (str) – The command to run. Must be an executable string.

  • keys (str) – The hotkey to use. If you want modifiers, add them before the keyboard key and separate them with “+”. Eg. “alt+shift+A”.

  • edit (bool) – If a command already exists and you want to update it.

  • annotation (str) – Add an annotation to the command/hotkey

  • category (str) – The category in which you add the command. Default is “Custom Scripts.custom”

  • language (str) – The source language used by the command. Must be either “mel” or “python”

create_hotkeys_from_yaml(path=None)[source]

Quickly re-create custom hotkeys from a yaml file.

valid_keyset()[source]

Make sure the current hotkey set is valid.