Commit Graph

60 Commits

Author SHA1 Message Date
DomHeadroom 90ab457ebe Rewrote string concatenation/format with f strings 2025-01-29 08:40:14 -05:00
MattHag 5f5c7cdcce Fixes on top of refactoring 2025-01-01 10:46:04 -05:00
MattHag 5a9725ee17 Add type hints
Related #2273
2025-01-01 10:46:04 -05:00
MattHag 1afcfe4b57
refactor: use IntEnum for firmware and cidgroup constances
* Refactor: test_named_ints_flag_names

Shorten test and clarify behavior using binary numbers.

* Introduce plain flag_names function

This replicates the NamedInts functionality as plain function.

* Refactor FeatureFlag to use IntFlag

Replace NamedInts implementation with IntFlag enum and plain flag_names
function.

Related #2273

* Refactor FirmwareKind to use IntEnum

- Move general FirmwareKind to common module.
- Replace NamedInts implementation with IntEnum.
- Harden related HIDPP 1.0 get_firmware test.

Related #2273

* Refactor CID_GROUP, CID_GROUP_BIT to use IntEnum

Related #2273
2024-10-23 16:25:35 -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 86b55b9c25 Introduce Enum BusID
Distinguishes Bluetooth and USB devices.
2024-06-03 08:37:02 -04:00
MattHag 7f5e156fa1 Introduce constant for Logitech vendor ID
The Vendor ID for Logitech is 0x46D = 1133.
2024-06-03 08:37:02 -04:00
MattHag d67466298b Introduce Enum for notification types 2024-06-03 08:37:02 -04:00
Peter F. Patel-Schneider 2113e63a75 device: be defensive when converting battery status to string 2024-06-03 08:33:11 -04:00
MattHag 815dce07be Unify imports in logitech package
Related #2273
2024-05-23 16:42:18 -04:00
Matthias Hagmann c9dc232951 Refactor: Use dataclasses and enums
Replace unnecessary NamedInts in favour of default data types.
Simplify interfaces by reducing possible input from strings to members
of an enum.
2024-05-22 21:14:41 -04:00
MistificaT0r 4225fce8d7
po: update Russion translation and have all strings translated
* update Russian translation

* Fixed translation display in GUI

* fix checks / Fixed translation display in GUI
2024-04-21 11:36:39 -04:00
Peter F. Patel-Schneider 4d0f93b35c tests: improve infrastructure for testing setting_templates 2024-03-27 11:15:15 -04:00
Matthias Hagmann 6f613b17c7 refactor: Manually improve f-string formatting 2024-03-24 07:01:56 -04:00
Matthias Hagmann 4e6361429e refactor: Use f-strings for more exceptions and log message
Semi manually convert remaining strings with no translation to f-string.
2024-03-24 07:01:56 -04:00
Peter F. Patel-Schneider 4e4275c281 device: remove unreachable code 2024-03-14 17:08:47 -04:00
Matthias Hagmann 5b09ace1f5 ruff: Apply single line import format
# Usage
pre-commit run --all-files

Related #2295
2024-03-13 15:41:21 -04:00
Matthias Hagmann e92f1a8a0b Automatically upgrade strings to f-string
Used flynt to convert strings to f-strings, where safely possible.

Usage:
flynt .

Related #2372
2024-03-13 11:02:50 -04:00
Peter F. Patel-Schneider 15d425c365 device: move battery information from status to Device 2024-03-11 08:23:27 -04:00
Peter F. Patel-Schneider 523628926b device: use Python 3.7 type hints 2024-03-09 10:36:40 -05:00
Peter F. Patel-Schneider 64d8cad81a device: change status battery fields to Battery objects 2024-03-09 10:36:40 -05:00
MattHag 574a95da50
cleanup: Remove unnecessary calls of del
Related #2273
2024-03-02 10:48:06 -05:00
Matthias Hagmann 7ef3059b69 clean up: Remove editor specific marks
Related #2273
2024-02-29 10:10:46 -05:00
Peter F. Patel-Schneider 646ef2f596 device: move battery constants common to HID++ 1.0 and 2.0 to common 2024-02-22 09:57:02 -05:00
Matthias Hagmann eb937fcc3a Manually fix linter issues
Related #2295
2024-02-20 15:41:10 -05:00
Matthias Hagmann 7774569971 Apply ruff format
Run ruff auto formatting using:
ruff format .

Related #2295
2024-02-20 15:41:10 -05:00
Peter F. Patel-Schneider fb30f4ee41 device: support onboard profiles 2024-02-07 18:48:22 -05:00
FiveYellowMice 636bb07d1f NamedInt: return False on comparison with None 2023-11-04 13:27:50 -04:00
Peter F. Patel-Schneider fe901fe3c2 device: more robust access to keyword exception fields 2022-12-06 14:20:59 -05:00
ejsc1 5656f90cdb
misc: update yapf version
* misc: update yapf version v2

* Update .pre-commit-config.yaml

Co-authored-by: Peter F. Patel-Schneider <pfpschneider@gmail.com>
2022-11-26 22:37:32 -05:00
Peter F. Patel-Schneider f1e2a0c449 receiver: use built-ins for conversions between int and byte string 2022-06-21 18:39:37 -04:00
Peter F. Patel-Schneider fcddd94d7d common: add alternative way to initialize NamedInts and lower python dependency to 3.6 2022-04-20 17:14:08 -04:00
Peter F. Patel-Schneider bb20631a27 misc: remove support for Python 2 unicode 2022-04-11 13:20:42 -04:00
Peter F. Patel-Schneider 509c68ba05 misc: silence incorrect style complaints 2022-04-04 13:17:40 -04:00
Peter F. Patel-Schneider 7a9f9972a6 receiver: fix contains for NamedInts and eliminate use of has_element 2022-01-24 14:03:17 -05:00
Vinícius c3e88001e4 logitech_receiver: add has_element to NamedInts 2022-01-24 11:12:04 -05:00
Vinícius 29ff5e5924 logitech_receiver: add UnsortedNamedInts 2022-01-24 11:12:04 -05:00
Vinícius 8c32c2e63c ui: add new Set rules to rule editor (partial support) 2022-01-24 11:12:04 -05:00
Hugo Osvaldo Barrera 6c4e0333d4 Drop legacy Python 2 `super()` syntax
This is a no-op on Python 3.
2021-10-30 16:49:41 -04:00
Hugo Osvaldo Barrera cf28308a9f Simplify yield syntax 2021-10-30 16:49:41 -04:00
Hugo Osvaldo Barrera df83fd655c Stop declaring `object` as superclass
This syntax was only required on Python 2 and has no effect on Python 3.
2021-10-30 16:49:41 -04:00
Hugo Osvaldo Barrera 22bf4fafff Drop unnecessary __future__ imports
These are all active by default on all recent Python versions.
2021-10-30 16:49:41 -04:00
Hugo Osvaldo Barrera b96d16672b Drop obsolete encoding declaration
This was only parsed in Python 2.
Python 3 only supports UTF-8 for source files, and that's what it uses.
2021-10-30 16:49:41 -04:00
Peter F. Patel-Schneider 02a7d8cadd util: allow accessing NamedInts by readable name 2020-11-13 08:46:04 -05:00
Peter F. Patel-Schneider 733bf913e6 device: implement UNIFIED_BATTERY feature
device: implement UNIFIED_BATTERY feature
2020-11-02 08:27:08 -05:00
Wojciech Nawrocki 95dc973748 hidpp20: add full support for version 2 of REPROG_CONTROLS_V4 2020-08-07 13:40:36 -04:00
Filipe Laíns 27c90fa736 yapf: adjust style to not indent closing brackets
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2020-07-07 15:11:15 +01:00
Filipe Laíns 8e89aa0038 yapf: set max line lenght to 127
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2020-07-07 15:11:15 +01:00
Filipe Laíns 627185079f flake8: initial fix
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2020-07-07 15:11:15 +01:00
Filipe Laíns 33521558ed pre-commit: initial fix
Signed-off-by: Filipe Laíns <lains@archlinux.org>
2020-07-07 15:11:15 +01:00