HotkeyRegistry#
- class omni.kit.hotkeys.core.HotkeyRegistry#
Bases:
objectRegistry of hotkeys.
Methods
__init__()Define hotkey registry object.
Clear user defined hotkeys.
Deregister hotkeys registered from a special extension.
Deregister hotkeys registered with speicial filter.
deregister_hotkey(*args, **kwargs)Deregister hotkey by hotkey object or arguments.
deregister_hotkeys(hotkey_ext_id, key)Deregister hotkeys registered from a special extension with special key combination.
disable_hotkey(hotkey)Disable a system hotkey.
edit_hotkey(hotkey, key, filter)Change key combination of hotkey object.
export_storage(url)Export user defined hotkeys to file.
Discover all registered hotkeys.
get_all_hotkeys_for_extension(hotkey_ext_id)Discover hotkeys registered from a special extension.
get_all_hotkeys_for_filter(filter)Discover hotkeys registered with speicial filter.
Discover hotkeys registered from a special key.
get_hotkey(hotkey_ext_id, key[, filter])Discover a registered hotkey.
get_hotkey_default(hotkey)Discover hotkey default key binding and filter.
get_hotkey_for_filter(key, filter)Discover hotkey registered with special key combination and filter
get_hotkey_for_trigger(key[, context, window])Discover hotkey for trigger from key combination and filter.
get_hotkeys(hotkey_ext_id, key)Discover hotkeys registered from a special extension with special key combination.
has_duplicated_hotkey(hotkey)Check if already have hotkey registered.
import_storage(url)Import user defined hotkeys from file.
is_user_hotkey(hotkey)If a user defined hotkey.
register_hotkey(*args, **kwargs)Register hotkey by hotkey object or arguments.
Clean user defined hotkeys and restore system hotkey to default
switch_layout(layout_name)Change keyboard layout.
verify_hotkey(hotkey[, key_combination, ...])Verify hotkey.
Attributes
Current keyboard layout object in using.
Error code for last hotkey command.
- __init__()#
Define hotkey registry object.
- clear_storage() None#
Clear user defined hotkeys.
- deregister_all_hotkeys_for_extension(
- hotkey_ext_id: str | None,
Deregister hotkeys registered from a special extension.
- Parameters:
hotkey_ext_id (Optional[str]) – Extension id that hotkeys belongs to. If None, discover all global hotkeys
- deregister_all_hotkeys_for_filter(
- filter: HotkeyFilter,
Deregister hotkeys registered with speicial filter.
- Parameters:
filter (HotkeyFilter) – Hotkey HotkeyFilter.
- deregister_hotkey(*args, **kwargs) bool#
Deregister hotkey by hotkey object or arguments.
Args could be:
deregister_hotkey(hotkey: Hotkey)
or
deregister_hotkey( hotkey_ext_id: str, key: Union[str, KeyCombination], filter: Optional[HotkeyFilter] = None )
- Returns:
True if hotkey found. Otherwise return False.
- deregister_hotkeys(
- hotkey_ext_id: str,
- key: str | KeyCombination,
Deregister hotkeys registered from a special extension with special key combination.
- Parameters:
hotkey_ext_id (str) – Extension id that hotkeys belongs to.
key (Union[str, KeyCombination]) – Key combination.
- disable_hotkey(
- hotkey: Hotkey,
Disable a system hotkey. Disable means: - Deregister the hotkey immediately - If the hotkey is a system hotkey, do not make it work even register again until preset reset
- Parameters:
[Hotkey] (hotkey) – Hotkey object
- Returns:
True if hotkey found. Otherwise return False.
- edit_hotkey(
- hotkey: Hotkey,
- key: str | KeyCombination,
- filter: HotkeyFilter | None,
Change key combination of hotkey object.
- Parameters:
hotkey (Hotkey) – Hotkey object to change.
key (Union[str, KeyCombination]) – New key combination.
filter (Optional[HotkeyFiler]) – New filter.
- Returns:
Result code.
- export_storage(url: str) None#
Export user defined hotkeys to file.
- Parameters:
url (str) – File path to export user defined hotkeys.
- get_all_hotkeys() List[Hotkey]#
Discover all registered hotkeys.
- Returns:
List of all registered hotkeys.
- get_all_hotkeys_for_extension(
- hotkey_ext_id: str | None,
Discover hotkeys registered from a special extension.
- Parameters:
hotkey_ext_id (Optional[str]) – Extension id that hotkeys belongs to. If None, discover all global hotkeys
- Returns:
List of discovered hotkeys.
- get_all_hotkeys_for_filter(
- filter: HotkeyFilter,
Discover hotkeys registered with speicial filter.
- Parameters:
filter (HotkeyFilter) – Hotkey HotkeyFilter.
- Returns:
List of discovered hotkeys.
- get_all_hotkeys_for_key(
- key: str | KeyCombination,
Discover hotkeys registered from a special key.
- Parameters:
key (Union[str, KeyCombination]) – Key combination.
- Returns:
List of discovered hotkeys.
- get_hotkey(
- hotkey_ext_id: str,
- key: str | KeyCombination,
- filter: HotkeyFilter | None = None,
Discover a registered hotkey.
- Parameters:
hotkey_ext_id (str) – Extension id which owns the hotkey.
key (Union[str, KeyCombination]) – Key combination.
- Keyword Arguments:
filter (Optional[HotkeyFilter]) – Hotkey filter. Default None
- Returns:
Hotkey object if discovered. Otherwise None.
- get_hotkey_default(
- hotkey: Hotkey,
Discover hotkey default key binding and filter.
- Parameters:
hotkey (Hotkey) – Hotkey object.
- Returns:
Tuple of key binding string and hotkey filter object.
- get_hotkey_for_filter(
- key: str | KeyCombination,
- filter: HotkeyFilter,
Discover hotkey registered with special key combination and filter
- Parameters:
key (Union[str, KeyCombination]) – Key combination.
filter (HotkeyFilter) – Hotkey filter.
- Returns:
First discovered hotkey. None if nothing found.
- get_hotkey_for_trigger(
- key: str | KeyCombination,
- context: str | None = None,
- window: str | None = None,
Discover hotkey for trigger from key combination and filter.
- Parameters:
key (Union[str, KeyCombination]) – Key combination.
- Keyword Arguments:
context (str) – Context assigned to Hotkey
window (str) – Window assigned to Hotkey
- Returns:
Hotkey object if discovered. Otherwise None.
- get_hotkeys(
- hotkey_ext_id: str,
- key: str | KeyCombination,
Discover hotkeys registered from a special extension with special key combination.
- Parameters:
hotkey_ext_id (str) – Extension id that hotkeys belongs to.
key (Union[str, KeyCombination]) – Key combination.
- Returns:
List of discovered hotkeys.
- has_duplicated_hotkey(
- hotkey: Hotkey,
Check if already have hotkey registered.
- Parameters:
hotkey (Hotkey) – Hotkey object to check.
- Returns:
Result code.
- import_storage(url: str) bool#
Import user defined hotkeys from file.
- Parameters:
url (str) – File path to import user defined hotkeys.
- is_user_hotkey(
- hotkey: Hotkey,
If a user defined hotkey.
- Parameters:
hotkey (Hotkey) – Hotkey object.
- Returns:
True if user defined. Otherwise False.
- register_hotkey(
- *args,
- **kwargs,
Register hotkey by hotkey object or arguments.
Args could be:
register_hotkey(hotkey: Hotkey)
or
register_hotkey( hotkey_ext_id: str, key: Union[str, KeyCombination], action_ext_id: str, action_id: str, filter: Optional[HotkeyFilter] = None )
- Returns:
Created hotkey object if register succeeded. Otherwise return None.
- restore_defaults() None#
Clean user defined hotkeys and restore system hotkey to default
- switch_layout(layout_name: str) None#
Change keyboard layout.
- Parameters:
layout_name (str) – Name of keyboard layout to use.
- verify_hotkey(
- hotkey: Hotkey,
- key_combination: KeyCombination | None = None,
- hotkey_filter: HotkeyFilter | None = None,
Verify hotkey.
- property keyboard_layout: KeyboardLayoutDelegate | None#
Current keyboard layout object in using.
- property last_error: Result#
Error code for last hotkey command.