Commit Graph

2801 Commits

Author SHA1 Message Date
MattHag 9f57955142 Action menu: Move context menu into own class
Reduce complexity of diversion dialog.
2024-10-11 07:42:38 -04:00
MattHag 0dec545bfd Fix rule saving command 2024-10-11 07:42:38 -04:00
MattHag 3277015ab6 diversion: Add type hints 2024-10-11 07:42:38 -04:00
MattHag 691e5878f9 Remove obsolete pytest fixture 2024-10-11 07:42:38 -04:00
MattHag bb559c0d7c base: Remove hard dependency on gi
Import gi solely for type checking.
2024-10-11 07:42:38 -04:00
MattHag 1f85ec01e7 base: Add more unit tests
Make internal functions private.
2024-10-11 07:42:38 -04:00
MattHag 58ddb0d6cd Introduce HIDAPI protocol
Improve type hints and names.
2024-10-11 07:42:38 -04:00
MattHag 46366b2430 Fix warnings from automatic code inspections
Warnings found by automatic code inspection and partially tackled
- Drop distuitls inf favour of setuptools
- Replace deprecated pyudev.Device.from_device_number
- Remove unnecessary brackets
- Avoid access to private variables etc.
- Shadows built-in name
- Line length >120 characters
- Not a module level variable
- Simplify clause
and more
2024-10-11 07:42:38 -04:00
MattHag 0f4d1aebcd ui/common: Introduce tests 2024-10-11 07:42:38 -04:00
MattHag 89233957dc settings: Add tests 2024-10-11 07:42:38 -04:00
MattHag c9e781e752 settings_template: Introduce State enum 2024-10-11 07:42:38 -04:00
MattHag 54aace050c Replace action strings with constants
Avoids spelling mistakes and helps readability.
2024-10-11 07:42:38 -04:00
MattHag cba3533869 Remove factory wrapper classes
A module level function is sufficient, no wrapper needed.
2024-10-11 07:42:38 -04:00
MattHag ef6b7dec2c receiver: Remove hard dependency on base
With this test all receiver tests are macOS compatible again. The low
level interface supports passing a fake API for unit tests.
2024-10-11 07:42:38 -04:00
MattHag 4e50e605a6 device: Remove hard dependency on base 2024-10-11 07:42:38 -04:00
MattHag 37e2ac80ba base: Add test for filter_products_of_interest 2024-10-11 07:42:38 -04:00
MattHag 614a5dc633 Add type hints and clean up 2024-10-11 07:42:38 -04:00
MattHag 1729189981 base: Add find_paired_node functions
Avoid direct access to hidapi and use the base module as low-level API
instead. This change replaces the remaining calls to find_paired_node
and find_paired_node_wpid by exposing them via base module.
2024-10-11 07:42:38 -04:00
MattHag 90c41dbe32 base: Add find_paired_node functions
Avoid the need for hidapi imports and add them to the base API module.
2024-10-11 07:42:38 -04:00
MattHag a7ad625023 Fix about dialog 2024-10-11 07:42:38 -04:00
MattHag 8d0672ac3c base_usb: Add external interface
Clean up, type hint and tests base_usb and related modules.
2024-10-11 07:42:38 -04:00
MattHag a75c4b9679 ui/about: Use Model-View-Presenter pattern for testability
Split model and view, and enable view mocks for unit tests without GDK.
2024-10-11 07:42:38 -04:00
MattHag 46fafa0e68 hidapi: Explicitly load hidapi/udev implementation
Linux uses udev, other platforms use the cross-platform hidapi
implementation. Remove implicit loading of hidapi in hidapi/__init__.py.
2024-10-11 07:42:38 -04:00
MattHag 99fc9c6fcb receiver: Remove hard dependency on hidapi 2024-10-11 07:42:38 -04:00
MattHag 615499dce2 device: Remove hard dependency on hidapi 2024-10-11 07:42:38 -04:00
MattHag 9907cb2875 Test coverage: Fix keysyms to be visible (#9)
Fix typo in package name.
2024-10-11 07:42:38 -04:00
MattHag 65d3b406c0 keysyms: Introduce tests for this package 2024-10-11 07:42:38 -04:00
MattHag b681aafaff keysymdef: Rename key symbols
Name the key symbol mapping different than the module itself.
2024-10-11 07:42:38 -04:00
MattHag 32fef49ff8 Upload test coverage reports solely after merging
Related #1097
2024-10-11 07:42:38 -04:00
Peter F. Patel-Schneider 4aada31b21 ui: augment pairing message for devices with multiple channels 2024-10-08 15:15:35 -04:00
MattHag 128ec43d70 solaar: Add type hints 2024-10-08 14:35:16 -04:00
MattHag 0481950324 base: Add type hints 2024-10-08 14:35:16 -04:00
MattHag aa354dc4c4 Replace global sw_id with function call
Add test for it.
2024-10-08 14:35:16 -04:00
MattHag 2442299539 base: Simplify receiver info retrieval
- Remove comments with unused receivers
- Simplify receiver hardcoded info
2024-10-08 14:35:16 -04:00
MattHag 2aa462532a settings_template: Prepare removal of desktop_notifications dependency
Related #2273
2024-10-08 14:35:16 -04:00
MattHag d5af19be8a Make ui/desktop_notifications testable
Introduce unit tests.

Related #2273
2024-10-08 14:35:16 -04:00
MattHag e8ef262433 Rename ui/notify module to desktop notifications
Related #2273
2024-10-08 14:35:16 -04:00
MattHag 912afff173 Make lr/desktop_notifications testable
Introduce unit tests.

Related #2273
2024-10-08 14:35:16 -04:00
MattHag 0f8ab61ddf Rename lr/notify module to desktop_notifications
Related #2273
2024-10-08 14:35:16 -04:00
MattHag c76b0ef36b Add code coverage badge
Related #1097
2024-10-08 14:35:16 -04:00
MattHag b1b9f01083 Setup reports and upload codecov
Create coverage.xml, upload it to GitHub CI and visualize with codecov.

Setup instruction:
- Install codecov for project
  https://github.com/settings/installations/55029514
- Add CODECOV_TOKEN in the GitHub CI project secrets

Related #1097
2024-10-08 14:35:16 -04:00
MattHag 454e1601bd Introduce test coverage threshold
Enforce a total coverage of 40% of the code.

Related #1097
2024-10-08 14:35:16 -04:00
MattHag c1bc39f99f Fix test coverage reporting
Related #1097
2024-10-08 14:35:16 -04:00
MattHag 26667afea4 Simplify setup with pathlib 2024-10-08 14:35:16 -04:00
MattHag 741c0861c2 Clarify that fake hidpp is used
This module shouldn't be necessary on the long run. Remove pieces from
it whenever possible.
2024-10-08 14:35:16 -04:00
MattHag 3c1aa35067 hidapi: Completely remove dependency on gi
Related #2480
2024-10-08 14:35:16 -04:00
MattHag 40033c0183 Introduce hid_parser tests
Add basic tests to cover the package.
2024-09-15 09:19:13 -04:00
MattHag 8fb087be14 logitech_receiver: Remove GDK dependency 2024-09-15 09:18:51 -04:00
MattHag ea0eb66f39 Refactor: Remove all GDK dependencies from hidapi package
The hidapi hardware layer must not know or depend on any UI libraries.
Removes all GDK dependencies from the hidapi packages, which makes
testing of these modules easier and removes unwanted cross-dependencies.

Related #2480
2024-09-15 09:18:51 -04:00
MattHag 70def31942 Refactor: Distinguish module from package
Adapt module names to easily distinguish them.

Related #2480
2024-09-15 09:18:51 -04:00