Liresol / anki-custom-shortcuts

Custom Keyboard Shortcuts for Anki 2.1
MIT License
60 stars 14 forks source link

Qt keys (eg, `Qt.Key.Key_Escape`) do not work #196

Open dempe opened 1 year ago

dempe commented 1 year ago

Apologies if this is a non-issue. I wasn't able to find any solution that worked. Have tried Esc, Escape, Qt.Key_Escape, but no dice. Wanted to set "main deckbrowser": "Qt.Key_Escape",

Steps to reproduce:

  1. Set the following in your Custom Shortcuts config: "main study": "Qt.Key.Key_Enter",.
  2. Restart Anki
  3. Hit enter to review

The intended effect is to review the deck, but it does not seem to have any effect.

The same is true for the other "Qt.Key.*" keys and for other actions (e.g., Qt.Key.Key_Escape to return to the decks browser). This is true even after updating from the old format.

JodokF commented 1 year ago

I got the exact same problem here! Using Escape to return to the deckbrowser seems like a intuitive behavior. Would be nice to know if it is possible to use it.

dempe commented 1 year ago

I was just checking my Anki logs and noticed this message:

addons21/24411424/custom_shortcuts.py:35:json is deprecated: please implement your own
addons21/24411424/custom_shortcuts.py:54:'Qt.Key_Enter' will stop working. Please use 'Qt.Key.Key_Enter' instead.
addons21/24411424/custom_shortcuts.py:55:'Qt.Key_Return' will stop working. Please use 'Qt.Key.Key_Return' instead.
addons21/24411424/custom_shortcuts.py:56:'Qt.Key_Escape' will stop working. Please use 'Qt.Key.Key_Escape' instead.
addons21/24411424/custom_shortcuts.py:57:'Qt.Key_Space' will stop working. Please use 'Qt.Key.Key_Space' instead.
addons21/24411424/custom_shortcuts.py:58:'Qt.Key_Tab' will stop working. Please use 'Qt.Key.Key_Tab' instead.
addons21/24411424/custom_shortcuts.py:59:'Qt.Key_Backspace' will stop working. Please use 'Qt.Key.Key_Backspace' instead.
addons21/24411424/custom_shortcuts.py:60:'Qt.Key_Delete' will stop working. Please use 'Qt.Key.Key_Delete' instead.
addons21/24411424/custom_shortcuts.py:61:'Qt.Key_Left' will stop working. Please use 'Qt.Key.Key_Left' instead.
addons21/24411424/custom_shortcuts.py:62:'Qt.Key_Down' will stop working. Please use 'Qt.Key.Key_Down' instead.
addons21/24411424/custom_shortcuts.py:63:'Qt.Key_Right' will stop working. Please use 'Qt.Key.Key_Right' instead.
addons21/24411424/custom_shortcuts.py:64:'Qt.Key_Up' will stop working. Please use 'Qt.Key.Key_Up' instead.
addons21/24411424/custom_shortcuts.py:65:'Qt.Key_PageUp' will stop working. Please use 'Qt.Key.Key_PageUp' instead.
addons21/24411424/custom_shortcuts.py:66:'Qt.Key_PageDown' will stop working. Please use 'Qt.Key.Key_PageDown' instead.

It is now working for me using Qt.Key.Key_Escape.

JodokF commented 1 year ago

@dempe, does "main deckbrowser": "Qt.Key.Key_Escape" work for you when you are in review mode, that it returns to the deckbrowser? For me it doesn't. But for example '"main deckbrowser": "e" works for me to return to the deckbrowser from reviewing. Setting "reviewer deckbrowser": "Qt.Key.Key_Escape" does not work either! :(

dempe commented 1 year ago

@BOOO9, ahh... I tested this for everything else. For me, it works from the browser, the editor, the stats page, and the debug page. I did not test the reviewer since I only review on mobile, but you are right. It does not work from the reviewer. I'll go ahead and update the issue to reflect that.

dempe commented 1 year ago

@BOOO9, it looks like it was just a coincidence that escape started working for (most) pages - stats, debug, the browser, and the editor all now open in a new window, so you can use escape to exit by default. The reviewer, however, opens in the same window, so you cannot use escape there.

So the same issue still appears to be happening.

JodokF commented 1 year ago

Ah ok, I'm glad to see that you @dempe are experiencing the exact same behaviour as I am. Thanks for updating the issue! Curious if anyone has a solution, unfortunately I'm too much of a programming noob to be of much help here. :/