glutanimate / anjoy-public

Temporary repository to host bug reports and documentation for the AnJoy Anki add-on
https://www.patreon.com/glutanimate/posts?tag=AnJoy
4 stars 0 forks source link

Reveal Hint does not work (QKeyEvent does not work) #20

Open hight996 opened 3 years ago

hight996 commented 3 years ago

Problem description

It seems that the "reveal hint" action does not work. I would like to understand why, as I wish to add more registrable actions connected to keyboard shortcuts i.e. when I press a keyboard letter like "H" it reveals an image. It already works on my keyboard, I just cannot seem to assign this to the controller.

This is the code in the "actions.py":

@registerAction("Reveal Hint", "review")
def revealHint():
    evt = QKeyEvent(QEvent.KeyPress, Qt.Key_G, Qt.NoModifier)
    QCoreApplication.postEvent(mw, evt)

I tried to create this one following the same pattern:

@registerAction("Reveal image", "review")
def revealImage():
    evt = QKeyEvent(QEvent.KeyPress, Qt.Key_H, Qt.NoModifier)
    QCoreApplication.postEvent(mw, evt)

When I click on the assigned button, it shows me that I clicked on the "review hint" button, but nothing happens.

Checklist Please replace the space inside the brackets with an x if the following items apply:

[X ] I've restarted Anki to see if it helps
[X ] I've verified that I use the latest version of the add-on by redownloading it from AnkiWeb
[X ] I've verified that I use the latest version of Anki by checking at https://apps.ankiweb.net#download
[X ] I've tried to disable other add-ons to see if there are any interactions present
[ ] My issue disappears when I hold shift while starting Anki.
[X ] I've checked if anyone else reported this problem before by looking through the issue reports. I also checked to see if there is a section about known issues in the add-on description, documentation, or README.

Information about my Anki set-up

Anki 2.1.35 (84dcaa86) Python 3.8.0 Qt 5.14.2 PyQt 5.14.2
Platform: Windows 10
Flags: frz=True ao=True sv=2
Add-ons, last update check: 2021-05-25 23:18:15

===Add-ons (active)===
(add-on provided name [Add-on folder, installed at, version, is config changed])
'' ['Anjoy', 0, 'None', mod]
AMBOSS add-on ['0amboss_addon', 2021-03-10T18:17, 'None', '']
Add Hyperlink ['318752047', 2020-07-29T22:37, 'None', '']
Add Table ['1237621971', 2020-07-25T14:19, 'None', mod]
Advanced Browser ['874215009', 2020-11-08T12:03, 'None', '']
Advanced Copy Fields ['1898445115', 2019-05-03T20:46, 'None', '']
Anki Simulator ['817108664', 2021-02-21T16:44, 'None', '']
AnkiOCR ['450181164', 2021-05-22T05:46, 'None', '']
Answer Confirmation for 21 ['1354051622', 2019-04-04T14:54, 'None', '']
BetterTags ['bettertags', 2020-04-28T17:40, 'None', '']
Change Card Creation Times ['217650262', 2019-03-05T03:59, 'None', '']
Copy notes ['1566928056', 2021-02-20T00:54, 'None', '']
Countdown To Events  Exams ['1143540799', 2021-03-04T20:14, 'None', '']
Create Filtered Deck from the Browser ['861263371', 2017-08-29T20:57, 'None', '']
Customize Keyboard Shortcuts ['24411424', 2021-02-18T02:36, 'None', mod]
Duplicate Selected Notes ['2126361512', 2020-06-03T17:21, 'None', '']
Edit Field During Review Cloze ['385888438', 2020-12-17T09:42, 'None', mod]
Export in CSV format ['1478130872', 2019-01-21T19:21, 'None', '']
Frozen Fields ['516643804', 2020-06-03T17:02, 'None', '']
Highlight Search Results in the Browser ['225180905', 2021-03-10T18:06, 'None', '']
Image Occlusion Enhanced for Anki 21 alpha ['1374772155', 2020-04-28T04:21, 'None', '']
Large and Colorful Buttons ['1829090218', 2018-10-02T19:41, 'None', '']
Mini Format Pack ['295889520', 2020-05-29T20:51, 'None', '']
More Decks Stats and Time Left ['1556734708', 2021-01-27T10:09, 'None', '']
More Overview Stats 21 ['738807903', 2021-02-05T18:35, 'None', '']
Pop-up Dictionary beta ['153625306', 2019-03-23T18:32, 'None', '']
ReMemorize Rescheduler with sibling and logging v142 ['323586997', 2020-11-20T06:27, 'None', mod]
Refocus Card when Reviewing 21 ['1642550423', 2018-09-19T16:14, 'None', '']
Resize images in editor ['1103084694', 2020-08-02T15:04, 'None', mod]
Review Heatmap ['review_heatmap', 2020-04-30T15:23, 'None', '']
Set Font Size ['651521808', 2020-03-25T10:03, 'None', mod]
Symbols As You Type ['2040501954', 2021-03-22T03:17, 'None', '']
Syntax Highlighting for Code ['1463041493', 2018-10-07T03:31, 'None', '']
True Retention ['613684242', 2017-11-19T21:43, 'None', '']
Web Browser - Search terms Import texts and images automatically ['864545277', 2020-08-29T20:23, 'None', mod]
extended editor for field for tables searchreplace  ['805891399', 2020-11-24T01:08, 'None', '']

===IDs of active AnkiWeb add-ons===
1103084694 1143540799 1237621971 1354051622 1374772155 1463041493 1478130872 153625306 1556734708 1566928056 1642550423 1829090218 1898445115 2040501954 2126361512 217650262 225180905 24411424 295889520 318752047 323586997 385888438 450181164 516643804 613684242 651521808 738807903 805891399 817108664 861263371 864545277 874215009

===Add-ons (inactive)===
(add-on provided name [Add-on folder, installed at, version, is config changed])
Search and Replace Tags ['138501288', 2020-06-03T18:46, 'None', '']

Please fill in details about your operating system (Windows/macOS/Linux, which version):

Windows 10 64bit

I would gladly take your recommendations in order to fix this!