@@ -306,19 +306,20 @@ def on_recover(_, e: SuspensionEvent) -> None:
306306 initialize_main ()
307307
308308 def on_press (key : _Key | _KeyCode ) -> None :
309- match key :
310- case _KeyCode .from_char ("1" ):
311- make_system_switch (ctx , SystemLiteral .DTCS , w .runtime_data ())()
312- case _KeyCode .from_char ("2" ):
313- make_system_switch (ctx , SystemLiteral .ABS , w .runtime_data ())()
314- case _KeyCode .from_char ("3" ):
315- make_system_switch (ctx , SystemLiteral .EBI , w .runtime_data ())()
316- case _KeyCode .from_char ("4" ):
317- make_system_switch (ctx , SystemLiteral .ATBS , w .runtime_data ())()
318- case _KeyCode .from_char ("t" ):
319- ctx .time_lap ()
320- case _Key .esc :
321- uim .kill ()
309+ if isinstance (key , _KeyCode ):
310+ match key .char :
311+ case "1" :
312+ make_system_switch (ctx , SystemLiteral .DTCS , w .runtime_data ())()
313+ case "2" :
314+ make_system_switch (ctx , SystemLiteral .ABS , w .runtime_data ())()
315+ case "3" :
316+ make_system_switch (ctx , SystemLiteral .EBI , w .runtime_data ())()
317+ case "4" :
318+ make_system_switch (ctx , SystemLiteral .ATBS , w .runtime_data ())()
319+ case "t" :
320+ ctx .time_lap ()
321+ elif key == _Key .esc :
322+ uim .kill ()
322323
323324 _Listener (on_press = on_press ).start ()
324325 uim .show ()
0 commit comments