Yaroslav Chvanov
1d24aa71d3
build: use project-local build and source directories
...
I think it should be possible to embed libratbag as a meson subproject
now (not tested).
2023-03-02 13:58:21 +03:00
Yaroslav Chvanov
a00531fe8b
lint: exit early if git ls-files doesn't find anything
2023-03-02 13:48:03 +03:00
Yaroslav Chvanov
265e1cee1a
test: fix traceback.print_exception() usage on older Python versions
2023-03-02 05:48:40 +03:00
Yaroslav Chvanov
e7a738086c
lint: enable flake8-return
2023-03-02 05:30:31 +03:00
Yaroslav Chvanov
40fb7430db
lint: enable flake8-simplify
2023-03-02 05:30:30 +03:00
Yaroslav Chvanov
27d74ae0f0
Use 'a != b' instead of 'not a == b'
2023-03-02 05:30:30 +03:00
Yaroslav Chvanov
80fa7f5b8f
Use 'key in dict' instead of 'key in dict.keys()'
2023-03-02 05:30:30 +03:00
Yaroslav Chvanov
78b56d6ea0
tools: make all exceptions types have Error as the sufix
2023-03-02 05:30:30 +03:00
Yaroslav Chvanov
e84a56c424
test: don't return anything from main()
2023-03-02 04:32:40 +03:00
Yaroslav Chvanov
04b77a3b9b
test: raise ValueError instead of AssertionError manually
2023-03-02 04:32:40 +03:00
Yaroslav Chvanov
57323ac978
ratbagctl: remove unnecessary else
2023-03-02 04:32:40 +03:00
Yaroslav Chvanov
8455c3ea71
ratbagctl: use standard exception types
2023-03-02 04:32:40 +03:00
Yaroslav Chvanov
3252d57b50
ratbagctl: fix an incorrect type hint
2023-03-02 04:32:40 +03:00
Yaroslav Chvanov
4b506a4ece
lint: enable flake8-pie lints
2023-03-02 04:32:40 +03:00
Yaroslav Chvanov
7551bdaeff
tools: remove unnecessary pass statements
2023-03-02 04:32:40 +03:00
Yaroslav Chvanov
ef2049643c
ratbagctl: use textwrap.indent instead of inventing the wheel ourselves
2023-03-02 04:32:39 +03:00
Yaroslav Chvanov
681153ad4d
doc: add angle snapping and debounce time
2023-03-02 03:01:06 +03:00
Yaroslav Chvanov
382df65a5d
sinowealth: implement debounce time reading/writing
2023-03-02 03:01:06 +03:00
Kyoken
51edc2967b
add angle snapping and debounce
2023-03-02 02:59:42 +03:00
Yaroslav Chvanov
37628da52f
Remove flake8 configuration file
...
We now use black and ruff instead.
2023-03-01 23:52:11 +03:00
Yaroslav Chvanov
1b2259a8cb
ratbagctl: rename a member function to prevent incorrect overriding
2023-03-01 23:01:10 +03:00
Yaroslav Chvanov
211551ff5b
ratbagctl: don't reuse a variable for different types
2023-03-01 23:01:10 +03:00
Yaroslav Chvanov
6c5a15172b
ratbagctl: make an argument non-optional
2023-03-01 23:01:10 +03:00
Yaroslav Chvanov
e43a7a279b
ratbagctl: simplify an expression to make mypy understand it
2023-03-01 23:01:10 +03:00
Yaroslav Chvanov
3be064aef0
ratbagctl: add type hints where possible
...
We use the dynamic nature of Python for parsing command line arguments,
which makes it nearly impossible to type hint everything.
2023-03-01 23:01:10 +03:00
Yaroslav Chvanov
9b45b2ac03
tools: fix "line too long" warnings where possible
2023-03-01 22:18:41 +03:00
Yaroslav Chvanov
2bf349459b
tools: ignore a false positive warning
2023-03-01 22:17:32 +03:00
Yaroslav Chvanov
57ac72077f
tools: don't use complex types as default function arguments
2023-03-01 22:17:32 +03:00
Yaroslav Chvanov
a192088f13
tools: chain exceptions within exceptions
2023-03-01 22:17:32 +03:00
Yaroslav Chvanov
fa67024110
tools: fix ambiguous variable names
...
These one-letter variable names really are bad.
A good illustration of this is resolutions being assigned to the
variable where Ratbagd was, both of such variables were always names
just "r".
2023-03-01 22:17:32 +03:00
Yaroslav Chvanov
2ba49ba185
test: fix ambiguous variable names
2023-03-01 22:17:31 +03:00
Yaroslav Chvanov
a66e6d2066
Automatically fix Ruff warnings
2023-03-01 22:17:31 +03:00
Yaroslav Chvanov
3aa82d2b35
build: add Ruff for Python code linting
2023-03-01 22:17:31 +03:00
Yaroslav Chvanov
49146638a6
Format Python code
2023-03-01 22:17:31 +03:00
Yaroslav Chvanov
c723490fc3
build: add Python code formatting with black
...
NOTE: this will fail tests as of this commit, as the code is not
formatted yet.
We didn't explicitly specify a minimum Python version before that, so I
used v3.7 here, because it's the minimal version Ruff - a Python linter
I will add in the next commit - supports.
2023-03-01 22:17:31 +03:00
Yaroslav Chvanov
bc9fa92667
tools: prevent a syntax error for code editors and linters
2023-03-01 22:17:31 +03:00
Yaroslav Chvanov
41b55a1aff
Rename Python files throughout the project to have .py* in the suffix
...
This just makes it more clear what these files are without opening them.
2023-03-01 22:17:31 +03:00
Yaroslav Chvanov
f6a3cd74bf
gskill: add back button type button actions
...
Regression since 5548da21d3 .
However I'm almost 100% sure this displays incorrect mouse buttons.
2023-03-01 20:48:48 +03:00
Yaroslav Chvanov
f9266496b0
ratbagctl: check if there is an active resolution
2023-03-01 03:59:58 +03:00
Yaroslav Chvanov
26cc2c7138
ratbagctl: check if there is an active profile
2023-03-01 03:59:19 +03:00
Yaroslav Chvanov
11f1ba9f37
tools: don't try to return the first resolution on error
2023-03-01 03:58:58 +03:00
Yaroslav Chvanov
fc80221187
tools: don't try to return the first profile on error
...
This may make an exception.
2023-03-01 03:57:54 +03:00
Yaroslav Chvanov
bc05935322
sinowealth: use the first profile if active profile index is too high
...
It seems like some devices now do have several profiles support enabled
officially. We failed to probe such mice if they have had non-first
profile as active. This fixes it.
2023-03-01 03:27:02 +03:00
Yaroslav Chvanov
fb5995a731
sinowealth: get rid of profile cache
...
This just duplicates data between libratbag and the driver.
2023-03-01 03:27:02 +03:00
Yaroslav Chvanov
b92645c373
sinowealth: edit a note about active profile index to be more clear
2023-03-01 03:27:02 +03:00
Yaroslav Chvanov
08d7c6997d
sinowealth: move active profile index and debounce time getting to init
...
They were out of place being directly in the `probe` function.
Also, this will make more sense once we add an API for changing debounce
times.
2023-03-01 03:26:15 +03:00
Yaroslav Chvanov
9ec8c728cd
sinowealth: add missing new-line in a log message
2023-03-01 03:25:04 +03:00
Yaroslav Chvanov
085274678f
sinowealth: don't change active profile while probing
...
Official configuration utilities did this while probing if I remember
correctly, but it's not actually necessary.
2023-03-01 03:22:32 +03:00
Yaroslav Chvanov
5ab018df79
libratbag: remove everything related to the deprecated ratbag_led_type
2023-02-25 14:05:03 +03:00
Yaroslav Chvanov
87f1409b7a
test: remove usage of the deprecated LED type field
2023-02-25 14:02:37 +03:00