Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix CombinationHandler releasing #578

Merged
merged 68 commits into from
Feb 19, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
3bfb0cd
forward -> forward_to
sezanzeb Dec 15, 2022
5bffec9
forward -> forward_to
sezanzeb Dec 15, 2022
2c6cba7
include uniputs, and sources in Context
jonasBoss Dec 15, 2022
4c1c865
Merge branch 'fix_release_combination_keys' of github.com:jonasBoss/k…
sezanzeb Dec 15, 2022
a5a5d46
remove forward_to
sezanzeb Dec 15, 2022
afff661
I guess it works maybe
sezanzeb Dec 15, 2022
f56c0c6
some mypy
sezanzeb Dec 15, 2022
53cbc9a
mypy maybe
sezanzeb Dec 15, 2022
230da2f
mypy
sezanzeb Dec 15, 2022
0e6213b
mypy
sezanzeb Dec 15, 2022
1dd1382
leftover forward_to
sezanzeb Dec 15, 2022
c9a455c
remove forward_to from tests
sezanzeb Dec 15, 2022
e9ada56
forwarding
sezanzeb Dec 26, 2022
2a92e7d
using repr, repr usages now use the <... at id> format, logging the u…
sezanzeb Dec 26, 2022
9016268
using hex(id(self)) because python uses that by default
sezanzeb Dec 26, 2022
5ab88b6
mypy
sezanzeb Dec 26, 2022
8443fc8
oops
sezanzeb Dec 26, 2022
8f44e20
a few fixes
sezanzeb Dec 26, 2022
62acb9e
black
sezanzeb Dec 26, 2022
330bf31
reviewdog
sezanzeb Dec 26, 2022
44288f9
fixed test_combination, added helpful logs if handlers not found
sezanzeb Dec 26, 2022
bfc6130
black
sezanzeb Dec 26, 2022
164acb1
fix test_ignore_disabled
sezanzeb Dec 28, 2022
4db45d4
typo
sezanzeb Dec 28, 2022
2feed73
imports, deprecated usages
sezanzeb Dec 28, 2022
a1efdbb
a few test fixes
sezanzeb Dec 28, 2022
ea56613
missing import
sezanzeb Dec 28, 2022
e999fd0
using the shorthands
sezanzeb Dec 28, 2022
3bd1a82
black
sezanzeb Dec 28, 2022
be9079d
uniform usage of InputCombination and other stuff
sezanzeb Dec 30, 2022
1a2f8c8
deprecated convert_to_internal_events
sezanzeb Dec 30, 2022
28dff76
Capitalized some logs, removed deprecated comments
sezanzeb Dec 30, 2022
03ff62e
added hash to group discovery logs, fixed TestInjector
sezanzeb Dec 31, 2022
72f42a0
Update inputremapper/configs/input_config.py
sezanzeb Jan 8, 2023
838176a
fix logger test
sezanzeb Jan 12, 2023
beb011a
failed event-handlings don't crash the event_reader completely anymore
sezanzeb Jan 12, 2023
d18d6cf
Merge branch 'fix-release_combination_keys-forwarding' of github.com:…
sezanzeb Jan 12, 2023
5a962b7
fixed more tests
sezanzeb Jan 12, 2023
63955c7
all unit tests passing
sezanzeb Jan 12, 2023
38b8aa6
using boolean variable instead of set in send_to_handlers
sezanzeb Jan 12, 2023
b6d787c
fixed send_to_handlers
sezanzeb Jan 12, 2023
a4d9919
fixed some integration tests
sezanzeb Jan 15, 2023
5652480
¯\_(ツ)_/¯
sezanzeb Jan 15, 2023
673a5a4
all tests passing
sezanzeb Jan 15, 2023
7cac266
renamed to get_notify_callbacks, stuff
sezanzeb Jan 15, 2023
cca54eb
added Mapping.from_combination
sezanzeb Jan 15, 2023
235c6fd
InputCombination.from_tuples
sezanzeb Jan 15, 2023
cda8f47
add reasoning comment to hardocded version string
sezanzeb Feb 11, 2023
39ef8cc
mention that conda can cause issues
sezanzeb Feb 11, 2023
63d4720
fix chunked string for translation
sezanzeb Feb 11, 2023
b8868fc
black
sezanzeb Feb 12, 2023
1854e72
Merge branch 'beta' of github.com:sezanzeb/key-mapper into fix-releas…
sezanzeb Feb 12, 2023
905cb0a
fixed get_event_reader in test_key_axis_combination_to_disable
sezanzeb Feb 12, 2023
347cffd
printing the black version before checking
sezanzeb Feb 12, 2023
9346aad
formatting with black 23.1.0
sezanzeb Feb 12, 2023
7f58574
test get_notify_callbacks and get_evdev_constant_name
sezanzeb Feb 16, 2023
01c89f6
tests for combinationhandler releasing
sezanzeb Feb 18, 2023
f26fcdb
asyncio reader tests
sezanzeb Feb 19, 2023
629e2dd
testing that the reader service forwards to the dummy
sezanzeb Feb 19, 2023
733db4a
fixed most tests
sezanzeb Feb 19, 2023
389e8fa
pain
sezanzeb Feb 19, 2023
41e8a39
pain
sezanzeb Feb 19, 2023
73f13c3
black
sezanzeb Feb 19, 2023
e05a556
done I guess
sezanzeb Feb 19, 2023
77e6224
removed inputconfigs shorthands
sezanzeb Feb 19, 2023
a9f018b
Update inputremapper/configs/input_config.py
sezanzeb Feb 19, 2023
9552ff6
review
sezanzeb Feb 19, 2023
9d89ca2
Merge branch 'fix-release_combination_keys-forwarding' of github.com:…
sezanzeb Feb 19, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
removed inputconfigs shorthands
  • Loading branch information
sezanzeb committed Feb 19, 2023
commit 77e62249ac124827cb4a9b21865b115594989216
29 changes: 0 additions & 29 deletions inputremapper/configs/input_config.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,35 +75,6 @@ def __repr__(self):
f"at {hex(id(self))}>"
)

@classmethod
def abs(cls, code, analog_threshold, origin_hash: Optional[DeviceHash] = None):
"""Create a new InputConfig object for an abs input like joysticks."""
# TODO analog_threshold default None and move to last param?
return InputConfig(
type=EV_ABS,
code=code,
analog_threshold=analog_threshold,
origin_hash=origin_hash,
)

@classmethod
def key(cls, code, origin_hash: Optional[DeviceHash] = None):
"""Create a new InputConfig object for a key/btn input."""
return InputConfig(
type=EV_KEY,
code=code,
origin_hash=origin_hash,
)

@classmethod
def rel(cls, code, origin_hash: Optional[DeviceHash] = None):
"""Create a new InputConfig object for a rel input like mouse movements."""
return InputConfig(
type=EV_REL,
code=code,
origin_hash=origin_hash,
)

@property
def input_match_hash(self) -> Hashable:
"""a Hashable object which is intended to match the InputConfig with a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
# along with input-remapper. If not, see <https://www.gnu.org/licenses/>.


from typing import Tuple, Optional
from typing import Tuple

import evdev
from evdev.ecodes import EV_ABS
Expand Down
4 changes: 2 additions & 2 deletions readme/coverage.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
4 changes: 2 additions & 2 deletions readme/pylint.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
15 changes: 11 additions & 4 deletions tests/unit/test_daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
#
# You should have received a copy of the GNU General Public License
# along with input-remapper. If not, see <https://www.gnu.org/licenses/>.
from evdev._ecodes import EV_ABS

from inputremapper.input_event import InputEvent
from tests.test import is_service_running
Expand Down Expand Up @@ -124,14 +125,18 @@ def test_daemon(self):
preset = Preset(group.get_preset_path(preset_name))
preset.add(
Mapping.from_combination(
input_combination=InputCombination([InputConfig.key(BTN_A)]),
input_combination=InputCombination(
[InputConfig(type=EV_KEY, code=BTN_A)]
),
target_uinput="keyboard",
output_symbol="a",
)
)
preset.add(
Mapping.from_combination(
input_combination=InputCombination([InputConfig.abs(ABS_X, -1)]),
input_combination=InputCombination(
[InputConfig(type=EV_ABS, code=ABS_X, analog_threshold=-1)]
),
target_uinput="keyboard",
output_symbol="b",
)
Expand Down Expand Up @@ -236,7 +241,9 @@ def test_refresh_on_start(self):
preset = Preset(get_preset_path(group_name, preset_name))
preset.add(
Mapping.from_combination(
InputCombination([InputConfig.key(key_code)]), "keyboard", "a"
InputCombination([InputConfig(type=EV_KEY, code=key_code)]),
"keyboard",
"a",
)
)

Expand Down Expand Up @@ -323,7 +330,7 @@ def test_xmodmap_file(self):
preset = Preset(path)
preset.add(
Mapping.from_combination(
InputCombination([InputConfig.key(from_keycode)]),
InputCombination([InputConfig(type=EV_KEY, code=from_keycode)]),
target,
to_name,
)
Expand Down
35 changes: 28 additions & 7 deletions tests/unit/test_event_pipeline/test_event_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -372,15 +372,29 @@ async def test_combination(self):
origin_hash = origin.get_device_hash()

mapping_1 = Mapping.from_combination(
InputCombination([InputConfig.abs(ABS_X, 1, origin_hash)]),
InputCombination(
[
InputConfig(
type=EV_ABS,
code=ABS_X,
analog_threshold=1,
origin_hash=origin_hash,
)
]
),
output_symbol="a",
)

mapping_2 = Mapping.from_combination(
InputCombination(
[
InputConfig.abs(ABS_X, 1, origin_hash),
InputConfig.key(BTN_A, origin_hash),
InputConfig(
type=EV_ABS,
code=ABS_X,
analog_threshold=1,
origin_hash=origin_hash,
),
InputConfig(type=EV_KEY, code=BTN_A, origin_hash=origin_hash),
]
),
output_symbol="b",
Expand All @@ -389,9 +403,14 @@ async def test_combination(self):
mapping_3 = Mapping.from_combination(
InputCombination(
[
InputConfig.abs(ABS_X, 1, origin_hash),
InputConfig.key(BTN_A, origin_hash),
InputConfig.key(BTN_B, origin_hash),
InputConfig(
type=EV_ABS,
code=ABS_X,
analog_threshold=1,
origin_hash=origin_hash,
),
InputConfig(type=EV_KEY, code=BTN_A, origin_hash=origin_hash),
InputConfig(type=EV_KEY, code=BTN_B, origin_hash=origin_hash),
]
),
output_symbol="c",
Expand Down Expand Up @@ -458,7 +477,9 @@ async def test_ignore_hold(self):
preset = Preset()
preset.add(
Mapping.from_combination(
input_combination=InputCombination([InputConfig.key(KEY_A)]),
input_combination=InputCombination(
[InputConfig(type=EV_KEY, code=KEY_A)]
),
output_symbol="a",
)
)
Expand Down
7 changes: 4 additions & 3 deletions tests/unit/test_injector.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,8 +173,9 @@ def test_grab_device_1(self):
Mapping.from_combination(
InputCombination(
[
InputConfig.abs(
ABS_HAT0X,
InputConfig(
type=EV_ABS,
code=ABS_HAT0X,
analog_threshold=1,
origin_hash=device_hash,
)
Expand Down Expand Up @@ -204,7 +205,7 @@ def test_forward_gamepad_events(self):
preset.add(
Mapping.from_combination(
input_combination=InputCombination(
[InputConfig.key(BTN_A, origin_hash=device_hash)]
[InputConfig(type=EV_KEY, code=BTN_A, origin_hash=device_hash)]
),
target_uinput="keyboard",
output_symbol="a",
Expand Down