summaryrefslogtreecommitdiff
path: root/kvmd/keyboard
diff options
context:
space:
mode:
authorMaxim Devaev <[email protected]>2020-09-05 01:56:36 +0300
committerGitHub <[email protected]>2020-09-05 01:56:36 +0300
commit1257408183f0f0d649bb6302776107ed6c6a36f7 (patch)
treeef19423515ca1cc3dd6d7a45a5843220cfe46bfc /kvmd/keyboard
parentfc53759b3e7ddb0b570d35d1afb159080a805586 (diff)
parentdd2ff1ec832d00a29d33d5b54ee87f9a12b5af45 (diff)
Merge pull request #6 from OlegGirko/python-3.7
Make KVMD compatible with Python 3.7
Diffstat (limited to 'kvmd/keyboard')
-rw-r--r--kvmd/keyboard/keysym.py9
1 files changed, 6 insertions, 3 deletions
diff --git a/kvmd/keyboard/keysym.py b/kvmd/keyboard/keysym.py
index aa4a8676..2f2bc7a2 100644
--- a/kvmd/keyboard/keysym.py
+++ b/kvmd/keyboard/keysym.py
@@ -54,7 +54,8 @@ def build_symmap(path: str) -> Dict[int, SymmapWebKey]:
(path, list(_read_keyboard_layout(path).items())),
]:
for (code, key) in items:
- if (web_name := AT1_TO_WEB.get(key.code)) is not None:
+ web_name = AT1_TO_WEB.get(key.code)
+ if web_name is not None:
if (
(web_name in ["ShiftLeft", "ShiftRight"] and key.shift) # pylint: disable=too-many-boolean-expressions
or (web_name in ["AltLeft", "AltRight"] and key.altgr)
@@ -113,7 +114,8 @@ def _read_keyboard_layout(path: str) -> Dict[int, At1Key]: # Keysym to evdev (a
parts = line.split()
if len(parts) >= 2:
- if (x11_code := _resolve_keysym(parts[0])) != 0:
+ x11_code = _resolve_keysym(parts[0])
+ if x11_code != 0:
try:
at1_code = int(parts[1], 16)
except ValueError as err:
@@ -128,7 +130,8 @@ def _read_keyboard_layout(path: str) -> Dict[int, At1Key]: # Keysym to evdev (a
ctrl=("ctrl" in rest),
)
- if "addupper" in rest and (x11_code := _resolve_keysym(parts[0].upper())) != 0:
+ x11_code = _resolve_keysym(parts[0].upper())
+ if "addupper" in rest and x11_code != 0:
layout[x11_code] = At1Key(
code=at1_code,
shift=True,