fonol / anki-search-inside-add-card

An add-on providing full-text-search and PDF reading functionality to Anki's Add card dialog
https://ankiweb.net/shared/info/1781298089
GNU Affero General Public License v3.0
178 stars 24 forks source link

Not working after 01-03-20 upgrade #66

Closed SimpNation2 closed 4 years ago

SimpNation2 commented 4 years ago

I'm having this issue after upgrade:

image

My Anki version is 2.1.11 (3cf770c7) Qt 5.12.1 PyQt 5.11.3

Before upgrade it was running fine.

By the way, consider upgrade pdf reader with some tools like highlight text, it would be incredible! Also, when I edit some card directly from add-on and I accidentally press on ESC, it doesn't ask if I want to prevent or save the changes. Could you improve that? Last thing, the search bar isn't that accurate and sometimes doesn't bring the cards with most keywords, why does that occurs? Thank you.

fonol commented 4 years ago

Hi, sorry, I forgot to specify that the new version uses Anki's new hooks, so it needs the newest Anki version (2.1.20) to work. About the ESC issue, I will look if I can change that. Do you mean the search bar in browser or in add-on mode? If add-on mode, what index are you using? (You can see that in Settings & Info -> Info)

Uitalo commented 4 years ago

Hi @fonol The shortcut Ctrl + F stopped working in the last update.

fonol commented 4 years ago

Hm, it works for me, I tested it on two machines. What does your config say for "toggleShortcut"? Did you install any other editor add-ons recently? Does Ctrl+o work for you? Maybe there try some other value for "toggleShortcut" (there might be a a conflict with another add-on shortcut=.

Edit: tested it on another machine, with Ubuntu, and it is working there too, so I guess it is either add-on interaction, or some config problem.

galantra commented 4 years ago

How do you think about adding a legacy version that supports the old hook system which was used prior to Anki 2.1.20? Ankiweb allows uploading more than one version under the same number, as seen here and here, for example.

Uitalo commented 4 years ago

@fonol I haven't added any Add-Ons recently, I just updated some that I had, tried a series of shortcuts, but with no positive result, I don't know what happens.

I tried to search for "Ctrl + F" in the add-ons folder as well and changed all possible conflicts, but also without success.

fonol commented 4 years ago

Hm, I guess even if you didn't add any other add-ons recently, the change in how this add-on registers its shortcuts might still be the reason there is now a conflict. Does it work if you disable your other add-ons? If you want to help me, you could open the Add dialog, then switch to the main window again, open the debug console (https://apps.ankiweb.net/docs/manual.html#debug-console), paste the following, and hit cmd/ctrl + enter: Edit: and set the shortcut to Ctrl+F again before.

from aqt import gui_hooks
print(gui_hooks.editor_did_init_shortcuts._hooks)

shortcut = next(s for s in aqt.dialogs._dialogs["AddCards"][1].findChildren(QShortcut) if s.key().toString() == "Ctrl+F")
print(shortcut)

I would be interested in the output.

@galantra Maybe when I got some time. Any particular reason you prefer to stay on older versions?

fonol commented 4 years ago

I added an update, which should show an error message if something goes wrong in the javascript part of the toggle shortcut, please report if something shows up if you try the shortcut with the update.

galantra commented 4 years ago

Any particular reason you prefer to stay on older versions?

It was chiefly because two add-ons didn't work, Night Mode and Zoom 2.1.

However I installed the newly released [https://ankiweb.net/shared/info/538879081](Anki Zoom) just today and switched to Anki 2.1.20. There, I use the native night mode.

As a consequence, I think I won't ever use the older version anymore. Thus there's no need anymore to make a legacy version as far as I'm concerned.

I hoped it would just require uploading an older version of the code.

Uitalo commented 4 years ago

@fonol It returned to work after the last update. I had been trying to disable recently updated add-ons by moving them to a different folder, but I was also unsuccessful. Do you want me to restore the previous version and take this test?

fonol commented 4 years ago

@Uitalo it is fine, I am happy as long as works for you. @galantra I guess most users will eventually move to 20 or later anyway, just for the built in night mode, so I guess there is no real need.