Change the way Space keybindings are handled
Using it as " " in a keystring won't work anymore, but instead <Space> and <Shift-Space> does.
This commit is contained in:
parent
da60d11b24
commit
7f8508a367
@ -40,7 +40,7 @@ _MODIFIER_MAP = {
|
||||
|
||||
|
||||
def is_printable(key):
|
||||
return key <= 0xff
|
||||
return key <= 0xff and key != Qt.Key_Space
|
||||
|
||||
|
||||
def is_modifier_key(key):
|
||||
@ -221,7 +221,7 @@ class KeyInfo:
|
||||
modifiers &= ~_MODIFIER_MAP[self.key]
|
||||
elif is_printable(self.key):
|
||||
# "normal" binding
|
||||
assert len(key_string) == 1 or self.key == Qt.Key_Space, key_string
|
||||
assert len(key_string) == 1, key_string
|
||||
if self.modifiers == Qt.ShiftModifier:
|
||||
return key_string.upper()
|
||||
elif self.modifiers == Qt.NoModifier:
|
||||
|
@ -122,6 +122,8 @@ class TestKeyToString:
|
||||
(Qt.Key_A, Qt.NoModifier, 'a'),
|
||||
(Qt.Key_A, Qt.ShiftModifier, 'A'),
|
||||
|
||||
(Qt.Key_Space, Qt.NoModifier, '<Space>'),
|
||||
(Qt.Key_Space, Qt.ShiftModifier, '<Shift+Space>'),
|
||||
(Qt.Key_Tab, Qt.ShiftModifier, '<Shift+Tab>'),
|
||||
(Qt.Key_A, Qt.ControlModifier, '<Ctrl+a>'),
|
||||
(Qt.Key_A, Qt.ControlModifier | Qt.ShiftModifier, '<Ctrl+Shift+a>'),
|
||||
@ -180,9 +182,9 @@ def test_normalize_keystr(orig, normalized):
|
||||
(Qt.Key_Backspace, False),
|
||||
(Qt.Key_Return, False),
|
||||
(Qt.Key_Enter, False),
|
||||
(Qt.Key_Space, False),
|
||||
(Qt.Key_X | Qt.ControlModifier, False), # Wrong usage
|
||||
|
||||
(Qt.Key_Space, True), # FIXME broken with upper/lower!
|
||||
(Qt.Key_ydiaeresis, True),
|
||||
(Qt.Key_X, True),
|
||||
])
|
||||
|
Loading…
Reference in New Issue
Block a user