image-occlusion-enhanced
image-occlusion-enhanced copied to clipboard
Overriding contextMenuEvent/runHook breaks other addons using "new style" hooks (c.f. #151)
Problem description
The addon as downloaded from ankiweb (https://ankiweb.net/shared/info/1374772155) overrides the context menu and "manually" fires other legacy hooks, rather than adding to the context menu. This in turn breaks addons trying to implement "new style" hooks (gui_hooks.editor_will_show_context_menu
).
Offending lines:
- main.py[160]:
runHook("EditorWebView.contextMenuEvent", self, m)
<- this doesn't fire the "new style"gui_hooks.editor_will_show_context_menu
- main.py[262]:
EditorWebView.contextMenuEvent = contextMenuEvent
A quick hack would be to also fire the "new style" hooks "manually" on line 160.
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
- [X] 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 your Anki set-up
Please open Anki, go to Help → About, click on "Copy Debug Info", and paste the result between the backticks below (if the button does not appear you are using an older version of Anki 2.1 and will need to update first):
Anki 2.1.49 (dc80804a) Python 3.8.6 Qt 5.14.2 PyQt 5.14.2
Platform: Windows 10
Flags: frz=True ao=True sv=2
Add-ons, last update check: 2022-01-03 12:03:51
===Add-ons (active)===
(add-on provided name [Add-on folder, installed at, version, is config changed])
Add Table ['1237621971', 2021-12-05T21:27, 'None', mod]
Advanced Browser ['874215009', 2021-07-22T23:14, 'None', '']
AnkiWebView Inspector ['31746032', 2019-05-03T00:43, 'None', '']
CSS Injector - Change default editor styles ['181103283', 2021-10-05T00:29, 'None', '']
Editor Scripts Symbols ['2065559429', 2021-12-06T02:44, 'None', mod]
External Note Editor for the Browser ['1996266159', 2020-03-31T22:59, 'None', mod]
Flexible Cloze ['1632356464', 2022-01-01T14:01, 'None', '']
Image Occlusion Enhanced for Anki 21 alpha ['1374772155', 2020-04-28T04:21, 'None', '']
Mini Format Pack ['295889520', 2018-07-24T19:45, 'None', mod]
Opening the same window multiple time ['354407385', 2020-05-16T02:59, 'None', '']
PDF to notes ['1250587448', 2022-01-01T11:58, 'None', '']
Resize images in editor ['1103084694', 2021-07-19T08:35, 'None', mod]
Search to notes ['1034341786', 2022-01-01T12:09, 'None', mod]
Symbols As You Type ['2040501954', 2021-03-22T03:17, 'None', '']
copy note contents to new Add window from Browser Reviewer Add EditCurrent ['759018284', 2021-12-11T00:23, 'None', '']
extended editor for field for tables searchreplace ['805891399', 2021-12-06T15:59, 'None', mod]
show new siblings in order no same day spacingrandomization for new siblings ['268644742', 2020-02-18T19:41, 'None', mod]
===IDs of active AnkiWeb add-ons===
1034341786 1103084694 1237621971 1250587448 1374772155 1632356464 181103283 1996266159 2040501954 2065559429 268644742 295889520 31746032 354407385 759018284 805891399 874215009
Error message (if any)
If you've received an error message, please copy and paste it between the backticks below:
This bug is annoying. I think that at the moment this breaks about 15 addons from ankiweb. I sometimes get reports that one of my add-ons is broken and - after pointing out that the problem is actually IO - I'm told that it "must" be adjusted to the popular IO. I don't understand why there's no targeted fix for this problem - it's a quick fix and it's not really conceivable that there are side-effects.
Thanks for the reports, guys. I will scope this in for the upcoming 2.1.50 compat release.