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

Input event with origin #550

Merged
merged 37 commits into from
Dec 15, 2022
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
fdbe5d4
Update InputEvent to include origin and analog threshold
jonasBoss Nov 20, 2022
4738843
preset save file migration
jonasBoss Nov 20, 2022
df386bd
Merge branch 'beta' into input-event-with-origin
jonasBoss Nov 21, 2022
5b321f0
Use the InputEvent.analog_threshold field instead of value
jonasBoss Nov 22, 2022
fb1d407
Merge branch 'beta' into input-event-with-origin
jonasBoss Nov 24, 2022
56501b8
Make tests start in pycharm again
jonasBoss Nov 24, 2022
2fadc1f
Seperate InputEvent and InputConfiguration
jonasBoss Nov 24, 2022
db652a5
integration tests
jonasBoss Nov 26, 2022
3f6e81d
simplyfied InputEvent
jonasBoss Nov 26, 2022
af96ce1
move find_analog_input_event to InputCombination
jonasBoss Nov 26, 2022
53f2a49
rename InputConfiguration to InputConfig
jonasBoss Nov 26, 2022
b41bcce
move input_configuration.py to configs/input_config.py
jonasBoss Nov 26, 2022
0b88d79
simplified imports
jonasBoss Nov 26, 2022
e76c30b
rename event_combination to input_combination
jonasBoss Nov 26, 2022
705d97b
mypy
jonasBoss Dec 1, 2022
e518a05
use event origin information
jonasBoss Dec 2, 2022
0f724e4
fix reader-service and use md5 hashing
jonasBoss Dec 2, 2022
fc95635
Updated Mapping handlers
jonasBoss Dec 2, 2022
9da39c6
Updated Tests
jonasBoss Dec 2, 2022
2f168a1
Merge branch 'beta' into input-event-with-origin
jonasBoss Dec 6, 2022
11dce4c
fix test_injector
jonasBoss Dec 6, 2022
b7ca337
mypy
jonasBoss Dec 6, 2022
d67dd32
integration tests
jonasBoss Dec 7, 2022
c3b30cf
added unit tests
jonasBoss Dec 9, 2022
e5f0159
usage.md
jonasBoss Dec 10, 2022
9af4a59
refactor injector grab deviece logic
jonasBoss Dec 11, 2022
6c1d8f9
InputConfig docstring
jonasBoss Dec 11, 2022
6067285
refactor migrations._input_combination_from_string
jonasBoss Dec 11, 2022
f94e5e7
amend
jonasBoss Dec 11, 2022
61fe702
refactor temprary preset migration
jonasBoss Dec 11, 2022
5943fd0
made notify_callbacks private
jonasBoss Dec 12, 2022
925ffad
constrain origin to lowercase
jonasBoss Dec 12, 2022
7639422
tabs 'n spaces
jonasBoss Dec 12, 2022
7010955
mypy
jonasBoss Dec 12, 2022
aa3d868
mypy
jonasBoss Dec 13, 2022
699a6f8
Signal no longer inherits Message protocol
jonasBoss Dec 13, 2022
a1d1641
rename origin to origin_hash
jonasBoss Dec 14, 2022
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
move input_configuration.py to configs/input_config.py
  • Loading branch information
jonasBoss committed Nov 26, 2022
commit b41bccefdb3c1fb0ab6cda652059ec57fd776da3
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
from __future__ import annotations

import itertools
from typing import Tuple, Iterable, Union, Callable, Sequence, List, Dict, Optional
from typing import Tuple, Iterable, Union, List, Dict, Optional

from evdev import ecodes
from inputremapper.gui.messages.message_types import MessageType
Expand Down Expand Up @@ -54,8 +54,6 @@ class InputConfig(BaseModel):
@property
def defines_analog_input(self) -> bool:
"""Whether this defines an analog input"""
# todo give it a better name once InputEvent and
# InputConfig are seperated
return not self.analog_threshold and self.type != ecodes.EV_KEY

@property
Expand Down
2 changes: 1 addition & 1 deletion inputremapper/configs/mapping.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@
)

from inputremapper.configs.system_mapping import system_mapping, DISABLE_NAME
from inputremapper.input_configuration import InputCombination, InputConfig
from configs.input_config import InputCombination
from inputremapper.exceptions import MacroParsingError
from inputremapper.gui.gettext import _
from inputremapper.gui.messages.message_types import MessageType
Expand Down
2 changes: 1 addition & 1 deletion inputremapper/configs/migrations.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@
from inputremapper.configs.paths import get_preset_path, mkdir, CONFIG_PATH, remove
from inputremapper.configs.preset import Preset
from inputremapper.configs.system_mapping import system_mapping
from inputremapper.input_configuration import InputCombination, InputConfig
from configs.input_config import InputCombination, InputConfig
from inputremapper.injection.global_uinputs import global_uinputs
from inputremapper.injection.macros.parse import is_this_a_macro
from inputremapper.logger import logger, VERSION, IS_BETA
Expand Down
5 changes: 1 addition & 4 deletions inputremapper/configs/preset.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@

import os
import json
import traceback

from typing import (
Tuple,
Expand All @@ -38,14 +37,12 @@
)

from pydantic import ValidationError
from evdev.ecodes import EV_KEY

from inputremapper.logger import logger
from inputremapper.configs.mapping import Mapping, UIMapping
from inputremapper.configs.paths import touch

from inputremapper.input_event import InputEvent
from inputremapper.input_configuration import InputCombination, InputConfig
from configs.input_config import InputCombination, InputConfig

MappingModel = TypeVar("MappingModel", bound=UIMapping)

Expand Down
2 changes: 1 addition & 1 deletion inputremapper/gui/components/editor.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
from gi.repository import Gtk, GtkSource, Gdk

from inputremapper.configs.mapping import MappingData
from inputremapper.input_configuration import InputCombination, InputConfig
from configs.input_config import InputCombination, InputConfig
from inputremapper.groups import DeviceType
from inputremapper.gui.controller import Controller
from inputremapper.gui.gettext import _
Expand Down
3 changes: 1 addition & 2 deletions inputremapper/gui/controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@

from inputremapper.configs.mapping import MappingData, UIMapping
from inputremapper.configs.paths import sanitize_path_component
from inputremapper.input_configuration import InputCombination, InputConfig
from configs.input_config import InputCombination, InputConfig
from inputremapper.exceptions import DataManagementError
from inputremapper.gui.data_manager import DataManager, DEFAULT_PRESET_NAME
from inputremapper.gui.gettext import _
Expand All @@ -60,7 +60,6 @@
InjectorState,
InjectorStateMessage,
)
from inputremapper.input_event import InputEvent
from inputremapper.logger import logger

if TYPE_CHECKING:
Expand Down
3 changes: 1 addition & 2 deletions inputremapper/gui/data_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
from inputremapper.configs.preset import Preset
from inputremapper.configs.system_mapping import SystemMapping
from inputremapper.daemon import DaemonProxy
from inputremapper.input_configuration import InputCombination, InputConfig
from configs.input_config import InputCombination, InputConfig
from inputremapper.exceptions import DataManagementError
from inputremapper.gui.gettext import _
from inputremapper.groups import _Group
Expand All @@ -53,7 +53,6 @@
InjectorState,
InjectorStateMessage,
)
from inputremapper.input_event import InputEvent
from inputremapper.logger import logger

DEFAULT_PRESET_NAME = _("new preset")
Expand Down
2 changes: 1 addition & 1 deletion inputremapper/gui/messages/message_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
from typing import Dict, Tuple, Optional, Callable

from inputremapper.configs.mapping import MappingData
from inputremapper.input_configuration import InputCombination
from configs.input_config import InputCombination
from inputremapper.gui.messages.message_types import (
MessageType,
Name,
Expand Down
2 changes: 1 addition & 1 deletion inputremapper/gui/reader_client.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
gi.require_version("GLib", "2.0")
from gi.repository import GLib

from inputremapper.input_configuration import InputCombination
from configs.input_config import InputCombination
from inputremapper.groups import _Groups, _Group
from inputremapper.gui.reader_service import (
MSG_EVENT,
Expand Down
2 changes: 1 addition & 1 deletion inputremapper/gui/reader_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
from evdev.ecodes import EV_KEY, EV_ABS, EV_REL, REL_HWHEEL, REL_WHEEL

from inputremapper.configs.mapping import UIMapping
from inputremapper.input_configuration import InputCombination, InputConfig
from configs.input_config import InputCombination, InputConfig
from inputremapper.groups import _Groups, _Group
from inputremapper.injection.event_reader import EventReader
from inputremapper.injection.mapping_handlers.abs_to_btn_handler import AbsToBtnHandler
Expand Down
2 changes: 1 addition & 1 deletion inputremapper/gui/user_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@

from inputremapper.configs.data import get_data_path
from inputremapper.configs.mapping import MappingData
from inputremapper.input_configuration import InputCombination
from configs.input_config import InputCombination
from inputremapper.gui.autocompletion import Autocompletion
from inputremapper.gui.components.editor import (
MappingListBox,
Expand Down
2 changes: 1 addition & 1 deletion inputremapper/injection/injector.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
import evdev

from inputremapper.configs.preset import Preset
from inputremapper.input_configuration import InputCombination
from configs.input_config import InputCombination
from inputremapper.groups import (
_Group,
classify,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@

from inputremapper import exceptions
from inputremapper.configs.mapping import Mapping
from inputremapper.input_configuration import InputCombination
from configs.input_config import InputCombination
from inputremapper.injection.global_uinputs import global_uinputs
from inputremapper.injection.mapping_handlers.axis_transform import Transformation
from inputremapper.injection.mapping_handlers.mapping_handler import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from evdev.ecodes import EV_ABS

from inputremapper.configs.mapping import Mapping
from inputremapper.input_configuration import InputCombination, InputConfig
from configs.input_config import InputCombination, InputConfig
from inputremapper.injection.mapping_handlers.mapping_handler import (
MappingHandler,
InputEventHandler,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@
WHEEL_HI_RES_SCALING,
DEFAULT_REL_RATE,
)
from inputremapper.input_configuration import InputCombination
from configs.input_config import InputCombination
from inputremapper.injection.global_uinputs import global_uinputs
from inputremapper.injection.mapping_handlers.axis_transform import Transformation
from inputremapper.injection.mapping_handlers.mapping_handler import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,9 @@
from typing import Dict, Tuple

import evdev
from evdev.ecodes import EV_KEY

from inputremapper.configs.mapping import Mapping
from inputremapper.input_configuration import InputCombination
from configs.input_config import InputCombination
from inputremapper.injection.mapping_handlers.mapping_handler import (
MappingHandler,
HandlerEnums,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
from evdev.ecodes import EV_ABS, EV_REL

from inputremapper.configs.mapping import Mapping
from inputremapper.input_configuration import InputCombination
from configs.input_config import InputCombination
from inputremapper.injection.mapping_handlers.mapping_handler import (
MappingHandler,
InputEventHandler,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import evdev
from evdev.ecodes import EV_ABS, EV_REL

from inputremapper.input_configuration import InputCombination, InputConfig
from configs.input_config import InputCombination, InputConfig
from inputremapper.injection.mapping_handlers.mapping_handler import (
MappingHandler,
InputEventHandler,
Expand Down
2 changes: 1 addition & 1 deletion inputremapper/injection/mapping_handlers/key_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

from inputremapper import exceptions
from inputremapper.configs.mapping import Mapping
from inputremapper.input_configuration import InputCombination
from configs.input_config import InputCombination
from inputremapper.exceptions import MappingParsingError
from inputremapper.injection.global_uinputs import global_uinputs
from inputremapper.injection.mapping_handlers.mapping_handler import (
Expand Down
2 changes: 1 addition & 1 deletion inputremapper/injection/mapping_handlers/macro_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
from typing import Dict, Callable

from inputremapper.configs.mapping import Mapping
from inputremapper.input_configuration import InputCombination
from configs.input_config import InputCombination
from inputremapper.injection.global_uinputs import global_uinputs
from inputremapper.injection.macros.macro import Macro
from inputremapper.injection.macros.parse import parse
Expand Down
4 changes: 2 additions & 2 deletions inputremapper/injection/mapping_handlers/mapping_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,9 +66,9 @@
import evdev

from inputremapper.configs.mapping import Mapping
from inputremapper.input_configuration import InputCombination, InputConfig
from configs.input_config import InputCombination, InputConfig
from inputremapper.exceptions import MappingParsingError
from inputremapper.input_event import InputEvent, EventActions
from inputremapper.input_event import InputEvent
from inputremapper.logger import logger


Expand Down
2 changes: 1 addition & 1 deletion inputremapper/injection/mapping_handlers/mapping_parser.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from inputremapper.configs.mapping import Mapping
from inputremapper.configs.preset import Preset
from inputremapper.configs.system_mapping import DISABLE_CODE, DISABLE_NAME
from inputremapper.input_configuration import InputCombination
from configs.input_config import InputCombination
from inputremapper.exceptions import MappingParsingError
from inputremapper.injection.macros.parse import is_this_a_macro
from inputremapper.injection.mapping_handlers.abs_to_abs_handler import AbsToAbsHandler
Expand Down
2 changes: 1 addition & 1 deletion inputremapper/injection/mapping_handlers/null_handler.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

import evdev

from inputremapper.input_configuration import InputCombination
from configs.input_config import InputCombination
from inputremapper.injection.mapping_handlers.mapping_handler import (
MappingHandler,
HandlerEnums,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
REL_XY_SCALING,
DEFAULT_REL_RATE,
)
from inputremapper.input_configuration import InputCombination
from configs.input_config import InputCombination
from inputremapper.injection.global_uinputs import global_uinputs
from inputremapper.injection.mapping_handlers.axis_transform import Transformation
from inputremapper.injection.mapping_handlers.mapping_handler import (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from evdev.ecodes import EV_REL

from inputremapper.configs.mapping import Mapping
from inputremapper.input_configuration import InputCombination, InputConfig
from configs.input_config import InputCombination, InputConfig
from inputremapper.injection.mapping_handlers.mapping_handler import (
MappingHandler,
InputEventHandler,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
WHEEL_SCALING,
WHEEL_HI_RES_SCALING,
)
from inputremapper.input_configuration import InputCombination, InputConfig
from configs.input_config import InputCombination, InputConfig
from inputremapper.injection.global_uinputs import global_uinputs
from inputremapper.injection.mapping_handlers.axis_transform import Transformation
from inputremapper.injection.mapping_handlers.mapping_handler import (
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_components.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@
DeviceGroupSelection,
)
from inputremapper.configs.mapping import MappingData
from inputremapper.input_configuration import InputCombination, InputConfig
from configs.input_config import InputCombination, InputConfig


class ComponentBaseTest(unittest.TestCase):
Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@
from inputremapper.gui.utils import gtk_iteration, Colors, debounce, debounce_manager
from inputremapper.gui.user_interface import UserInterface
from inputremapper.injection.injector import InjectorState
from inputremapper.input_configuration import InputCombination, InputConfig
from configs.input_config import InputCombination, InputConfig
from inputremapper.daemon import Daemon, DaemonProxy


Expand Down
2 changes: 1 addition & 1 deletion tests/integration/test_user_interface.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
from inputremapper.gui.messages.message_broker import MessageBroker, MessageType
from inputremapper.gui.user_interface import UserInterface
from inputremapper.configs.mapping import MappingData
from inputremapper.input_configuration import InputCombination, InputConfig
from configs.input_config import InputCombination, InputConfig


class TestUserInterface(unittest.TestCase):
Expand Down
3 changes: 1 addition & 2 deletions tests/unit/test_controller.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,11 @@

from inputremapper.configs.system_mapping import system_mapping
from inputremapper.injection.injector import InjectorState
from inputremapper.input_event import InputEvent

gi.require_version("Gtk", "3.0")
from gi.repository import Gtk

from inputremapper.input_configuration import InputCombination, InputConfig
from configs.input_config import InputCombination, InputConfig
from inputremapper.groups import _Groups
from inputremapper.gui.messages.message_broker import (
MessageBroker,
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_daemon.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
from inputremapper.configs.global_config import global_config
from inputremapper.groups import groups
from inputremapper.configs.paths import get_config_path, mkdir, get_preset_path
from inputremapper.input_configuration import InputCombination, InputConfig
from configs.input_config import InputCombination, InputConfig
from inputremapper.configs.preset import Preset
from inputremapper.injection.injector import InjectorState
from inputremapper.daemon import Daemon
Expand Down
3 changes: 1 addition & 2 deletions tests/unit/test_data_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
from inputremapper.configs.global_config import global_config
from inputremapper.configs.mapping import UIMapping, MappingData
from inputremapper.configs.system_mapping import system_mapping
from inputremapper.input_configuration import InputCombination, InputConfig
from configs.input_config import InputCombination, InputConfig
from inputremapper.exceptions import DataManagementError
from inputremapper.groups import _Groups
from inputremapper.gui.messages.message_broker import (
Expand All @@ -40,7 +40,6 @@
)
from inputremapper.gui.reader_client import ReaderClient
from inputremapper.injection.global_uinputs import GlobalUInputs
from inputremapper.input_event import InputEvent
from tests.lib.cleanup import quick_cleanup
from tests.lib.patches import FakeDaemonProxy
from tests.lib.fixtures import prepare_presets, get_combination_config
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_event_pipeline/test_event_pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@
)
from inputremapper.configs.preset import Preset
from inputremapper.configs.system_mapping import system_mapping
from inputremapper.input_configuration import InputCombination, InputConfig
from configs.input_config import InputCombination, InputConfig
from inputremapper.injection.context import Context
from inputremapper.injection.event_reader import EventReader
from inputremapper.injection.global_uinputs import global_uinputs
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_event_pipeline/test_mapping_handlers.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
from inputremapper.injection.mapping_handlers.rel_to_btn_handler import RelToBtnHandler

from inputremapper.configs.mapping import Mapping, DEFAULT_REL_RATE
from inputremapper.input_configuration import InputCombination, InputConfig
from configs.input_config import InputCombination, InputConfig
from inputremapper.injection.global_uinputs import global_uinputs
from inputremapper.injection.mapping_handlers.abs_to_abs_handler import AbsToAbsHandler
from inputremapper.injection.mapping_handlers.abs_to_btn_handler import AbsToBtnHandler
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_event_reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@
from inputremapper.configs.mapping import Mapping
from inputremapper.configs.preset import Preset
from inputremapper.configs.system_mapping import system_mapping
from inputremapper.input_configuration import InputCombination, InputConfig
from configs.input_config import InputCombination, InputConfig
from inputremapper.injection.context import Context
from inputremapper.injection.event_reader import EventReader
from inputremapper.injection.global_uinputs import global_uinputs
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_injector.py
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@
DISABLE_NAME,
)
from inputremapper.configs.preset import Preset
from inputremapper.input_configuration import InputCombination, InputConfig
from configs.input_config import InputCombination, InputConfig
from inputremapper.injection.macros.parse import parse
from inputremapper.injection.context import Context
from inputremapper.groups import groups, classify, DeviceType
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/test_input_combination.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@
KEY_LEFTCTRL,
)

from inputremapper.input_configuration import InputCombination, InputConfig
from configs.input_config import InputCombination, InputConfig
from tests.lib.fixtures import get_combination_config


Expand Down
Loading