This commit is contained in:
sezanzeb 2021-01-01 14:45:07 +01:00
parent be5f75efaf
commit e20f3fbbf9
5 changed files with 13 additions and 11 deletions

View File

@ -53,7 +53,7 @@ def to_string(key):
return 'unknown'
if code not in evdev.ecodes.bytype[ev_type]:
logger.error('Unknown key code for', key)
logger.error('Unknown key code for %s', key)
return 'unknown'
key_name = evdev.ecodes.bytype[ev_type][code]
@ -215,7 +215,7 @@ class Row(Gtk.ListBoxRow):
previous_key=None
)
def match(self, completion, key, tree_iter):
def match(self, _, key, tree_iter):
"""Search the avilable names."""
value = store.get_value(tree_iter, 0)
return key in value.lower()
@ -236,12 +236,12 @@ class Row(Gtk.ListBoxRow):
self.set_keycode_input_label('press key')
self.keycode_input.set_opacity(1)
def on_keycode_input_focus(self, *args):
def on_keycode_input_focus(self, *_):
"""Refresh useful usage information."""
self.show_press_key()
self.window.can_modify_mapping()
def on_keycode_input_unfocus(self, *args):
def on_keycode_input_unfocus(self, *_):
"""Refresh useful usage information and set some state stuff."""
self.show_click_here()
self.keycode_input.set_active(False)
@ -328,7 +328,7 @@ class Row(Gtk.ListBoxRow):
self.add(box)
self.show_all()
def on_delete_button_clicked(self, *args):
def on_delete_button_clicked(self, *_):
"""Destroy the row and remove it from the config."""
key = self.get_key()
if key is not None:

View File

@ -183,7 +183,7 @@ class Window:
self.ctrl = 0
def key_press(self, window, event):
def key_press(self, _, event):
"""To execute shortcuts.
This has nothing to do with the keycode reader.
@ -195,7 +195,7 @@ class Window:
if gdk_keycode == Gdk.KEY_q and self.ctrl:
self.on_close()
def key_release(self, window, event):
def key_release(self, _, event):
"""To execute shortcuts.
This has nothing to do with the keycode reader.
@ -314,7 +314,7 @@ class Window:
key_list = self.get('key_list')
key_list.forall(lambda row: row.unhighlight())
def can_modify_mapping(self, *args):
def can_modify_mapping(self, *_):
"""Show a message if changing the mapping is not possible."""
if not self.dbus.is_injecting(self.selected_device):
return
@ -421,7 +421,7 @@ class Window:
self.show_status(CTX_ERROR, msg, error)
@with_selected_preset
def on_save_preset_clicked(self, button):
def on_save_preset_clicked(self, _):
"""Save changes to a preset to the file system."""
new_name = self.get('preset_name_input').get_text()
try:

View File

@ -43,6 +43,7 @@ DIFFICULT_COMBINATIONS = [
ecodes.KEY_LEFTALT, ecodes.KEY_RIGHTALT
]
class Key:
"""Represents one or more pressed down keys.

View File

@ -17,7 +17,7 @@
<text x="22.0" y="14">pylint</text>
</g>
<g fill="#fff" text-anchor="middle" font-family="DejaVu Sans,Verdana,Geneva,sans-serif" font-size="11">
<text x="63.0" y="15" fill="#010101" fill-opacity=".3">9.69</text>
<text x="62.0" y="14">9.69</text>
<text x="63.0" y="15" fill="#010101" fill-opacity=".3">9.78</text>
<text x="62.0" y="14">9.78</text>
</g>
</svg>

Before

Width:  |  Height:  |  Size: 1.0 KiB

After

Width:  |  Height:  |  Size: 1.0 KiB

View File

@ -233,6 +233,7 @@ class TestIntegration(unittest.TestCase):
self.assertEqual(to_string(Key(EV_ABS, evdev.ecodes.ABS_HAT0X, -1)), 'ABS_HAT0X L')
self.assertEqual(to_string(Key(EV_ABS, evdev.ecodes.ABS_HAT0X, 1)), 'ABS_HAT0X R')
self.assertEqual(to_string(Key(EV_KEY, evdev.ecodes.BTN_A, 1)), 'BTN_A')
self.assertEqual(to_string(Key(EV_KEY, 1234, 1)), 'unknown')
# combinations
self.assertEqual(to_string(Key(