Yaroslav Chvanov
a00531fe8b
lint: exit early if git ls-files doesn't find anything
2023-03-02 13:48:03 +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
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
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
Kyoken
51edc2967b
add angle snapping and debounce
2023-03-02 02:59:42 +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
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
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
84626322c7
tools: remove helpers for deprecated LED types
2023-02-25 13:30:06 +03:00
Yaroslav Chvanov
85cab665b5
tools: remove helpers for the deprecated ratbag_button_type
2023-02-25 13:03:37 +03:00
Yaroslav Chvanov
9ec13c2862
tools: write to file directly without using print
2023-02-25 01:03:13 +03:00
Yaroslav Chvanov
3be9f38d2c
tools: remove unused variables
2023-02-25 00:57:18 +03:00
Yaroslav Chvanov
e49c18b909
tools: use with-statements to open files
...
I'll be honest, writing to files with `print` looks weird...
2023-02-25 00:55:53 +03:00
Yaroslav Chvanov
0db55eda25
tools: remove unused arguments
2023-02-25 00:22:07 +03:00
Yaroslav Chvanov
313c34fa98
tools: fix incorrect special method signature
...
Continuation of 62678baca1 .
2023-02-25 00:22:07 +03:00
Yaroslav Chvanov
b275204c87
tools: check snprintf size argument to prevent potential overflow
2023-02-25 00:22:07 +03:00
Yaroslav Chvanov
1eed280b82
tools: remove an unused function that always raises
...
..unless it's used by some third-party library? Either way, it just
raises an error.
2023-02-24 23:43:33 +03:00
Yaroslav Chvanov
dcdd7be8d8
tools: remove an unnecessary variable definition
2023-02-24 22:46:34 +03:00
Yaroslav Chvanov
62678baca1
tools: fix incorrect special method signature
...
They worked fine nonetheless as we only called these manually.
2023-02-24 22:43:37 +03:00
Yaroslav Chvanov
4b2b5a2038
ratbagctl: capitalize device type instead of having it in upper case
2023-02-14 16:29:21 +03:00
Julian Kandlhofer
4f36371af3
implement 'DeviceType' property
...
Signed-off-by: Julian Kandlhofer <julian.kandlhofer@gmail.com >
2023-02-14 16:29:20 +03:00
Yaroslav Chvanov
440292fda1
device: add firmware version API
2023-01-03 04:21:07 +03:00
Yaroslav Chvanov
7a5b9b4367
Fix typos throughout the codebase
2023-01-03 04:17:44 +03:00
Yaroslav Chvanov
f595c96495
ratbagctl: fix typo
2022-12-26 23:44:48 +03:00
Stephan Lachnit
45118b8fa5
Implement disabled resolutions
...
Implements feature to disable resolutions from a static resolution list.
Updates DBus API and tests accordingly.
Signed-off-by: Stephan Lachnit <stephanlachnit@protonmail.com >
2022-12-25 22:54:16 +03:00
Stephan Lachnit
c99fd654e3
Make order of resolution properties consistent
...
Resolution properties should be in the order (active, default).
Signed-off-by: Stephan Lachnit <stephanlachnit@protonmail.com >
2022-12-25 22:54:16 +03:00