lightspeed.trex.hotkeys#

  • SPDX-FileCopyrightText: Copyright (c) 2024 NVIDIA CORPORATION & AFFILIATES. All rights reserved.

  • SPDX-License-Identifier: Apache-2.0

  • Licensed under the Apache License, Version 2.0 (the “License”);

  • you may not use this file except in compliance with the License.

  • You may obtain a copy of the License at

  • https://www.apache.org/licenses/LICENSE-2.0

  • Unless required by applicable law or agreed to in writing, software

  • distributed under the License is distributed on an “AS IS” BASIS,

  • WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

  • See the License for the specific language governing permissions and

  • limitations under the License.

class lightspeed.trex.hotkeys.AppHotkey(
action_id: str,
key: KeyCombination,
action: Callable[[], None],
display_name: str,
description: str,
)#

Bases: object

Wrapper around omni.kit.hotkeys.core.Hotkey to help manage registration and de-registration of app hotkeys.

destroy()#

Cleanup and de-register hooks

class lightspeed.trex.hotkeys.HotkeyEvent(value)#

Bases: Enum

Supported hotkey triggers

class lightspeed.trex.hotkeys.HotkeyManager#

Bases: object

Manager to define and subscribe to app hotkeys.

Use this to register common hotkeys that may be supported by more than one extension or process and may depend on a specific app context.

Since these use events/subscriptions multiple actions can be attached to one hotkey event.

define_hotkey_event(
hotkey_event: HotkeyEvent,
hotkey_display_name,
hotkey_description=None,
)#

Declare a supported hotkey.

Parameters:
  • hotkey_event – hotkey trigger to support

  • hotkey_display_name – Display name for hotkey action

  • hotkey_description – Description for hotkey action

destroy()#

Cleanup and de-register all hotkey hooks owned by this manager

subscribe_hotkey_event(
hotkey_event,
fn,
context: '_TrexContexts' | None = None,
enable_fn: Callable[[], bool] | None = None,
) EventSubscription#

Return the subscription object that will automatically unsubscribe when destroyed.

Parameters:
  • hotkey_event – User action triggered

  • fn – Callable to be called on hotkey event

  • context – Optionally provide the app context where this hotkey will be active.

  • enable_fn – Optionally provide an additional callback to filter events. If the callback returns True then the fn will be called.

class lightspeed.trex.hotkeys.TrexHotkeyEvent(value)#

Bases: HotkeyEvent

Trex Specific HotkeyEvents

CTRL_S = CTRL + S (On Press)#
CTRL_SHIFT_S = SHIFT + CTRL + S (On Press)#
CTRL_T = CTRL + T (On Press)#
CTRL_Y = CTRL + Y (On Press)#
CTRL_Z = CTRL + Z (On Press)#
ESC = ESCAPE (On Press)#
F = F (On Press)#
class lightspeed.trex.hotkeys.TrexHotkeysExtension#

Bases: IExt

on_shutdown()#
on_startup(ext_id)#
lightspeed.trex.hotkeys.get_global_hotkey_manager() HotkeyManager#