Force keybindings to lower case
This commit is contained in:
parent
d45e883f6d
commit
ea84ce7acf
@ -113,7 +113,7 @@ class BaseKeyParser(QObject):
|
|||||||
Return:
|
Return:
|
||||||
True if event has been handled, False otherwise.
|
True if event has been handled, False otherwise.
|
||||||
"""
|
"""
|
||||||
binding = keyevent_to_string(e)
|
binding = keyevent_to_string(e).lower()
|
||||||
try:
|
try:
|
||||||
cmdstr = self.special_bindings[binding]
|
cmdstr = self.special_bindings[binding]
|
||||||
except KeyError:
|
except KeyError:
|
||||||
|
@ -117,12 +117,12 @@ class ReadConfigTests(unittest.TestCase):
|
|||||||
supports_chains=True)
|
supports_chains=True)
|
||||||
kp.read_config('test')
|
kp.read_config('test')
|
||||||
self.assertIn('ccc', kp.bindings)
|
self.assertIn('ccc', kp.bindings)
|
||||||
self.assertIn('Ctrl+A', kp.special_bindings)
|
self.assertIn('ctrl+a', kp.special_bindings)
|
||||||
kp.read_config('test2')
|
kp.read_config('test2')
|
||||||
self.assertNotIn('ccc', kp.bindings)
|
self.assertNotIn('ccc', kp.bindings)
|
||||||
self.assertNotIn('Ctrl+A', kp.special_bindings)
|
self.assertNotIn('ctrl+a', kp.special_bindings)
|
||||||
self.assertIn('foo', kp.bindings)
|
self.assertIn('foo', kp.bindings)
|
||||||
self.assertIn('Ctrl+X', kp.special_bindings)
|
self.assertIn('ctrl+x', kp.special_bindings)
|
||||||
|
|
||||||
|
|
||||||
class SpecialKeysTests(unittest.TestCase):
|
class SpecialKeysTests(unittest.TestCase):
|
||||||
|
@ -486,12 +486,12 @@ class NormalizeTests(unittest.TestCase):
|
|||||||
def test_normalize(self):
|
def test_normalize(self):
|
||||||
"""Test normalize with some strings."""
|
"""Test normalize with some strings."""
|
||||||
strings = (
|
strings = (
|
||||||
('Control+x', 'Ctrl+X'),
|
('Control+x', 'ctrl+x'),
|
||||||
('Windows+x', 'Meta+X'),
|
('Windows+x', 'meta+x'),
|
||||||
('Mod1+x', 'Alt+X'),
|
('Mod1+x', 'alt+x'),
|
||||||
('Mod4+x', 'Meta+X'),
|
('Mod4+x', 'meta+x'),
|
||||||
('Control--', 'Ctrl+-'),
|
('Control--', 'ctrl+-'),
|
||||||
('Windows++', 'Meta++'),
|
('Windows++', 'meta++'),
|
||||||
)
|
)
|
||||||
for orig, repl in strings:
|
for orig, repl in strings:
|
||||||
self.assertEqual(utils.normalize_keystr(orig), repl, orig)
|
self.assertEqual(utils.normalize_keystr(orig), repl, orig)
|
||||||
|
@ -461,4 +461,4 @@ def normalize_keystr(keystr):
|
|||||||
keystr = keystr.replace(orig, repl)
|
keystr = keystr.replace(orig, repl)
|
||||||
for mod in ('Ctrl', 'Meta', 'Alt', 'Shift'):
|
for mod in ('Ctrl', 'Meta', 'Alt', 'Shift'):
|
||||||
keystr = keystr.replace(mod + '-', mod + '+')
|
keystr = keystr.replace(mod + '-', mod + '+')
|
||||||
return keystr
|
return keystr.lower()
|
||||||
|
Loading…
Reference in New Issue
Block a user