Yaroslav Chvanov
3bf556fb69
ratbagd: format with ruff format
2024-09-24 18:59:58 +03:00
Yaroslav Chvanov
1c9662043f
ratbagctl: use correct type hint for def main
...
Fixes: 34217a752b ("Update ratbagctl.test")
2024-06-04 18:52:37 +03:00
Yaroslav Chvanov
6f5470249d
ratbagctl: remove unused imports
2024-06-04 18:50:12 +03:00
Yaroslav Chvanov
4845cc901f
ratbagctl: fix Ruff warnings
2024-06-04 18:43:32 +03:00
Yaroslav Chvanov
20962d093d
ratbagc: fix new Ruff lints
...
Broke with Ruff v0.2.
- SIM401 Use `self._devices.get(id, None)` instead of an `if` block
- SIM113 Use `enumerate()` for index variable `i` in `for` loop
- Add type hint for Ratbagd._devices
2024-02-27 19:09:23 +03:00
Yaroslav Chvanov
79bb107634
ratbagd: fix typo
2024-01-14 02:58:18 +03:00
Michał Lubas
2d7b4c10d1
Add a delay before dbus sync in ratbagctl.test
2024-01-14 02:49:18 +03:00
Michał Lubas
27b0d4a2d9
Replace removed imp module with importlib
2024-01-14 02:48:08 +03:00
Michał Lubas
34217a752b
Update ratbagctl.test
2024-01-14 02:48:02 +03:00
Yaroslav Chvanov
2b878fd06a
libratbag: drop everything related to simple key action modifiers
...
Macros can be used for that instead, drivers can adapt them as needed.
Simple key actions will stay here for now, but I plan to completely
replace them with macros eventually.
2023-09-25 18:55:12 +03:00
Yaroslav Chvanov
e3cf227019
ratbagctl: ignore a Ruff f-string formatting warning (UP032)
...
I think we're better off ignoring the warning here (instead of repeating
the same argument like 10 times).
Fixes tests failing because UP032 was extended in Ruff (and this has
happened before). Pinning Ruff is probably a good idea. (Fixes #1515.)
2023-09-19 18:16:49 +03:00
Yaroslav Chvanov
a4eb09ea6d
ratbagd.py: sync with Piper
...
- Convert strings to f-strings
- Listen and notify about RatabgdProfile.Disabled changes
2023-07-17 18:05:06 +03:00
Yaroslav Chvanov
2311a84339
Use f-strings for formatting
...
Fixes Ruff warnings. Ruff didn't detect these before. Should we pin Ruff
version? 🤔
2023-07-17 00:31:53 +03:00
Ryan Jensen
0b5a95f09e
updating documentation: linux/input.h -> linux/input-event-codes.h
2023-07-08 10:26:07 +03:00
Yaroslav Chvanov
6e06fe7245
tools: fix printing of macros with buttons in them
...
As the fields are not always keys, also don't strip the first four
symbols of the string.
(as it's not always obvious what the stripped string can be, for example
BTN_0 and KEY_0).
2023-03-09 17:07:28 +03:00
Yaroslav Chvanov
3b7fc7a662
ratbagctl: show if a profile is dirty
2023-03-07 00:31:10 +03:00
Yaroslav Chvanov
c4ee9d707d
ratbagd.py: sync with Piper
...
- Fix a regression of profile not getting dirty after property changes.
- Add `notify` signals for more things.
- Do some minor refactoring.
2023-03-07 00:23:14 +03:00
Yaroslav Chvanov
44af3f145d
ratbagd.py: use the IsDirty property of the DBus API
2023-03-05 13:39:33 +03:00
Yaroslav Chvanov
84e8e63752
libratbag: don't apply active profile change until committing
2023-03-04 04:07:32 +03:00
Yaroslav Chvanov
a3f0ea9a52
tools: skip linter checks if linters are not installed
2023-03-04 03:37:31 +03:00
Yaroslav Chvanov
4b8ac177d1
tools: print errors to stderr
2023-03-04 03:34:12 +03:00
Yaroslav Chvanov
0e3f909264
ratbagd.py: add back .keys() calls on all GLib.Variant
...
This causes crashes on Piper side.
2023-03-03 23:37:26 +03:00
Kyoken
3f1e0f09cc
ratbagd.py: don't mark a profile as dirty on active profile switch
2023-03-03 15:40:06 +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
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