Explorar el Código

fix keyerror when receiving key event of unmapped keysym

Fabian Peter Hammerle hace 4 años
padre
commit
b837e1e79e
Se han modificado 1 ficheros con 5 adiciones y 1 borrados
  1. 5 1
      rescriptoon/__init__.py

+ 5 - 1
rescriptoon/__init__.py

@@ -139,7 +139,11 @@ class Overlay:
     ) -> None:
         self._update_active_key_registry(xkeyevent)
         keysym_in = self.xdisplay.keycode_to_keysym(xkeyevent.detail, index=0,)
-        action = self._keysym_mappings[keysym_in]
+        try:
+            action = self._keysym_mappings[keysym_in]
+        except KeyError:
+            logging.warning("received key event of unmapped keysym %d", keysym_in)
+            return
         action.execute(self, xkeyevent)
 
     @property