Florian Bruhin
2b84ea9dbe
Make sure we have plain keys/modifiers where needed
2018-03-05 23:01:24 +01:00
Florian Bruhin
0ee7fac727
Update test_init_unknown/test_init_invalid for KeyboardModifierMask
...
-1 & Qt.KeyboardModifierMask == Qt.Key_unknown
2018-03-05 22:56:58 +01:00
Florian Bruhin
29fdd1acc4
Make sure all keyboard modifiers are handled correctly
...
This handles Qt.KeypadModifier (Num+...) correctly, adds tests for converting
modifiers to strings, and strips Qt.GroupSwitchModifier as QKeySequence doesn't
know about it.
Fixes #3675
2018-03-05 22:11:26 +01:00
Florian Bruhin
333a37ffb2
Fix old macOS-specific test code
2018-03-05 18:30:34 +01:00
Florian Bruhin
d1854eddaf
Handle invalid keys coming from Qt
...
When pressing a key which doesn't exist as Qt.Key, we don't get Qt.Key_unknown
like we'd expect, but we get 0x0 instead...
Let's add that as a new "nil" key (to not conflict with None/unknown/zero/...)
and handle it appropriately.
This can be reproduced by doing:
setxkbmap -layout us,gr -option grp:alt_shift_toggle
and pressing Alt-Shift/Shift-Alt.
2018-03-05 15:42:52 +01:00
Florian Bruhin
52c280ec12
Add unit tests for BaseKeyParser.handle with dry_run=True
2018-03-05 15:33:56 +01:00
Florian Bruhin
cc5da4d1fe
Fix test_modeman.py
2018-03-05 11:08:21 +01:00
Florian Bruhin
274f2a9d19
Rename eventFilter methods in modeman
2018-03-05 06:36:01 +01:00
Florian Bruhin
88a5c8d29d
Make sure bindings with umlauts work
...
See #303
2018-03-04 22:38:33 +01:00
Florian Bruhin
e2f17c4be1
Always prefer exact over partial matches
2018-03-04 21:45:46 +01:00
Florian Bruhin
0967b6abd2
Fix handling of </> keys
2018-03-04 20:40:16 +01:00
Florian Bruhin
d8bfe23c0d
Fix lint
2018-03-04 20:21:58 +01:00
Florian Bruhin
f85e69ec77
Refactor other keyinput tests
2018-03-04 20:21:58 +01:00
Florian Bruhin
2be7db29ed
100% coverage for keyinput.keyutils
2018-03-04 20:21:58 +01:00
Florian Bruhin
8da878c77c
Make KeySequence.matchs() work correctly
2018-03-04 20:21:58 +01:00
Florian Bruhin
866c758660
Add more KeySequence tests
2018-03-04 20:21:58 +01:00
Florian Bruhin
fb7c75a090
Improve keyutils tests
2018-03-04 20:21:58 +01:00
Florian Bruhin
3c9e8ff9ab
Test and fix keyutils._parse_keystring
2018-03-04 20:21:58 +01:00
Florian Bruhin
7f8508a367
Change the way Space keybindings are handled
...
Using it as " " in a keystring won't work anymore, but instead <Space> and
<Shift-Space> does.
2018-03-04 20:21:58 +01:00
Florian Bruhin
da60d11b24
Refactor keyutils tests
2018-03-04 20:21:58 +01:00
Florian Bruhin
b3834835ed
Bring back keyutils.is_modifier() and modifier handling
...
Turns out when we press yY, we get three events:
Qt.Key_Y, Qt.NoModifier
Qt.Key_Shift, Qt.ShiftModifier
Qt.Key_Y, Qt.ShiftModifier
If we don't ignore the second one, our keychain will be interrupted by the Shift
keypress.
2018-03-04 20:21:58 +01:00
Florian Bruhin
e306e2dadb
Improve and fix test_is_printable
2018-03-04 20:21:58 +01:00
Fritz Reichwald
d9a88e139c
Test for modifiers and corner case 0xFF
2018-03-04 20:21:58 +01:00
Florian Bruhin
3a11a24be0
Fix modifier handling
...
We don't want to show <Shift-Shift>, but <Ctrl-Shift> should still work
correctly.
2018-03-04 20:21:58 +01:00
Florian Bruhin
7cb781cc92
Simplify handling of modifier-only keys
...
Now that we don't rely on str(KeyInfo) being empty anywhere, there's no reason
to return an empty string for only-modifier keypresses anymore.
While those keys can't be bound (QKeySequence('Shift') == Qt.Key_unknown)
there's also no reason to explicitly ignore them.
2018-03-04 20:21:57 +01:00
Florian Bruhin
693178c8ee
Refactor KeyInfo.__str__
...
This removes the special handling for macOS, but this is hopefully not needed
anymore as we don't compare strings.
2018-03-04 20:21:57 +01:00
Florian Bruhin
af6e5b1838
Fix lint
2018-03-04 20:21:57 +01:00
Florian Bruhin
a57fc5c746
Refactor keyutils tests involving all keys
2018-03-04 20:21:57 +01:00
Florian Bruhin
4223e2f85d
Check all keys against QTest::keyToAscii
2018-03-04 20:21:57 +01:00
Fritz Reichwald
d28c323074
Add printable and ismodifier test
2018-03-04 20:21:57 +01:00
Florian Bruhin
934d586286
Fix handling of Shift-Tab aka. Backtab
2018-03-04 20:21:57 +01:00
Florian Bruhin
63e05e12ba
Fix lint and tests
2018-03-04 20:21:57 +01:00
Florian Bruhin
2ca15d7667
Add tests for lower-/uppercase text
2018-03-04 20:20:31 +01:00
Florian Bruhin
8c87040cb6
Improve IDs for qt_key fixture
2018-03-04 20:20:31 +01:00
Florian Bruhin
0b6d2c2b0a
Make all key names work
2018-03-04 20:20:30 +01:00
Florian Bruhin
601e56d2fa
Make test_keyutils work
2018-03-04 20:20:30 +01:00
Florian Bruhin
8f479407a0
key_data: Update key names to reflect reality
...
Generated by:
import key_data
from PyQt5.QtCore import Qt
from PyQt5.QtGui import QKeySequence
for key in key_data.KEYS:
attr = key.attribute
member = getattr(Qt, 'Key_' + attr, None)
if member is None:
continue
name = QKeySequence(member).toString()
if name != attr:
try:
print(" Key('{}', '{}')".format(attr, name))
except UnicodeEncodeError:
print(" Key('{}', '{}') # FIXME".format(attr, name.encode('unicode-escape').decode('ascii')))
else:
print()
2018-03-04 20:20:30 +01:00
Florian Bruhin
f714be0ff7
Initial tests on all Qt keys
2018-03-04 20:20:30 +01:00
Florian Bruhin
19512e988b
Expose less from keyutils publicly
2018-03-04 20:20:30 +01:00
Florian Bruhin
fdc2458657
Fix test_split_count after _handle_key merge
2018-03-04 20:20:30 +01:00
Florian Bruhin
c3485821c7
Adjust copyright
2018-03-04 20:20:30 +01:00
Florian Bruhin
49d297f7bf
Fix tests for parsing KeySequences
2018-02-27 14:10:55 +01:00
Florian Bruhin
ec3ad8a969
Get rid of _warn_on_keychains and _supports_chains
2018-02-27 13:02:32 +01:00
Florian Bruhin
ba012c6ba8
Get rid of BaseKeyparser.Type
2018-02-27 13:01:41 +01:00
Florian Bruhin
362f923f06
Fix lint
2018-02-27 09:34:55 +01:00
Florian Bruhin
1ba61bbcbe
Fix test_modeparsers
2018-02-27 09:22:01 +01:00
Florian Bruhin
911b2daebf
Fix test_keyutils
2018-02-27 09:07:20 +01:00
Florian Bruhin
5a03d31f6f
More test_basekeyparser fixes
2018-02-27 08:53:28 +01:00
Florian Bruhin
9e27f2b3e7
Initial attempts at fixing test_basekeyparser
2018-02-27 08:48:16 +01:00
Florian Bruhin
321d5c5d20
Merge branch 'master' into keys
2018-02-25 21:25:12 +01:00