ID 332478 - KeyboardShortcutManager: Exception when registering an already-in-use shortcut

Follow

Problem summary:

If multiple Hydra viewer manipulators attempt to use the same keyboard shortcut (including no shortcut at all), an exception is raised that stops the Hydra Viewer tab from being initialized. 

Test 1

  • Open Katana.
  • Open a Python tab.
  • Register a new keyboard shortcut (which happens to be already in use):

keyboardShortcutManager = UI4.App.KeyboardShortcutManagerkeyboardShortcutManager.RegisterKeyEvent(    "HydraViewerTab",    "this_is_supposed_to_an_unique_id",    "Turn Heating On",    "H")
  • With the fix: A log message will be printed to the console (Unable to register key event with ID...)
  • Withou the fix: An exception is raised in red in the Python tab.

Test 2

  • Get a copy of the Katana source code.
  • Change the keyboard shortcut of the Translate manipulators from "W" to "E", which is used by the Rotate manipulators (see FnGLTranslateManipulator.h).
  • Recompile Katana.
  • Open Katana.
  • Open the Hydra Viewer.
  • With the fix: A log message will be printed to the console (Unable to register key event with ID...)
  • Without the fix: An exception is raised and will stop the Hydra Viewer tab from starting up.

Expected behaviour:

Manipulators with clashing shortcuts should still appear in the menu, but not be activated by a keyboard shortcut. Also the hydra viewer shouldn't crash.

Actual behaviour:

The following exception is raised and the Hydra Viewer tab fails to load.


Error creating "Viewer (Hydra)" tab: KeyError: 'f07372a4dd26c0b0311f8bf0cfad298c'    UI4.App.Tabs    2018-02-07T12:41:45Traceback (most recent call last):  File "C:\workspace\excalibur\Apps\Katana\objects\win-64-x86-Debug-14.0.24210-dynamic\Dist/bin/python\UI4\App\Tabs.py", line 427, in CreateTab    widget = plugin.data(parent)  File "C:\workspace\excalibur\Apps\Katana\objects\win-64-x86-Debug-14.0.24210-dynamic\Dist/bin/python\UI4\App\KeyboardShortcutManager\KeyboardShortcutManagerMixin.py", line 75, in __call__    result = type.__call__(self, *args, **kwargs)  File "C:\workspace\excalibur\Apps\Katana\objects\win-64-x86-Debug-14.0.24210-dynamic\Dist\bin\python\UI4\Tabs\HydraViewer\HydraViewerTab.py", line 208, in __init__    self.__viewerDelegate)  File "C:\workspace\excalibur\Apps\Katana\objects\win-64-x86-Debug-14.0.24210-dynamic\Dist\bin\python\UI4\Tabs\HydraViewer\ManipulatorManager.py", line 299, in __init__    self.__initializeManipulators()  File "C:\workspace\excalibur\Apps\Katana\objects\win-64-x86-Debug-14.0.24210-dynamic\Dist\bin\python\UI4\Tabs\HydraViewer\ManipulatorManager.py", line 605, in __initializeManipulators    lambda tab, manipulatorName=manipulatorName:  File "C:\workspace\excalibur\Apps\Katana\objects\win-64-x86-Debug-14.0.24210-dynamic\Dist/bin/python\UI4\App\KeyboardShortcutManager\KeyboardShortcutManagerMixin.py", line 177, in registerKeyboardShortcut    keyReleaseCallback)  File "C:\workspace\excalibur\Apps\Katana\objects\win-64-x86-Debug-14.0.24210-dynamic\Dist/bin/python\UI4\App\KeyboardShortcutManager\KeyboardShortcutManager.py", line 307, in RegisterKeyEvent    __keyEvents[keyEventID]["name"])KeyError: 'f07372a4dd26c0b0311f8bf0cfad298c'

Workaround:

Ensure all manipulators have a unique keyboard shortcut.

Reproduced versions/platforms:

  • 3.0v1a7

Customer version/platform:

Not supplied

    We're sorry to hear that

    Please tell us why