-
Notifications
You must be signed in to change notification settings - Fork 173
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
Custom groups #1068
base: main
Are you sure you want to change the base?
Custom groups #1068
Conversation
sezanzeb
commented
Feb 25, 2025
•
edited
Loading
edited
- Allow grouping multiple devices together, to make presets that apply to multiple devices at once. However, I won't make a user interface for this feature, too much work.
- There is also a feature to group all devices together into one. I did change the gui for this at least, but it isn't ideal.
- Dependency injection for groups
- document configuration.
- BaseConfig is only used for GlobalConfig. Architecture can be simplified. Possibly use a pydantic model just like with presets.
- Split group classes into folder
- Icon for "All Devices"
- Tests
- Or use a button for "Map all devices" which writes the config, and brings you to the "Presets" section. That would mean it would have to reset back to individual-devices when going to the "Devices" section. Maybe call it "Global Preset" or something.
- What happens with autoloading when both individual presets and the all-devices preset is set to autoload?
- Or an entry in the first tab that says "All of them" alongside the individual devices. Clicking this writes the config and switches to the presets tab for the "All Devices" group.
|
||
import evdev | ||
from evdev.ecodes import EV_ABS, EV_KEY | ||
|
||
from inputremapper.groups import groups, _Groups | ||
from inputremapper.groups import groups, Groups |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[mypy] reported by reviewdog 🐶
error: Module "inputremapper.groups" has no attribute "groups"; maybe "Groups"? [attr-defined]
@@ -61,7 +61,7 @@ def __call__(self, data): | |||
class TestDataManager(unittest.TestCase): | |||
def setUp(self) -> None: | |||
self.message_broker = MessageBroker() | |||
self.reader = ReaderClient(self.message_broker, _Groups()) | |||
self.reader = ReaderClient(self.message_broker, Groups()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[mypy] reported by reviewdog 🐶
error: Missing positional argument "global_config" in call to "Groups" [call-arg]
@@ -73,7 +73,7 @@ def setUp(self) -> None: | |||
self.data_manager = DataManager( | |||
self.message_broker, | |||
GlobalConfig(), | |||
ReaderClient(self.message_broker, _Groups()), | |||
ReaderClient(self.message_broker, Groups()), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[mypy] reported by reviewdog 🐶
error: Missing positional argument "global_config" in call to "Groups" [call-arg]
|
||
self.pipe.send(json.dumps([group.dumps() for group in result])) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[mypy] reported by reviewdog 🐶
error: multiprocessing.Pipe? has no attribute "send" [attr-defined]
|
||
used_names.add(unique_name) | ||
|
||
group = Group( |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[mypy] reported by reviewdog 🐶
error: Incompatible types in assignment (expression has type "Group", variable has type "list[tuple[str, str, DeviceType]]") [assignment]
|
||
group = Group( | ||
key=unique_name, | ||
paths=devs, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[mypy] reported by reviewdog 🐶
error: Argument "paths" to "Group" has incompatible type "list[str]"; expected "list[PathLike[Any]]" [arg-type]
capabilities = device.capabilities(absinfo=False) | ||
result.append(group) | ||
|
||
return result |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[mypy] reported by reviewdog 🐶
error: Incompatible return value type (got "list[list[tuple[str, str, DeviceType]]]", expected "list[Group]") [return-value]
self._groups: List[_Group] = None | ||
def __init__(self, global_config: GlobalConfig): | ||
self.global_config = global_config | ||
self._groups: List[Group] = None |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
[mypy] reported by reviewdog 🐶
error: Incompatible types in assignment (expression has type "None", variable has type "list[Group]") [assignment]