From 831b26adda4bcdb2ce699401ffe6f00aa5827574 Mon Sep 17 00:00:00 2001 From: Geobert Quach Date: Sun, 17 Nov 2024 21:15:25 +0100 Subject: [PATCH 1/2] fix(klc): avoid empty keys This avoid "Too many OEM" because of empty keys. Now we exit if such a key is detected --- kalamine/generators/klc.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/kalamine/generators/klc.py b/kalamine/generators/klc.py index 60ff718..116b677 100644 --- a/kalamine/generators/klc.py +++ b/kalamine/generators/klc.py @@ -81,6 +81,8 @@ def klc_virtual_key(layout: "KeyboardLayout", symbols: list, scan_code: str) -> return "OEM_MINUS" elif base == " ": return "SPACE" + elif base == "-1" and shifted == "-1": + raise Exception("Empty key are not allowed, please complete the description") else: MAX_OEM = 9 # We affect abitrary OEM VK and it will not match the one From 47b18c183c9da140fed2a3cc55a701d6cbdafca1 Mon Sep 17 00:00:00 2001 From: Geobert Quach Date: Sat, 23 Nov 2024 19:54:48 +0000 Subject: [PATCH 2/2] Update kalamine/generators/klc.py Co-authored-by: Fabien Cazenave --- kalamine/generators/klc.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/kalamine/generators/klc.py b/kalamine/generators/klc.py index 116b677..fd3b0e3 100644 --- a/kalamine/generators/klc.py +++ b/kalamine/generators/klc.py @@ -82,7 +82,7 @@ def klc_virtual_key(layout: "KeyboardLayout", symbols: list, scan_code: str) -> elif base == " ": return "SPACE" elif base == "-1" and shifted == "-1": - raise Exception("Empty key are not allowed, please complete the description") + raise Exception("Empty keys are not allowed, please complete the description") else: MAX_OEM = 9 # We affect abitrary OEM VK and it will not match the one