Fix handling of </> keys

This commit is contained in:
Florian Bruhin 2018-03-04 20:40:16 +01:00
parent 910bbc8521
commit 0967b6abd2
2 changed files with 16 additions and 0 deletions

View File

@ -184,6 +184,8 @@ def _parse_special_key(keystr):
('windows', 'meta'),
('mod1', 'alt'),
('mod4', 'meta'),
('less', '<'),
('greater', '>'),
)
for (orig, repl) in replacements:
keystr = keystr.replace(orig, repl)

View File

@ -355,6 +355,20 @@ class TestKeySequence:
('<Control-x><Meta-y>',
keyutils.KeySequence(Qt.ControlModifier | Qt.Key_X,
Qt.MetaModifier | Qt.Key_Y)),
('>', keyutils.KeySequence(Qt.Key_Greater)),
('<', keyutils.KeySequence(Qt.Key_Less)),
('a>', keyutils.KeySequence(Qt.Key_A, Qt.Key_Greater)),
('a<', keyutils.KeySequence(Qt.Key_A, Qt.Key_Less)),
('>a', keyutils.KeySequence(Qt.Key_Greater, Qt.Key_A)),
('<a', keyutils.KeySequence(Qt.Key_Less, Qt.Key_A)),
('<alt+greater>',
keyutils.KeySequence(Qt.Key_Greater | Qt.AltModifier)),
('<alt+less>',
keyutils.KeySequence(Qt.Key_Less | Qt.AltModifier)),
('<alt+<>', keyutils.KeyParseError),
('<alt+>>', keyutils.KeyParseError),
('<blub>', keyutils.KeyParseError),
('\U00010000', keyutils.KeyParseError),
])