Having odd issues with keyboard shortcuts (again). I have code set up like in the script repository:
shortcuts = [
('p', lambda: hh_select_paint()),
('[', lambda: hh_select_erase()),
(']', lambda: hh_select_scissors()),
('\\', lambda: hh_select_islands()),
(';', lambda: hh_place_fiducial()),
('s', lambda: toggleSphereBrush()),
('`', lambda: cycleEffect(1)),
('~', lambda: cycleEffect(-1)),
('Ctrl+m', lambda: slicer.util.selectModule('Models')),
('S', lambda: slicer.util.selectModule('SegmentEditor')),
('U', lambda: slicer.util.selectModule('Markups')),
('D', lambda: slicer.util.selectModule('Data')),
]
for (shortcutKey, callback) in shortcuts:
shortcut = qt.QShortcut(slicer.util.mainWindow())
shortcut.setKey(qt.QKeySequence(shortcutKey))
shortcut.connect( 'activated()', callback)
I’ve put debug prints in my various functions to do stuff (toggleSphereBrush()
) and they don’t get executed, but interestingly, the backtick and tilde shortcuts do work.
If I reassign backtick or tilde to my functions, my functions get called.
Are those other keys getting caught somewhere else?
THANKS!!